OSDN Git Service

Fix multi window thumbnail animation to the top of the screen.
authorFilip Gruszczynski <gruszczy@google.com>
Thu, 27 Aug 2015 00:00:47 +0000 (17:00 -0700)
committerFilip Gruszczynski <gruszczy@google.com>
Thu, 27 Aug 2015 15:39:21 +0000 (08:39 -0700)
mContainingFrame might be larger than mFrame in the free form stack. We
need to use the final frame to calculate where the animation goes. Also,
instead of detecting full screen and dialog windows, we can just check
if the window is free form to determine if we should use the multi
window animation.

Bug: 23554941
Change-Id: I71969aad5d39974b3da929aeed0b29ef9a71b516

services/core/java/com/android/server/wm/AppTransition.java
services/core/java/com/android/server/wm/WindowManagerService.java
services/core/java/com/android/server/wm/WindowState.java

index d1145d0..de7c07e 100644 (file)
@@ -870,10 +870,10 @@ public class AppTransition implements Dump {
     }
 
     private Animation createAspectScaledThumbnailEnterNonFullscreenAnimationLocked(
-            Rect containingFrame, @Nullable Rect surfaceInsets, int taskId) {
+            Rect frame, @Nullable Rect surfaceInsets, int taskId) {
         getNextAppTransitionStartRect(taskId, mTmpStartRect);
-        float width = containingFrame.width();
-        float height = containingFrame.height();
+        float width = frame.width();
+        float height = frame.height();
         float scaleWidth = mTmpStartRect.width() / width;
         float scaleHeight = mTmpStartRect.height() / height;
         AnimationSet set = new AnimationSet(true);
@@ -886,9 +886,9 @@ public class AppTransition implements Dump {
         ScaleAnimation scale = new ScaleAnimation(scaleWidth, 1, scaleHeight, 1,
                 (width + surfaceInsetsHorizontal) / 2, (height + surfaceInsetsVertical) / 2);
         int fromX = mTmpStartRect.left + mTmpStartRect.width() / 2
-                - (containingFrame.left + containingFrame.width() / 2);
+                - (frame.left + frame.width() / 2);
         int fromY = mTmpStartRect.top + mTmpStartRect.height() / 2
-                - (containingFrame.top + containingFrame.height() / 2);
+                - (frame.top + frame.height() / 2);
         TranslateAnimation translation = new TranslateAnimation(fromX, 0, fromY, 0);
         set.addAnimation(scale);
         set.addAnimation(translation);
index 52aaf64..cf690a5 100644 (file)
@@ -2806,12 +2806,17 @@ public class WindowManagerService extends IWindowManager.Stub
             Rect appFrame = new Rect(0, 0, width, height);
             Rect surfaceInsets = null;
             final boolean fullscreen = win != null && win.isFullscreen(width, height);
-            // Dialog activities have windows with containing frame being very large, but not
-            // exactly fullscreen and much smaller mFrame. We use this distinction to identify
-            // dialog activities.
-            final boolean dialogWindow = win != null && !win.mContainingFrame.equals(win.mFrame);
+            final boolean freeform = win != null && win.inFreeformWorkspace();
             if (win != null) {
-                containingFrame.set(win.mContainingFrame);
+                // Containing frame will usually cover the whole screen, including dialog windows.
+                // For freeform workspace windows it will not cover the whole screen and it also
+                // won't exactly match the final freeform window frame (e.g. when overlapping with
+                // the status bar). In that case we need to use the final frame.
+                if (freeform) {
+                    containingFrame.set(win.mFrame);
+                } else {
+                    containingFrame.set(win.mContainingFrame);
+                }
                 surfaceInsets = win.getAttrs().surfaceInsets;
                 if (fullscreen) {
                     // For fullscreen windows use the window frames and insets to set the thumbnail
@@ -2830,11 +2835,9 @@ public class WindowManagerService extends IWindowManager.Stub
                 // screen gets the enter animation. Both appear in the mOpeningApps set.
                 enter = false;
             }
-            final boolean resizedWindow = !fullscreen && !dialogWindow;
             Animation a = mAppTransition.loadAnimation(lp, transit, enter, containingWidth,
                     containingHeight, mCurConfiguration.orientation, containingFrame, contentInsets,
-                    surfaceInsets, appFrame, isVoiceInteraction, resizedWindow,
-                    atoken.mTask.mTaskId);
+                    surfaceInsets, appFrame, isVoiceInteraction, freeform, atoken.mTask.mTaskId);
             if (a != null) {
                 if (DEBUG_ANIM) {
                     RuntimeException e = null;
index 092a6d1..761e5eb 100644 (file)
@@ -1629,7 +1629,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
         }
     }
 
-    private boolean inFreeformWorkspace() {
+    boolean inFreeformWorkspace() {
         final Task task = getTask();
         return task != null && task.mStack != null &&
                 task.mStack.mStackId == FREEFORM_WORKSPACE_STACK_ID;