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

Commit aa9376bc authored by Ming-Shin Lu's avatar Ming-Shin Lu
Browse files

Fix black screen during Quick switch

When quick switch a delayed task, before onTaskAppeared called,
if the user holds gesture on nav bar, TRANSIT_WALLPAPER_OPEN from closing
app happens will cancel recents animation when
WC#applyAnimationUnchecked, and that will cause the black screen if the
delayed task not yet drawn and there is no recents task snapshot on top.

Since cancelling recents animation during quick switching doesn't make
sense, to fix that, we should check the animation task target if is
still controlled by recents animation, if so, we should not cancel it.

Also, make sure if the appeared task has already been in task target list,
(i.e. task A appreared, quick switch to task B, before task B appeared,
quick switch back to task A) if so, we don't need to callback task
appeared again.

Fix: 156670249
Test: manual as issue test steps.
Change-Id: I303403d63c91c08fabcb8c5b1b1aac42c4ec65db
parent c45de5ab
Loading
Loading
Loading
Loading
+6 −24
Original line number Diff line number Diff line
@@ -85,12 +85,6 @@
      "group": "WM_DEBUG_ADD_REMOVE",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "-1953668890": {
      "message": "Can't start recents animation, nextAppTransition=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_RECENTS_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RecentsAnimation.java"
    },
    "-1949279037": {
      "message": "Attempted to add input method window with bad token %s.  Aborting.",
      "level": "WARN",
@@ -889,12 +883,6 @@
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "-242787066": {
      "message": "addTaskToRecentsAnimationIfNeeded, control: %s, task: %s, transit: %s",
      "level": "DEBUG",
      "group": "WM_DEBUG_RECENTS_ANIMATIONS",
      "at": "com\/android\/server\/wm\/WindowContainer.java"
    },
    "-198463978": {
      "message": "updateRotationUnchecked: alwaysSendConfiguration=%b forceRelayout=%b",
      "level": "VERBOSE",
@@ -1135,6 +1123,12 @@
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/DisplayRotation.java"
    },
    "210750281": {
      "message": "applyAnimationUnchecked, control: %s, task: %s, transit: %s",
      "level": "DEBUG",
      "group": "WM_DEBUG_RECENTS_ANIMATIONS",
      "at": "com\/android\/server\/wm\/Task.java"
    },
    "221540118": {
      "message": "mUserActivityTimeout set to %d",
      "level": "DEBUG",
@@ -1543,24 +1537,12 @@
      "group": "WM_ERROR",
      "at": "com\/android\/server\/wm\/WindowToken.java"
    },
    "845234215": {
      "message": "App is requesting an orientation, return %d for display id=%d",
      "level": "VERBOSE",
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/DisplayContent.java"
    },
    "853091290": {
      "message": "Moved stack=%s behind stack=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_RECENTS_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RecentsAnimation.java"
    },
    "854237232": {
      "message": "addTaskToRecentsAnimationIfNeeded, control: %s, task: %s, transit: %s",
      "level": "DEBUG",
      "group": "WM_DEBUG_RECENTS_ANIMATIONS",
      "at": "com\/android\/server\/wm\/Task.java"
    },
    "873914452": {
      "message": "goodToGo()",
      "level": "DEBUG",
+0 −8
Original line number Diff line number Diff line
@@ -407,14 +407,6 @@ public class AppTransition implements Dump {
        return mNextAppTransitionType == NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS;
    }

    boolean isNextAppTransitionCustomFromRecents() {
        final RecentTasks recentTasks = mService.mAtmService.getRecentTasks();
        final String recentsPackageName =
                (recentTasks != null) ? recentTasks.getRecentsComponent().getPackageName() : null;
        return mNextAppTransitionType == NEXT_TRANSIT_TYPE_CUSTOM
                && mNextAppTransitionPackage.equals(recentsPackageName);
    }

    /**
     * @return true if and only if we are currently fetching app transition specs from the future
     *         passed into {@link #overridePendingAppTransitionMultiThumbFuture}
+7 −2
Original line number Diff line number Diff line
@@ -515,9 +515,14 @@ public class RecentsAnimationController implements DeathRecipient {

    void addTaskToTargets(Task task, OnAnimationFinishedCallback finishedCallback) {
        if (mRunner != null) {
            // No need to send task appeared when the task target already exists.
            if (isAnimatingTask(task)) {
                return;
            }
            final RemoteAnimationTarget target = createTaskRemoteAnimation(task, finishedCallback);
            if (target == null) return;

            if (target == null) {
                return;
            }
            ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS, "addTaskToTargets, target: %s", target);
            try {
                mRunner.onTaskAppeared(target);
+7 −6
Original line number Diff line number Diff line
@@ -3511,14 +3511,15 @@ class Task extends WindowContainer<WindowContainer> {
            int transit, boolean isVoiceInteraction,
            @Nullable OnAnimationFinishedCallback finishedCallback) {
        final RecentsAnimationController control = mWmService.getRecentsAnimationController();
        if (control != null && enter
                && getDisplayContent().mAppTransition.isNextAppTransitionCustomFromRecents()) {
            ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS,
                    "addTaskToRecentsAnimationIfNeeded, control: %s, task: %s, transit: %s",
                    control, asTask(), AppTransition.appTransitionToString(transit));
        if (control != null) {
            // We let the transition to be controlled by RecentsAnimation, and callback task's
            // RemoteAnimationTarget for remote runner to animate.
            if (enter) {
                ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS,
                        "applyAnimationUnchecked, control: %s, task: %s, transit: %s",
                        control, asTask(), AppTransition.appTransitionToString(transit));
                control.addTaskToTargets(getRootTask(), finishedCallback);
            }
        } else {
            super.applyAnimationUnchecked(lp, enter, transit, isVoiceInteraction, finishedCallback);
        }