mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-02 22:29:25 +00:00
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 58ba00fa06
Refs #5418 <https://github.com/Genymobile/scrcpy/pull/5418>
Fixes #5530 <https://github.com/Genymobile/scrcpy/issues/5530>
This commit is contained in:
parent
3d5294c1e5
commit
3d1f036c04
1 changed files with 5 additions and 1 deletions
|
@ -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_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;
|
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() {
|
private Device() {
|
||||||
// not instantiable
|
// not instantiable
|
||||||
}
|
}
|
||||||
|
@ -127,7 +131,7 @@ public final class Device {
|
||||||
public static boolean setDisplayPower(int displayId, boolean on) {
|
public static boolean setDisplayPower(int displayId, boolean on) {
|
||||||
assert displayId != Device.DISPLAY_ID_NONE;
|
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);
|
return ServiceManager.getDisplayManager().requestDisplayPower(displayId, on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue