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

Commit 02e71939 authored by Winson Chung's avatar Winson Chung
Browse files

Prevent updating the PiP when it is being dismissed.

Bug: 35588768
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testPreventSetAspectRatioWhileExpanding

Change-Id: I2bcfdaad97c552cccef253370a6231253c956d22
parent 41eae911
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -7808,10 +7808,15 @@ public class ActivityManagerService extends IActivityManager.Stub
                r.pictureInPictureArgs.copyOnlySet(args);
                if (r.getStack().getStackId() == PINNED_STACK_ID) {
                    // If the activity is already in picture-in-picture, update the pinned stack now
                    // if it is not already expanding to fullscreen. Otherwise, the arguments will
                    // be used the next time the activity enters PiP
                    final PinnedActivityStack stack = r.getStack();
                    stack.setPictureInPictureAspectRatio(r.pictureInPictureArgs.getAspectRatio());
                    if (!stack.isBoundsAnimatingToFullscreen()) {
                        stack.setPictureInPictureAspectRatio(
                                r.pictureInPictureArgs.getAspectRatio());
                        stack.setPictureInPictureActions(r.pictureInPictureArgs.getActions());
                    }
                }
                logPictureInPictureArgs(args);
            }
        } finally {
+4 −0
Original line number Diff line number Diff line
@@ -52,4 +52,8 @@ class PinnedActivityStack extends ActivityStack<PinnedStackWindowController> {
    void setPictureInPictureActions(List<RemoteAction> actions) {
        getWindowContainerController().setPictureInPictureActions(actions);
    }

    boolean isBoundsAnimatingToFullscreen() {
        return getWindowContainerController().isBoundsAnimatingToFullscreen();
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -108,6 +108,13 @@ public class PinnedStackWindowController extends StackWindowController {
        }
    }

    /**
     * @return whether the bounds are currently animating to fullscreen.
     */
    public boolean isBoundsAnimatingToFullscreen() {
        return mContainer.isBoundsAnimatingToFullscreen();
    }

    /**
     * Checks the {@param bounds} and retirms non-null fullscreen bounds for the pinned stack
     * animation if necessary.