Skip to content

Commit

Permalink
Do not use DisplayControl on Honor with Android 14
Browse files Browse the repository at this point in the history
Some honor devices with Android 14 behave like Android 13 here.

Refs #4943 <#4943>
  • Loading branch information
rom1v committed Jul 30, 2024
1 parent b20e22d commit c19c688
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server/src/main/java/com/genymobile/scrcpy/device/Device.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,13 @@ public static boolean setScreenPowerMode(int mode) {
boolean useDisplayControl =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE && !SurfaceControl.hasGetPhysicalDisplayIdsMethod();

if (useDisplayControl && Build.BRAND.equalsIgnoreCase("honor")) {
// Workaround for Honor devices with Android 14:
// - <https://github.com/Genymobile/scrcpy/issues/4823>
// - <https://github.com/Genymobile/scrcpy/issues/4943>
useDisplayControl = false;
}

// Change the power mode for all physical displays
long[] physicalDisplayIds = useDisplayControl ? DisplayControl.getPhysicalDisplayIds() : SurfaceControl.getPhysicalDisplayIds();
if (physicalDisplayIds == null) {
Expand Down

0 comments on commit c19c688

Please sign in to comment.