Do not use DisplayControl on Honor with Android 14

Some honor devices with Android 14 behave like Android 13 here.

Refs #4943 <https://github.com/Genymobile/scrcpy/issues/4943>
This commit is contained in:
Romain Vimont 2024-07-30 13:47:12 +02:00
parent b20e22d018
commit c19c688e0c

View File

@ -328,6 +328,13 @@ public final class Device {
boolean useDisplayControl = boolean useDisplayControl =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE && !SurfaceControl.hasGetPhysicalDisplayIdsMethod(); 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 // Change the power mode for all physical displays
long[] physicalDisplayIds = useDisplayControl ? DisplayControl.getPhysicalDisplayIds() : SurfaceControl.getPhysicalDisplayIds(); long[] physicalDisplayIds = useDisplayControl ? DisplayControl.getPhysicalDisplayIds() : SurfaceControl.getPhysicalDisplayIds();
if (physicalDisplayIds == null) { if (physicalDisplayIds == null) {