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

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

Merge "Skip running window animation for invisible activity" into main

parents 5433f61b 4c22055e
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -246,7 +246,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STARTING_WIND
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES;
import static com.android.server.wm.WindowManagerService.sEnableShellTransitions;
import static com.android.server.wm.WindowState.LEGACY_POLICY_VISIBILITY;
import static com.android.window.flags.Flags.enablePresentationForConnectedDisplays;

@@ -5763,19 +5762,16 @@ final class ActivityRecord extends WindowToken {
            return;
        }

        final int windowsCount = mChildren.size();
        // With Shell-Transition, the activity will running a transition when it is visible.
        // It won't be included when fromTransition is true means the call from finishTransition.
        final boolean runningAnimation = sEnableShellTransitions ? visible
                : isAnimating(PARENTS, ANIMATION_TYPE_APP_TRANSITION);
        for (int i = 0; i < windowsCount; i++) {
            mChildren.get(i).onAppVisibilityChanged(visible, runningAnimation);
        if (!visible) {
            for (int i = mChildren.size() - 1; i >= 0; --i) {
                mChildren.get(i).onAppCommitInvisible();
            }
        }
        setVisible(visible);
        setVisibleRequested(visible);
        ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "commitVisibility: %s: visible=%b"
                        + " visibleRequested=%b, isInTransition=%b, runningAnimation=%b, caller=%s",
                this, isVisible(), mVisibleRequested, isInTransition(), runningAnimation,
                        + " visibleRequested=%b, inTransition=%b, caller=%s",
                this, visible, mVisibleRequested, inTransition(),
                Debug.getCallers(5));
        if (visible) {
            // If we are being set visible, and the starting window is not yet displayed,
+7 −30
Original line number Diff line number Diff line
@@ -2069,38 +2069,15 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        super.onMovedByResize();
    }

    void onAppVisibilityChanged(boolean visible, boolean runningAppAnimation) {
    void onAppCommitInvisible() {
        for (int i = mChildren.size() - 1; i >= 0; --i) {
            mChildren.get(i).onAppVisibilityChanged(visible, runningAppAnimation);
            mChildren.get(i).onAppCommitInvisible();
        }

        final boolean isVisibleNow = isVisibleNow();
        if (mAttrs.type == TYPE_APPLICATION_STARTING) {
            // Starting window that's exiting will be removed when the animation finishes.
            // Mark all relevant flags for that onExitAnimationDone will proceed all the way
            // to actually remove it.
            if (!visible && isVisibleNow && mActivityRecord.isAnimating(PARENTS | TRANSITION)) {
                ProtoLog.d(WM_DEBUG_ANIM,
                        "Set animatingExit: reason=onAppVisibilityChanged win=%s", this);
                mAnimatingExit = true;
                mRemoveOnExit = true;
                mWindowRemovalAllowed = true;
            }
        } else if (visible != isVisibleNow) {
            // Run exit animation if:
            // 1. App visibility and WS visibility are different
            // 2. App is not running an animation
            // 3. WS is currently visible
            if (!runningAppAnimation && isVisibleNow) {
                final AccessibilityController accessibilityController =
                        mWmService.mAccessibilityController;
                final int winTransit = TRANSIT_EXIT;
                mWinAnimator.applyAnimationLocked(winTransit, false /* isEntrance */);
                if (accessibilityController.hasCallbacks()) {
                    accessibilityController.onWindowTransition(this, winTransit);
                }
            }
            setDisplayLayoutNeeded();
        if (mAttrs.type != TYPE_APPLICATION_STARTING
                && mWmService.mAccessibilityController.hasCallbacks()
                // It is a change only if App visibility and WS visibility are different.
                && isVisible()) {
            mWmService.mAccessibilityController.onWindowTransition(this, TRANSIT_EXIT);
        }
    }