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

Commit a5799f8a authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Ensure applying saved fraction when re-entering PiP

1. Resets PiP fraction once the app is stopped

When in gesture navigation mode, setHidden can be called ahead of
enterPictureInPictureMode, which results the fraction being reset before
accessing the last saved value.

2. Do not set mBoundsAnimating* variables for FADE_IN animation

Bug: 135224920
Test: Manually enter and exit PiP mode
Change-Id: I93d77071d72a2695e510372dff3a48bf97209b8d
parent ba7fb6a5
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -1015,6 +1015,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
    void notifyAppStopped() {
        if (DEBUG_ADD_REMOVE) Slog.v(TAG, "notifyAppStopped: " + this);
        mAppStopped = true;
        // Reset the last saved PiP snap fraction on app stop.
        mDisplayContent.mPinnedStackControllerLocked.resetReentrySnapFraction(this);
        destroySurfaces();
        // Remove any starting window that was added for this app if they are still around.
        removeStartingWindow();
@@ -3072,11 +3074,6 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
    @Override
    void setHidden(boolean hidden) {
        super.setHidden(hidden);

        if (hidden) {
            // Once the app window is hidden, reset the last saved PiP snap fraction
            mDisplayContent.mPinnedStackControllerLocked.resetReentrySnapFraction(this);
        }
        scheduleAnimation();
    }

+7 −3
Original line number Diff line number Diff line
@@ -321,7 +321,9 @@ public class TaskStack extends WindowContainer<Task> implements
     */
    private void setAnimationFinalBounds(Rect sourceHintBounds, Rect destBounds,
            boolean toFullscreen) {
        if (mAnimationType == BoundsAnimationController.BOUNDS) {
            mBoundsAnimatingRequested = true;
        }
        mBoundsAnimatingToFullscreen = toFullscreen;
        if (destBounds != null) {
            mBoundsAnimationTarget.set(destBounds);
@@ -1586,8 +1588,10 @@ public class TaskStack extends WindowContainer<Task> implements
                return false;
            }

            if (animationType == BoundsAnimationController.BOUNDS) {
                mBoundsAnimatingRequested = false;
                mBoundsAnimating = true;
            }
            mAnimationType = animationType;

            // If we are changing UI mode, as in the PiP to fullscreen