Display and control your Android device
Register rotation watcher for non-main displays
Romain Vimont3ac4b6446171
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.javaindex d190bdde..04e42800 100644--- a/server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.java+++ b/server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.java@@ -240,18 +240,16 @@ public class ScreenCapture extends SurfaceCapture {}private void registerDisplayListenerFallbacks() {- if (displayId == 0) {- rotationWatcher = new IRotationWatcher.Stub() {- @Override- public void onRotationChanged(int rotation) {- if (Ln.isEnabled(Ln.Level.VERBOSE)) {- Ln.v("ScreenCapture: onRotationChanged(" + rotation + ")");- }- requestReset();+ rotationWatcher = new IRotationWatcher.Stub() {+ @Override+ public void onRotationChanged(int rotation) {+ if (Ln.isEnabled(Ln.Level.VERBOSE)) {+ Ln.v("ScreenCapture: onRotationChanged(" + rotation + ")");}- };- ServiceManager.getWindowManager().registerRotationWatcher(rotationWatcher, displayId);- }+ requestReset();+ }+ };+ ServiceManager.getWindowManager().registerRotationWatcher(rotationWatcher, displayId);// Build.VERSION.SDK_INT >= AndroidVersions.API_29_ANDROID_10 (but implied by == API_34_ANDROID 14)displayFoldListener = new IDisplayFoldListener.Stub() {