Revert "Fix "turn screen off" for Honor Android 14 devices"

This reverts commit 9d1d79b004.

An alternative workaround will be implemented in the next commit.
This commit is contained in:
Romain Vimont 2024-07-30 13:47:22 +02:00
parent 071d459ad7
commit b20e22d018
2 changed files with 1 additions and 22 deletions

View file

@ -323,19 +323,7 @@ public final class Device {
* @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();

View file

@ -94,15 +94,6 @@ public final class SurfaceControl {
return getBuiltInDisplayMethod;
}
public static boolean hasGetBuildInDisplayMethod() {
try {
getGetBuiltInDisplayMethod();
return true;
} catch (NoSuchMethodException e) {
return false;
}
}
public static IBinder getBuiltInDisplay() {
try {
Method method = getGetBuiltInDisplayMethod();