Skip to content

Commit 3d1f036

Browse files
committed
Rollback to old --turn-screen-off for Android 15
When the screen is turned off with the new display power method introduced in Android 15, video mirroring freezes. Use the Android 14 method for Android 15. Refs 58ba00f Refs #5418 <#5418> Fixes #5530 <#5530>
1 parent 3d5294c commit 3d1f036

File tree

1 file changed

+5
-1
lines changed
  • server/src/main/java/com/genymobile/scrcpy/device

1 file changed

+5
-1
lines changed

server/src/main/java/com/genymobile/scrcpy/device/Device.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public final class Device {
4040
public static final int INJECT_MODE_WAIT_FOR_RESULT = InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT;
4141
public static final int INJECT_MODE_WAIT_FOR_FINISH = InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH;
4242

43+
// The new display power method introduced in Android 15 does not work as expected:
44+
// <https://github.com/Genymobile/scrcpy/issues/5530>
45+
private static final boolean USE_ANDROID_15_DISPLAY_POWER = false;
46+
4347
private Device() {
4448
// not instantiable
4549
}
@@ -127,7 +131,7 @@ public static boolean setClipboardText(String text) {
127131
public static boolean setDisplayPower(int displayId, boolean on) {
128132
assert displayId != Device.DISPLAY_ID_NONE;
129133

130-
if (Build.VERSION.SDK_INT >= AndroidVersions.API_35_ANDROID_15) {
134+
if (USE_ANDROID_15_DISPLAY_POWER && Build.VERSION.SDK_INT >= AndroidVersions.API_35_ANDROID_15) {
131135
return ServiceManager.getDisplayManager().requestDisplayPower(displayId, on);
132136
}
133137

0 commit comments

Comments
 (0)