Merge pull request #3810 from Isira-Seneviratne/PIP_exception

Avoid possible PIP-related exception on API levels below 33.
This commit is contained in:
Isira Seneviratne 2023-05-22 18:14:50 +05:30 committed by GitHub
commit ee21ac1a67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,6 @@ import android.app.Activity
import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
import android.util.Log
object PictureInPictureCompat {
fun isPictureInPictureAvailable(context: Context): Boolean {
@ -18,7 +17,6 @@ object PictureInPictureCompat {
fun setPictureInPictureParams(activity: Activity, params: PictureInPictureParamsCompat) {
if (isPictureInPictureAvailable(activity)) {
if (params.toPictureInPictureParams().actions.isEmpty()) throw IllegalArgumentException()
activity.setPictureInPictureParams(params.toPictureInPictureParams())
}
}