Display and control your Android device
Rollback to old --turn-screen-off for Android 15
Romain Vimont3d1f036c0441
diff --git a/server/src/main/java/com/genymobile/scrcpy/device/Device.java b/server/src/main/java/com/genymobile/scrcpy/device/Device.javaindex cd713499..3553dc27 100644--- a/server/src/main/java/com/genymobile/scrcpy/device/Device.java+++ b/server/src/main/java/com/genymobile/scrcpy/device/Device.java@@ -40,6 +40,10 @@ public final class Device {public static final int INJECT_MODE_WAIT_FOR_RESULT = InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT;public static final int INJECT_MODE_WAIT_FOR_FINISH = InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH;+ // The new display power method introduced in Android 15 does not work as expected:+ // <https://github.com/Genymobile/scrcpy/issues/5530>+ private static final boolean USE_ANDROID_15_DISPLAY_POWER = false;+private Device() {// not instantiable}@@ -127,7 +131,7 @@ public final class Device {public static boolean setDisplayPower(int displayId, boolean on) {assert displayId != Device.DISPLAY_ID_NONE;- if (Build.VERSION.SDK_INT >= AndroidVersions.API_35_ANDROID_15) {+ if (USE_ANDROID_15_DISPLAY_POWER && Build.VERSION.SDK_INT >= AndroidVersions.API_35_ANDROID_15) {return ServiceManager.getDisplayManager().requestDisplayPower(displayId, on);}