Skip to content

Commit

Permalink
Revert "Fix "turn screen off" for Honor Android 14 devices"
Browse files Browse the repository at this point in the history
This reverts commit 9d1d79b.

An alternative workaround will be implemented in the next commit.
  • Loading branch information
rom1v committed Jul 30, 2024
1 parent 071d459 commit b20e22d
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 @@ -323,19 +323,7 @@ public boolean setClipboardText(String text) {
* @param mode one of the {@code POWER_MODE_*} constants
*/
public static boolean setScreenPowerMode(int mode) {
boolean applyToMultiPhysicalDisplays = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;

if (applyToMultiPhysicalDisplays
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE
&& 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;
}

if (applyToMultiPhysicalDisplays) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// On Android 14, these internal methods have been moved to DisplayControl
boolean useDisplayControl =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE && !SurfaceControl.hasGetPhysicalDisplayIdsMethod();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,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 b20e22d

Please sign in to comment.