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

Commit d62acec3 authored by Winson Chung's avatar Winson Chung
Browse files

Fixing regression in PiP TV.

- Don't clobber the state if we are deferring resizing due to finishing
  activities.
- Fix issue with PiP tasks being visible after the stack is removed, due
  to it being put below a non-fullscreen task in the fullscreen stack.
  Instead just move it to the back of the stack.

Bug: 36592307
Test: android.server.cts.ActivityManagerPinnedStackTests

Change-Id: Ia18fe155b8a045a8ffea84612fd08af3ef3982d8
parent ddd95360
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -35,11 +35,9 @@ import android.os.Debug;
import android.os.Handler;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import android.view.Display;
import android.view.IPinnedStackController;
import android.view.IPinnedStackListener;
import android.view.IWindowManager;
@@ -115,6 +113,7 @@ public class PipManager implements BasePipManager {
    private IWindowManager mWindowManager;
    private MediaSessionManager mMediaSessionManager;
    private int mState = STATE_NO_PIP;
    private int mResumeResizePinnedStackRunnable = STATE_NO_PIP;
    private final Handler mHandler = new Handler();
    private List<Listener> mListeners = new ArrayList<>();
    private List<MediaListener> mMediaListeners = new ArrayList<>();
@@ -135,7 +134,7 @@ public class PipManager implements BasePipManager {
    private final Runnable mResizePinnedStackRunnable = new Runnable() {
        @Override
        public void run() {
            resizePinnedStack(mState);
            resizePinnedStack(mResumeResizePinnedStackRunnable);
        }
    };
    private final Runnable mClosePipRunnable = new Runnable() {
@@ -366,16 +365,17 @@ public class PipManager implements BasePipManager {
    void resizePinnedStack(int state) {
        if (DEBUG) Log.d(TAG, "resizePinnedStack() state=" + state);
        boolean wasStateNoPip = (mState == STATE_NO_PIP);
        mState = state;
        mResumeResizePinnedStackRunnable = state;
        for (int i = mListeners.size() - 1; i >= 0; --i) {
            mListeners.get(i).onPipResizeAboutToStart();
        }
        if (mSuspendPipResizingReason != 0) {
            if (DEBUG) Log.d(TAG,
                    "resizePinnedStack() deferring mSuspendPipResizingReason=" +
                            mSuspendPipResizingReason);
            if (DEBUG) Log.d(TAG, "resizePinnedStack() deferring"
                    + " mSuspendPipResizingReason=" + mSuspendPipResizingReason
                    + " mResumeResizePinnedStackRunnable=" + mResumeResizePinnedStackRunnable);
            return;
        }
        mState = state;
        switch (mState) {
            case STATE_NO_PIP:
                mCurrentPipBounds = null;
+2 −3
Original line number Diff line number Diff line
@@ -2505,9 +2505,8 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
                        fullscreenStack.getStackVisibilityLocked(null) == STACK_VISIBLE;
                for (int i = 0; i < tasks.size(); i++) {
                    // Insert the task either at the top of the fullscreen stack if it is hidden,
                    // or just under the top task if it is currently visible
                    final int insertPosition = isFullscreenStackVisible
                            ? Math.max(0, fullscreenStack.getChildCount() - 1)
                    // or to the bottom if it is currently visible
                    final int insertPosition = isFullscreenStackVisible ? 0
                            : fullscreenStack.getChildCount();
                    final TaskRecord task = tasks.get(i);
                    // Defer resume until we remove all the tasks