Skip to content

Commit

Permalink
Merge pull request #26 from yusunan/master
Browse files Browse the repository at this point in the history
Support  Android 12 (preview),and resolve black screen problem
  • Loading branch information
koral-- authored Sep 15, 2021
2 parents 8cbf4ed + b6475c6 commit 336f5aa
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package io.devicefarmer.minicap.provider
import android.graphics.Rect
import android.media.ImageReader
import android.net.LocalSocket
import android.os.Build
import android.os.Handler
import android.os.IBinder
import android.os.Looper
Expand Down Expand Up @@ -80,7 +81,10 @@ class SurfaceProvider(targetSize: Size, orientation: Int) : BaseProvider(targetS
*/
private fun initSurface(l: ImageReader.OnImageAvailableListener) {
//must be done on the main thread
display = SurfaceControl.createDisplay("minicap", false)
// Support Android 12 (preview),and resolve black screen problem
val secure =
Build.VERSION.SDK_INT < Build.VERSION_CODES.R || Build.VERSION.SDK_INT == Build.VERSION_CODES.R && "S" != Build.VERSION.CODENAME
display = SurfaceControl.createDisplay("minicap", secure)
//initialise the surface to get the display in the ImageReader
SurfaceControl.openTransaction()
try {
Expand Down

0 comments on commit 336f5aa

Please sign in to comment.