The Android picture-in-picture window is getting closed when I launch any other app. It's happening only for launching the app the first time but doesn't happen if another app is already opened. Works fine in Android 10.
AndroidManifest.xml
<activity
android:name="xxxx"
android:label="@string/xxxx"
android:exported="false"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode|smallestScreenSize|screenLayout"
android:screenOrientation="portrait"
android:supportsPictureInPicture="true"
android:theme="@style/Theme_NewApp"
android:resizeableActivity="false"
android:launchMode="singleTask"
>
Picture-In-Picture Params
return PictureInPictureParams.Builder()
.setAspectRatio(Rational(144, 224))
.build();
Error Log
First, onStop is called and then the PIP gets closed. After that, I get the below error logs.