From 95f1ea0d80e6bb61579ae6c9a50554d235d91383 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 10 Aug 2020 13:15:44 +0200 Subject: [PATCH] Fix clipboard paste condition To avoid possible copy-paste loops between the computer and the device, the device clipboard is not set if it already contains the expected content. But the condition was wrong: it was not set also if it was empty. Refs 1223a72eb83ebafb878a25356250896c45b5cefa Fixes #1658 --- server/src/main/java/com/genymobile/scrcpy/Device.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/Device.java b/server/src/main/java/com/genymobile/scrcpy/Device.java index de551f35..f23dd056 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Device.java +++ b/server/src/main/java/com/genymobile/scrcpy/Device.java @@ -223,7 +223,7 @@ public final class Device { } String currentClipboard = getClipboardText(); - if (currentClipboard == null || currentClipboard.equals(text)) { + if (currentClipboard != null && currentClipboard.equals(text)) { // The clipboard already contains the requested text. // Since pasting text from the computer involves setting the device clipboard, it could be set twice on a copy-paste. This would cause // the clipboard listeners to be notified twice, and that would flood the Android keyboard clipboard history. To workaround this