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

Commit 1aae6246 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Check animating accurately when assigning mAnimatingExit from relayout" into sc-dev

parents db45defb 1c04f614
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -66,9 +66,14 @@ public class FadeRotationAnimationController extends FadeAnimationController {
        } else {
            mNavBarToken = null;
        }
        // Do not fade notification shade when running fixed rotation (not frozen) because it may
        // need to animate with the launching app.
        final WindowState notificationShade = mFrozenTimeoutRunnable == null
                ? displayPolicy.getNotificationShade() : null;
        displayContent.forAllWindows(w -> {
            if (w.mActivityRecord == null && w.mHasSurface && !w.mForceSeamlesslyRotate
                    && !w.mIsWallpaper && !w.mIsImWindow && w != navigationBar) {
                    && !w.mIsWallpaper && !w.mIsImWindow && w != navigationBar
                    && w != notificationShade) {
                mTargetWindowTokens.add(w.mToken);
            }
        }, true /* traverseTopToBottom */);
+2 −1
Original line number Diff line number Diff line
@@ -2519,7 +2519,8 @@ public class WindowManagerService extends IWindowManager.Stub
        } else if (win.isWinVisibleLw() && winAnimator.applyAnimationLocked(transit, false)) {
            focusMayChange = true;
            win.mAnimatingExit = true;
        } else if (win.mDisplayContent.okToAnimate() && win.isAnimating(TRANSITION | PARENTS)) {
        } else if (win.mDisplayContent.okToAnimate() && win.isAnimating(TRANSITION | PARENTS,
                WindowState.EXIT_ANIMATING_TYPES)) {
            // Currently in a hide animation... turn this into
            // an exit.
            win.mAnimatingExit = true;
+10 −2
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ import static com.android.server.wm.MoveAnimationSpecProto.FROM;
import static com.android.server.wm.MoveAnimationSpecProto.TO;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_ALL;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_RECENTS;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION;
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
import static com.android.server.wm.WindowContainer.AnimationFlags.TRANSITION;
@@ -517,6 +518,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
     */
    boolean mSurfacePlacementNeeded;

    /**
     * The animation types that will call {@link #onExitAnimationDone} so {@link #mAnimatingExit}
     * is guaranteed to be cleared.
     */
    static final int EXIT_ANIMATING_TYPES = ANIMATION_TYPE_APP_TRANSITION
            | ANIMATION_TYPE_WINDOW_ANIMATION | ANIMATION_TYPE_RECENTS;

    /** Currently running an exit animation? */
    boolean mAnimatingExit;

@@ -2456,8 +2464,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
                        mWmService.mAccessibilityController.onWindowTransition(this, transit);
                    }
                }
                final boolean isAnimating = mAnimatingExit || isAnimating(TRANSITION | PARENTS,
                        ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_WINDOW_ANIMATION)
                final boolean isAnimating = mAnimatingExit
                        || isAnimating(TRANSITION | PARENTS, EXIT_ANIMATING_TYPES)
                        && (mActivityRecord == null || !mActivityRecord.isWaitingForTransitionStart());
                final boolean lastWindowIsStartingWindow = startingWindow && mActivityRecord != null
                        && mActivityRecord.isLastWindow(this);
+7 −5
Original line number Diff line number Diff line
@@ -1292,7 +1292,8 @@ public class DisplayContentTests extends WindowTestsBase {
        assertNull(displayContent.getFadeRotationAnimationController());
    }

    @UseTestDisplay(addWindows = { W_ACTIVITY, W_WALLPAPER, W_STATUS_BAR, W_NAVIGATION_BAR })
    @UseTestDisplay(addWindows = { W_ACTIVITY, W_WALLPAPER, W_STATUS_BAR, W_NAVIGATION_BAR,
            W_NOTIFICATION_SHADE })
    @Test
    public void testApplyTopFixedRotationTransform() {
        final DisplayPolicy displayPolicy = mDisplayContent.getDisplayPolicy();
@@ -1300,6 +1301,7 @@ public class DisplayContentTests extends WindowTestsBase {
        doReturn(false).when(displayPolicy).navigationBarCanMove();
        displayPolicy.addWindowLw(mStatusBarWindow, mStatusBarWindow.mAttrs);
        displayPolicy.addWindowLw(mNavBarWindow, mNavBarWindow.mAttrs);
        displayPolicy.addWindowLw(mNotificationShadeWindow, mNotificationShadeWindow.mAttrs);
        makeWindowVisible(mStatusBarWindow, mNavBarWindow);
        final Configuration config90 = new Configuration();
        mDisplayContent.computeScreenConfiguration(config90, ROTATION_90);
@@ -1324,10 +1326,10 @@ public class DisplayContentTests extends WindowTestsBase {
                false /* forceUpdate */));

        assertNotNull(mDisplayContent.getFadeRotationAnimationController());
        assertTrue(mStatusBarWindow.getParent().isAnimating(WindowContainer.AnimationFlags.PARENTS,
                ANIMATION_TYPE_FIXED_TRANSFORM));
        assertTrue(mNavBarWindow.getParent().isAnimating(WindowContainer.AnimationFlags.PARENTS,
                ANIMATION_TYPE_FIXED_TRANSFORM));
        assertTrue(mStatusBarWindow.isAnimating(PARENTS, ANIMATION_TYPE_FIXED_TRANSFORM));
        assertTrue(mNavBarWindow.isAnimating(PARENTS, ANIMATION_TYPE_FIXED_TRANSFORM));
        // Notification shade may have its own view animation in real case so do not fade out it.
        assertFalse(mNotificationShadeWindow.isAnimating(PARENTS, ANIMATION_TYPE_FIXED_TRANSFORM));

        // If the visibility of insets state is changed, the rotated state should be updated too.
        final InsetsState rotatedState = app.getFixedRotationTransformInsetsState();