Skip to content

Commit

Permalink
Use non-secure display for Android >= 12
Browse files Browse the repository at this point in the history
Since Android 12, secure displays could not be created with shell
permissions anymore.

Refs commit 1fdde49
Fixes #2129 <#2129>
  • Loading branch information
rom1v committed Feb 19, 2021
1 parent dce0867 commit 3183d33
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.media.MediaCodecInfo;
import android.media.MediaCodecList;
import android.media.MediaFormat;
import android.os.Build;
import android.os.IBinder;
import android.view.Surface;

Expand Down Expand Up @@ -225,7 +226,8 @@ private static MediaFormat createFormat(int bitRate, int maxFps, List<CodecOptio
}

private static IBinder createDisplay() {
return SurfaceControl.createDisplay("scrcpy", true);
boolean secure = Build.VERSION.SDK_INT <= Build.VERSION_CODES.R;
return SurfaceControl.createDisplay("scrcpy", secure);
}

private static void configure(MediaCodec codec, MediaFormat format) {
Expand Down

0 comments on commit 3183d33

Please sign in to comment.