diff options
author | Wale Ogunwale <ogunwale@google.com> | 2015-07-16 09:45:35 -0700 |
---|---|---|
committer | Wale Ogunwale <ogunwale@google.com> | 2015-07-16 09:45:35 -0700 |
commit | b60c0f616c0863e3970bcacd82a793e561d99689 (patch) | |
tree | 1b0c4f7a3d53c5de41615453983dca228486e028 /services/core/java | |
parent | 3cc5c24b83edaab66c97b161e25ff0bd93b3e1b4 (diff) | |
download | frameworks_base-b60c0f616c0863e3970bcacd82a793e561d99689.zip frameworks_base-b60c0f616c0863e3970bcacd82a793e561d99689.tar.gz frameworks_base-b60c0f616c0863e3970bcacd82a793e561d99689.tar.bz2 |
Animate app exit for cases where the app is already hidden before transition
It is possible for an app token to be marked as hidden and exiting
because the previous activity destory is completed before we are
good-to-go with app transition since we are still waiting for the
opening app to be done drawing. In this case we don't apply the
exiting animation since the token is not changing visibility state
during the app transition (it is already hidden and we are telling
it to hide...).
We now allow the animation to load if the token is already hidden
and marked as exiting.
Bug: 22381703
Change-Id: I5c27b6c3c1f810f05b2d716122055c6f12d0a167
Diffstat (limited to 'services/core/java')
-rw-r--r-- | services/core/java/com/android/server/wm/WindowManagerService.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index ac4fea8..85a333c 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -2728,10 +2728,10 @@ public class WindowManagerService extends IWindowManager.Stub wasVisible = win.isWinVisibleLw(); if (wasVisible) { - int transit = WindowManagerPolicy.TRANSIT_EXIT; - if (win.mAttrs.type == TYPE_APPLICATION_STARTING) { - transit = WindowManagerPolicy.TRANSIT_PREVIEW_DONE; - } + final int transit = (!startingWindow) + ? WindowManagerPolicy.TRANSIT_EXIT + : WindowManagerPolicy.TRANSIT_PREVIEW_DONE; + // Try starting an animation. if (win.mWinAnimator.applyAnimationLocked(transit, false)) { win.mExiting = true; @@ -2743,12 +2743,13 @@ public class WindowManagerService extends IWindowManager.Stub } } final AppWindowToken appToken = win.mAppToken; + final boolean isAnimating = win.mWinAnimator.isAnimating(); // The starting window is the last window in this app token and it isn't animating. // Allow it to be removed now as there is no additional window or animation that will // trigger its removal. final boolean lastWinStartingNotAnimating = startingWindow && appToken!= null - && appToken.allAppWindows.size() == 1 && !win.mWinAnimator.isAnimating(); - if (!lastWinStartingNotAnimating && (win.mExiting || win.mWinAnimator.isAnimating())) { + && appToken.allAppWindows.size() == 1 && !isAnimating; + if (!lastWinStartingNotAnimating && (win.mExiting || isAnimating)) { // The exit animation is running... wait for it! win.mExiting = true; win.mRemoveOnExit = true; @@ -4524,7 +4525,10 @@ public class WindowManagerService extends IWindowManager.Stub } wtoken.willBeHidden = false; - if (wtoken.hidden == visible) { + // Allow for state changes and animation to be applied if token is transitioning + // visibility state or the token was marked as hidden and is exiting before we had a chance + // to play the transition animation. + if (wtoken.hidden == visible || (wtoken.hidden && wtoken.mIsExiting)) { boolean changed = false; if (DEBUG_APP_TRANSITIONS) Slog.v( TAG, "Changing app " + wtoken + " hidden=" + wtoken.hidden |