From 808bd14e301351ce63b4fc45ac54d3bf34423e94 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Tue, 27 Jun 2023 18:43:22 +0200 Subject: [PATCH] Ignore fold change events for other display ids Scrcpy mirrors a specific display id, it must ignore events for other display ids. Fixes #4120 --- server/src/main/java/com/genymobile/scrcpy/Device.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/main/java/com/genymobile/scrcpy/Device.java b/server/src/main/java/com/genymobile/scrcpy/Device.java index f817a3ce..4ab689b0 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Device.java +++ b/server/src/main/java/com/genymobile/scrcpy/Device.java @@ -103,6 +103,11 @@ public final class Device { ServiceManager.getWindowManager().registerDisplayFoldListener(new IDisplayFoldListener.Stub() { @Override public void onDisplayFoldChanged(int displayId, boolean folded) { + if (Device.this.displayId != displayId) { + // Ignore events related to other display ids + return; + } + synchronized (Device.this) { DisplayInfo displayInfo = ServiceManager.getDisplayManager().getDisplayInfo(displayId); if (displayInfo == null) {