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
Fixes <https://github.com/Genymobile/scrcpy/issues/1658>
@@ -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
