Use non-secure display for Android 12 preview
Android 12 preview identifies as Android 11, but its codename is "S". Refs #2129 <https://github.com/Genymobile/scrcpy/issues/2129>
This commit is contained in:
parent
f7533e8896
commit
16a63e0917
1 changed files with 4 additions and 2 deletions
|
@ -226,8 +226,10 @@ public class ScreenEncoder implements Device.RotationListener {
|
|||
}
|
||||
|
||||
private static IBinder createDisplay() {
|
||||
// Since Android 12, secure displays could not be created with shell permissions anymore
|
||||
boolean secure = Build.VERSION.SDK_INT <= Build.VERSION_CODES.R;
|
||||
// Since Android 12 (preview), secure displays could not be created with shell permissions anymore.
|
||||
// On Android 12 preview, SDK_INT is still R (not S), but CODENAME is "S".
|
||||
boolean secure = Build.VERSION.SDK_INT < Build.VERSION_CODES.R || (Build.VERSION.SDK_INT == Build.VERSION_CODES.R && !"S"
|
||||
.equals(Build.VERSION.CODENAME));
|
||||
return SurfaceControl.createDisplay("scrcpy", secure);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue