1

My app shows video streaming using exoplayer. All works ok until i use/activate Pip. After i put any video in Pip and go back to prev activity from backstack ( automatically ) when i press any button i get :

WindowManager: android.view.WindowLeaked: Activity com.rcsrds.player.ui.main.MainActivity has leaked window DecorView@ff7d496[] that was originally added here

i get this error message on some of my test phone, not all. If i press more than 1 time any button after 5 sec i get ANR (sometimes) ; My app does not use any dialog

I do have a ProgressBar. Comment it and error still appears.

LE : my player is a customview. This should be a problem for PiP ?

to enter in Pip i use

   public void enterPictureInPicture(PictureInPictureParams nPipParams) {
       ActivityUtils.hideSystemUI(this.getWindow());
       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
           enterPictureInPictureMode(nPipParams);
       } else {
           //Toast.makeText(this,"Picture in Picture not availabe",Toast.LENGTH_LONG).show();
       }
   }

<activity
           android:name=".ui.main.MainActivity"
           android:configChanges="screenSize|smallestScreenSize|screenLayout"
           android:supportsPictureInPicture="true"
           android:excludeFromRecents="true"
           android:autoRemoveFromRecents="true"
          />




BejanCorneliu
  • 65
  • 3
  • 13

1 Answers1

1

You're missing android:configChanges orientation as recommended by:

https://developer.android.com/guide/topics/ui/picture-in-picture#declaring

The full list should be. android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"

PIP doesn't support having the Activity destroy.

Your Activity is getting destroyed because it's running in portrait and entering PIP switches it to landscape.

Perhaps the other times you tested the device was already in landscape.

repkap11
  • 757
  • 7
  • 9