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

Commit d49b5d44 authored by Issei Suzuki's avatar Issei Suzuki
Browse files

Suppress app transition while recents is running

This fixes conflict between app transition and recents animation in the
following scenario.

1) App transition animation finishes after app closing animation, which
is controlled by recents, finishes.

During the app closing animation, recents makes the closing app surface
invisible, but app transition animation overrides it to visible again.
This causes a flicker.

2) App transition starts during recents animation.

This can happen when a user launches an activity, and immediately after
that, swipes up the screen to close the app.

While recents is running, we assume animation on tasks is controlled by
recents, and visibility is commited without animation after recents
animation finishes. However starting app transition during recents
breaks this assumption, which ends up with playing one more unexpected
closing animation (so users see closing animation twice).

Bug: 223499269
Bug: 231669960
Test: atest AppTransitionTest + manual tests
  Test 1
   1. Launch Gmail app
   2. Click icon on the bottom tab (e.g. Chat)
   3. Swipe up from the bottom (immediately after step 2)
   4. Verify closing animation only plays once
  Test 2
   1. Launch "Google TV"
   2. Play a trailer
   3. Full screen and PIP mode switch twice
   4. Verify PIP window is shown
  Test 3
   1. Change phone to portlait mode
   2. Launch Photo app
   3. Swipe up from the bottom
   4. Verify no rotation animation on the launcher
Change-Id: Ic18d00812308903db08d3564136f33f1eccf408c
parent 9c9916e4
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2485,6 +2485,12 @@
      "group": "WM_ERROR",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "323235828": {
      "message": "Delaying app transition for recents animation to finish",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "at": "com\/android\/server\/wm\/AppTransitionController.java"
    },
    "327461496": {
      "message": "Complete pause: %s",
      "level": "VERBOSE",
+1 −0
Original line number Diff line number Diff line
@@ -9338,6 +9338,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        sb.append(mUserId);
        sb.append(' ');
        sb.append(intent.getComponent().flattenToShortString());
        sb.append("}");
        stringName = sb.toString();
        return stringName;
    }
+6 −1
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ import static com.android.server.wm.AppTransition.isNormalTransit;
import static com.android.server.wm.NonAppWindowAnimationAdapter.shouldAttachNavBarToApp;
import static com.android.server.wm.NonAppWindowAnimationAdapter.shouldStartNonAppWindowAnimationsForKeyguardExit;
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.WallpaperAnimationAdapter.shouldStartWallpaperAnimation;
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_LIGHT_TRANSACTIONS;
@@ -1142,13 +1143,17 @@ public class AppTransitionController {
            if (activity == null) {
                continue;
            }
            if (activity.isAnimating(PARENTS, ANIMATION_TYPE_RECENTS)) {
                ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
                        "Delaying app transition for recents animation to finish");
                return false;
            }
            ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
                    "Check opening app=%s: allDrawn=%b startingDisplayed=%b "
                            + "startingMoved=%b isRelaunching()=%b startingWindow=%s",
                    activity, activity.allDrawn, activity.startingDisplayed,
                    activity.startingMoved, activity.isRelaunching(),
                    activity.mStartingWindow);

            final boolean allDrawn = activity.allDrawn && !activity.isRelaunching();
            if (!allDrawn && !activity.startingDisplayed && !activity.startingMoved) {
                return false;
+1 −1
Original line number Diff line number Diff line
@@ -5265,7 +5265,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    void prepareAppTransition(@WindowManager.TransitionType int transit,
            @WindowManager.TransitionFlags int flags) {
        final boolean prepared = mAppTransition.prepareAppTransition(transit, flags);
        if (prepared && okToAnimate()) {
        if (prepared && okToAnimate() && transit != TRANSIT_NONE) {
            mSkipAppTransitionAnimation = false;
        }
    }
+8 −0
Original line number Diff line number Diff line
@@ -1584,6 +1584,14 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        return true;
    }

    void forAllWindowContainers(Consumer<WindowContainer> callback) {
        callback.accept(this);
        final int count = mChildren.size();
        for (int i = 0; i < count; i++) {
            mChildren.get(i).forAllWindowContainers(callback);
        }
    }

    /**
     * For all windows at or below this container call the callback.
     * @param   callback Calls the {@link ToBooleanFunction#apply} method for each window found and
Loading