Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Android 12 (preview),and resolve black screen problem #26

Merged
merged 1 commit into from
Sep 15, 2021
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