Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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