diff options
| author | 2023-02-02 20:00:14 +0800 | |
|---|---|---|
| committer | 2023-02-06 01:13:06 +0000 | |
| commit | 2a8e6b792d4f51a159a5565794646797d98ef470 (patch) | |
| tree | 7527f4f198fea22ddb9f4ce93733dca44b2f02ec | |
| parent | 91f53181f591f608a0d09d3ac487595ff43c0c82 (diff) | |
Don't defer app transition if one of activity isn't one of recents.
By this way the app transition won't get stuck when start another
app by quickstep.
Bug: 265389263
Test: start recents animation and finish a top activity of a
participanted task immediately, verify the opening transition of next
activity won't happen right away.
Then open another app by quickstep, and verify the transition can take
place immediately.
Change-Id: I34205b70827af3d9e85617732b5ddc1bda88f839
| -rw-r--r-- | services/core/java/com/android/server/wm/AppTransitionController.java | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/services/core/java/com/android/server/wm/AppTransitionController.java b/services/core/java/com/android/server/wm/AppTransitionController.java index 0ea6157dd2a4..87f985ac42eb 100644 --- a/services/core/java/com/android/server/wm/AppTransitionController.java +++ b/services/core/java/com/android/server/wm/AppTransitionController.java @@ -181,6 +181,42 @@ public class AppTransitionController { || !transitionGoodToGoForTaskFragments()) { return; } + final boolean isRecentsInOpening = mDisplayContent.mOpeningApps.stream().anyMatch( + ConfigurationContainer::isActivityTypeRecents); + // In order to avoid visual clutter caused by a conflict between app transition + // animation and recents animation, app transition is delayed until recents finishes. + // One exceptional case. When 3P launcher is used and a user taps a task screenshot in + // task switcher (isRecentsInOpening=true), app transition must start even though + // recents is running. Otherwise app transition is blocked until timeout (b/232984498). + // When 1P launcher is used, this animation is controlled by the launcher outside of + // the app transition, so delaying app transition doesn't cause visible delay. After + // recents finishes, app transition is handled just to commit visibility on apps. + if (!isRecentsInOpening) { + final ArraySet<WindowContainer> participants = new ArraySet<>(); + participants.addAll(mDisplayContent.mOpeningApps); + participants.addAll(mDisplayContent.mChangingContainers); + boolean deferForRecents = false; + for (int i = 0; i < participants.size(); i++) { + WindowContainer wc = participants.valueAt(i); + final ActivityRecord activity = getAppFromContainer(wc); + if (activity == null) { + continue; + } + // Don't defer recents animation if one of activity isn't running for it, that one + // might be started from quickstep. + if (!activity.isAnimating(PARENTS, ANIMATION_TYPE_RECENTS)) { + deferForRecents = false; + break; + } + deferForRecents = true; + } + if (deferForRecents) { + ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, + "Delaying app transition for recents animation to finish"); + return; + } + } + Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "AppTransitionReady"); ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "**** GOOD TO GO"); @@ -1249,27 +1285,12 @@ public class AppTransitionController { "Delaying app transition for screen rotation animation to finish"); return false; } - final boolean isRecentsInOpening = mDisplayContent.mOpeningApps.stream().anyMatch( - ConfigurationContainer::isActivityTypeRecents); for (int i = 0; i < apps.size(); i++) { WindowContainer wc = apps.valueAt(i); final ActivityRecord activity = getAppFromContainer(wc); if (activity == null) { continue; } - // In order to avoid visual clutter caused by a conflict between app transition - // animation and recents animation, app transition is delayed until recents finishes. - // One exceptional case. When 3P launcher is used and a user taps a task screenshot in - // task switcher (isRecentsInOpening=true), app transition must start even though - // recents is running. Otherwise app transition is blocked until timeout (b/232984498). - // When 1P launcher is used, this animation is controlled by the launcher outside of - // the app transition, so delaying app transition doesn't cause visible delay. After - // recents finishes, app transition is handled just to commit visibility on apps. - if (!isRecentsInOpening && 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", |