Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f624deb authored by Jaewan Kim's avatar Jaewan Kim Committed by android-build-merger
Browse files

Merge "PIP: Close PIP if media session is gone" into nyc-dev

am: 1ea8722f

* commit '1ea8722f':
  PIP: Close PIP if media session is gone
parents af2d5fb6 1ea8722f
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -68,6 +68,9 @@ public class PipManager {

    public static final int SUSPEND_PIP_RESIZE_REASON_WAITING_FOR_MENU_ACTIVITY_FINISH = 0x1;
    public static final int SUSPEND_PIP_RESIZE_REASON_WAITING_FOR_OVERLAY_ACTIVITY_FINISH = 0x2;

    private static final int CLOSE_PIP_WHEN_MEDIA_SESSION_GONE_TIMEOUT_MS = 3000;

    private int mSuspendPipResizingReason;

    private static final float SCALE_FACTOR = 1.1f;
@@ -172,6 +175,12 @@ public class PipManager {
            resizePinnedStack(mState);
        }
    };
    private final Runnable mClosePipRunnable = new Runnable() {
        @Override
        public void run() {
            closePip();
        }
    };

    private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
        @Override
@@ -283,6 +292,7 @@ public class PipManager {
        for (int i = mListeners.size() - 1; i >= 0; --i) {
            mListeners.get(i).onPipActivityClosed();
        }
        mHandler.removeCallbacks(mClosePipRunnable);
    }

    /**
@@ -545,6 +555,12 @@ public class PipManager {
            for (int i = mListeners.size() - 1; i >= 0; i--) {
                mListeners.get(i).onMediaControllerChanged();
            }
            if (mPipMediaController == null) {
                mHandler.postDelayed(mClosePipRunnable,
                        CLOSE_PIP_WHEN_MEDIA_SESSION_GONE_TIMEOUT_MS);
            } else {
                mHandler.removeCallbacks(mClosePipRunnable);
            }
        }
    }