From 040e3678c956aedd688bd5cbeefc9c636c76ef57 Mon Sep 17 00:00:00 2001 From: Louis Chang Date: Wed, 2 Oct 2019 11:44:34 +0800 Subject: [PATCH] Fix no recents animations after unify Recents animation doesn't work once AppWindowToken and ActivityRecord unified because the mLaunchTaskBehind is updated to false too early while running recents animation. We should also defer the updates until recents animation completed. Bug: 80414790 Test: atest RecentsAnimationTest Change-Id: Ie1dd5c580b8f1c7cc66c7e12590a31398e59b2b5 --- .../server/wm/WindowManagerService.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index b4309c74b3909..3b298aa36e173 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -973,6 +973,7 @@ public class WindowManagerService extends IWindowManager.Stub Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } + /** Listener to notify activity manager about app transitions. */ final WindowManagerInternal.AppTransitionListener mActivityManagerAppTransitionNotifier = new WindowManagerInternal.AppTransitionListener() { @@ -989,7 +990,13 @@ public class WindowManagerService extends IWindowManager.Stub if (atoken == null) { return; } - if (atoken.mLaunchTaskBehind) { + + // While running a recents animation, this will get called early because we show the + // recents animation target activity immediately when the animation starts. Defer the + // mLaunchTaskBehind updates until recents animation finishes. + final boolean isRecentsAnimationTarget = getRecentsAnimationController() != null + && getRecentsAnimationController().isTargetApp(atoken); + if (atoken.mLaunchTaskBehind && !isRecentsAnimationTarget) { try { mActivityTaskManager.notifyLaunchTaskBehindComplete(atoken.token); } catch (RemoteException e) { @@ -997,20 +1004,13 @@ public class WindowManagerService extends IWindowManager.Stub atoken.mLaunchTaskBehind = false; } else { atoken.updateReportedVisibilityLocked(); - if (atoken.mEnteringAnimation) { - if (getRecentsAnimationController() != null - && getRecentsAnimationController().isTargetApp(atoken)) { - // Currently running a recents animation, this will get called early because - // we show the recents animation target activity immediately when the - // animation starts. In this case, we should defer sending the finished - // callback until the animation successfully finishes - return; - } else { - atoken.mEnteringAnimation = false; - try { - mActivityTaskManager.notifyEnterAnimationComplete(atoken.token); - } catch (RemoteException e) { - } + // We should also defer sending the finished callback until the recents animation + // successfully finishes. + if (atoken.mEnteringAnimation && !isRecentsAnimationTarget) { + atoken.mEnteringAnimation = false; + try { + mActivityTaskManager.notifyEnterAnimationComplete(atoken.token); + } catch (RemoteException e) { } } }