diff options
| author | 2022-07-07 21:30:14 +0000 | |
|---|---|---|
| committer | 2022-07-07 21:30:14 +0000 | |
| commit | e9ff71ec1b1079ca2f718e48dbb4395bf1ad4852 (patch) | |
| tree | fd95c48701d3c3d361b64a0b6476c907f5b75835 | |
| parent | 2f63c77bca07939c823aefff2323410e24137fb2 (diff) | |
| parent | 5b837170ec007e01368e02d1556ce0b2c1a847a7 (diff) | |
Merge "Skip launcher animation when top window is already animating." into tm-qpr-dev
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java | 4 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/BackNavigationController.java | 12 |
2 files changed, 10 insertions, 6 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java index 0cf2b28921e1..d53a98cf5b07 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java @@ -403,7 +403,9 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont private boolean shouldDispatchToLauncher(int backType) { return backType == BackNavigationInfo.TYPE_RETURN_TO_HOME && mBackToLauncherCallback != null - && mEnableAnimations.get(); + && mEnableAnimations.get() + && mBackNavigationInfo != null + && mBackNavigationInfo.getDepartingAnimationTarget() != null; } private static void dispatchOnBackStarted(IOnBackInvokedCallback callback) { diff --git a/services/core/java/com/android/server/wm/BackNavigationController.java b/services/core/java/com/android/server/wm/BackNavigationController.java index d07cc68af890..9295c18fe80e 100644 --- a/services/core/java/com/android/server/wm/BackNavigationController.java +++ b/services/core/java/com/android/server/wm/BackNavigationController.java @@ -112,6 +112,7 @@ class BackNavigationController { RemoteAnimationTarget topAppTarget = null; int prevTaskId; int prevUserId; + boolean prepareAnimation; BackNavigationInfo.Builder infoBuilder = new BackNavigationInfo.Builder(); synchronized (wmService.mGlobalLock) { @@ -257,7 +258,8 @@ class BackNavigationController { BackNavigationInfo.typeToString(backType)); // For now, we only animate when going home. - boolean prepareAnimation = backType == BackNavigationInfo.TYPE_RETURN_TO_HOME + prepareAnimation = backType == BackNavigationInfo.TYPE_RETURN_TO_HOME + && requestAnimation // Only create a new leash if no leash has been created. // Otherwise return null for animation target to avoid conflict. && !removedWindowContainer.hasCommittedReparentToAnimationLeash(); @@ -292,7 +294,7 @@ class BackNavigationController { } // Special handling for back to home animation - if (backType == BackNavigationInfo.TYPE_RETURN_TO_HOME && requestAnimation + if (backType == BackNavigationInfo.TYPE_RETURN_TO_HOME && prepareAnimation && prevTask != null) { currentTask.mBackGestureStarted = true; // Make launcher show from behind by marking its top activity as visible and @@ -347,7 +349,7 @@ class BackNavigationController { Task finalTask = currentTask; RemoteCallback onBackNavigationDone = new RemoteCallback(result -> onBackNavigationDone( result, finalRemovedWindowContainer, finalBackType, finalTask, - finalprevActivity, requestAnimation)); + finalprevActivity, prepareAnimation)); infoBuilder.setOnBackNavigationDone(onBackNavigationDone); } @@ -381,14 +383,14 @@ class BackNavigationController { private void onBackNavigationDone( Bundle result, WindowContainer<?> windowContainer, int backType, - Task task, ActivityRecord prevActivity, boolean requestAnimation) { + Task task, ActivityRecord prevActivity, boolean prepareAnimation) { SurfaceControl surfaceControl = windowContainer.getSurfaceControl(); boolean triggerBack = result != null && result.getBoolean( BackNavigationInfo.KEY_TRIGGER_BACK); ProtoLog.d(WM_DEBUG_BACK_PREVIEW, "onBackNavigationDone backType=%s, " + "task=%s, prevActivity=%s", backType, task, prevActivity); - if (backType == BackNavigationInfo.TYPE_RETURN_TO_HOME && requestAnimation) { + if (backType == BackNavigationInfo.TYPE_RETURN_TO_HOME && prepareAnimation) { if (triggerBack) { if (surfaceControl != null && surfaceControl.isValid()) { // When going back to home, hide the task surface before it is re-parented to |