Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yume-chan committed Dec 22, 2024
1 parent fb47b87 commit 99eac71
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
14 changes: 1 addition & 13 deletions server/src/main/java/com/genymobile/scrcpy/device/Device.java
Original file line number Diff line number Diff line change
Expand Up @@ -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:
// - <https://github.com/Genymobile/scrcpy/issues/4823>
// - <https://github.com/Genymobile/scrcpy/issues/4943>
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 99eac71

Please sign in to comment.