From 99eac718994cbcb223a471b60a603cbd8088a6e8 Mon Sep 17 00:00:00 2001 From: Simon Chan <1330321+yume-chan@users.noreply.github.com> Date: Sun, 22 Dec 2024 20:53:15 +0800 Subject: [PATCH] Revert #5109 --- .../java/com/genymobile/scrcpy/device/Device.java | 14 +------------- .../genymobile/scrcpy/wrappers/SurfaceControl.java | 9 --------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/device/Device.java b/server/src/main/java/com/genymobile/scrcpy/device/Device.java index 3553dc2784..5f84e3b029 100644 --- a/server/src/main/java/com/genymobile/scrcpy/device/Device.java +++ b/server/src/main/java/com/genymobile/scrcpy/device/Device.java @@ -135,20 +135,8 @@ public static boolean setDisplayPower(int displayId, boolean on) { return ServiceManager.getDisplayManager().requestDisplayPower(displayId, on); } - boolean applyToMultiPhysicalDisplays = Build.VERSION.SDK_INT >= AndroidVersions.API_29_ANDROID_10; - - if (applyToMultiPhysicalDisplays - && Build.VERSION.SDK_INT >= AndroidVersions.API_34_ANDROID_14 - && Build.BRAND.equalsIgnoreCase("honor") - && SurfaceControl.hasGetBuildInDisplayMethod()) { - // Workaround for Honor devices with Android 14: - // - - // - - applyToMultiPhysicalDisplays = false; - } - int mode = on ? POWER_MODE_NORMAL : POWER_MODE_OFF; - if (applyToMultiPhysicalDisplays) { + if (Build.VERSION.SDK_INT >= AndroidVersions.API_29_ANDROID_10) { // On Android 14, these internal methods have been moved to DisplayControl boolean useDisplayControl = Build.VERSION.SDK_INT >= AndroidVersions.API_34_ANDROID_14 && !SurfaceControl.hasGetPhysicalDisplayIdsMethod(); diff --git a/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java b/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java index 3bae4a375d..b8b41b913c 100644 --- a/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java +++ b/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java @@ -95,15 +95,6 @@ private static Method getGetBuiltInDisplayMethod() throws NoSuchMethodException return getBuiltInDisplayMethod; } - public static boolean hasGetBuildInDisplayMethod() { - try { - getGetBuiltInDisplayMethod(); - return true; - } catch (NoSuchMethodException e) { - return false; - } - } - public static IBinder getBuiltInDisplay() { try { Method method = getGetBuiltInDisplayMethod();