OSDN Git Service

Set-up dummy animation when setting a replacing window token
authorWale Ogunwale <ogunwale@google.com>
Mon, 16 Nov 2015 21:01:41 +0000 (13:01 -0800)
committerWale Ogunwale <ogunwale@google.com>
Mon, 16 Nov 2015 21:09:29 +0000 (13:09 -0800)
Set-up dummy animation so we can start treating windows associated
with the replacing app token like they are in transition before the
new app window is ready for us to run the real transition animation.
This allows us to make the right decisions at various call points
where an animation is expected to be running for a replacing window
but the real animation isn't set yet.

Also, removed unused field indicating if an app token is animating
a replacement window since it was always set to true and checked/set
to the same value as AppWindowToken.mWillReplaceWindow.

Bug: 25645069
Change-Id: Ie216ed5bd60fb2a15da61c7050c9344c48b1c5fb

services/core/java/com/android/server/am/ActivityStackSupervisor.java
services/core/java/com/android/server/wm/AppWindowToken.java
services/core/java/com/android/server/wm/WindowManagerService.java
services/core/java/com/android/server/wm/WindowState.java

index 13d3ee1..0ec4b18 100644 (file)
@@ -3354,11 +3354,10 @@ public final class ActivityStackSupervisor implements DisplayListener {
             // preserve the old window until the new one is drawn. This prevents having a gap
             // between the removal and addition, in which no window is visible. We also want the
             // entrance of the new window to be properly animated.
-            mWindowManager.setReplacingWindow(topActivity.appToken, true /* animate */);
+            mWindowManager.setReplacingWindow(topActivity.appToken);
         }
-        final ActivityStack stack =
-                moveTaskToStackUncheckedLocked(task, stackId, toTop, forceFocus,
-                        "moveTaskToStack:" + reason);
+        final ActivityStack stack = moveTaskToStackUncheckedLocked(
+                task, stackId, toTop, forceFocus, "moveTaskToStack:" + reason);
 
         // Make sure the task has the appropriate bounds/size for the stack it is in.
         if (stackId == FULLSCREEN_WORKSPACE_STACK_ID && task.mBounds != null) {
index 425ff9b..3f4eaac 100644 (file)
@@ -128,8 +128,6 @@ class AppWindowToken extends WindowToken {
     boolean mWillReplaceWindow;
     // If true, the replaced window was already requested to be removed.
     boolean mReplacingRemoveRequested;
-    // Whether the replacement of the window should trigger app transition animation.
-    boolean mAnimateReplacingWindow;
     // If not null, the window that will be used to replace the old one. This is being set when
     // the window is added and unset when this window reports its first draw.
     WindowState mReplacingWindow;
index 5737d47..64ff4e0 100644 (file)
@@ -2077,7 +2077,7 @@ public class WindowManagerService extends IWindowManager.Stub
     }
 
     private void prepareWindowReplacementTransition(AppWindowToken atoken) {
-        if (atoken == null || !atoken.mWillReplaceWindow || !atoken.mAnimateReplacingWindow) {
+        if (atoken == null || !atoken.mWillReplaceWindow) {
             return;
         }
         atoken.allDrawn = false;
@@ -8585,8 +8585,7 @@ public class WindowManagerService extends IWindowManager.Stub
             } else if (wtoken != null) {
                 winAnimator.mAnimLayer =
                         w.mLayer + wtoken.mAppAnimator.animLayerAdjustment;
-                if (wtoken.mWillReplaceWindow && wtoken.mAnimateReplacingWindow &&
-                        wtoken.mReplacingWindow != w) {
+                if (wtoken.mWillReplaceWindow && wtoken.mReplacingWindow != w) {
                     // We know that we will be animating a relaunching window in the near future,
                     // which will receive a z-order increase. We want the replaced window to
                     // immediately receive the same treatment, e.g. to be above the dock divider.
@@ -10126,9 +10125,8 @@ public class WindowManagerService extends IWindowManager.Stub
      * Hint to a token that its activity will relaunch, which will trigger removal and addition of
      * a window.
      * @param token Application token for which the activity will be relaunched.
-     * @param animate Whether to animate the addition of the new window.
      */
-    public void setReplacingWindow(IBinder token, boolean animate) {
+    public void setReplacingWindow(IBinder token) {
         synchronized (mWindowMap) {
             AppWindowToken appWindowToken = findAppWindowToken(token);
             if (appWindowToken == null) {
@@ -10139,7 +10137,13 @@ public class WindowManagerService extends IWindowManager.Stub
                     + " as replacing window.");
             appWindowToken.mWillReplaceWindow = true;
             appWindowToken.mHasReplacedWindow = false;
-            appWindowToken.mAnimateReplacingWindow = animate;
+
+            // Set-up dummy animation so we can start treating windows associated with this token
+            // like they are in transition before the new app window is ready for us to run the
+            // real transition animation.
+            if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
+                    "setReplacingWindow() Setting dummy animation on: " + appWindowToken);
+            appWindowToken.mAppAnimator.setDummyAnimation();
         }
     }
 
index 673c21f..b2d6a88 100644 (file)
@@ -1388,7 +1388,6 @@ final class WindowState implements WindowManagerPolicy.WindowState {
                 && token.mHasReplacedWindow) {
             if (DEBUG_ADD_REMOVE) Slog.d(TAG, "Removing replacing window: " + this);
             token.mWillReplaceWindow = false;
-            token.mAnimateReplacingWindow = false;
             token.mReplacingRemoveRequested = false;
             token.mReplacingWindow = null;
             token.mHasReplacedWindow = false;