OSDN Git Service

Don't animate black background on cold launch from launcher
authorAndrii Kulian <akulian@google.com>
Fri, 11 Aug 2017 18:27:00 +0000 (11:27 -0700)
committerAndrii Kulian <akulian@google.com>
Fri, 11 Aug 2017 18:27:00 +0000 (11:27 -0700)
When animating cold start from launcher we can't compute the
progress in SurfaceControlWithBackground#calculateBgCrop() via
tracking status bar insets. This CL won't animate bg crop
in case the progress does not make sense.

Bug: 64598822
Test: Cold launch letterboxed app from launcher.
Change-Id: I82182a3c46dd4f81bcf056d1163f78c450bd9b83

services/core/java/com/android/server/wm/SurfaceControlWithBackground.java

index f5ef2e6..90163a2 100644 (file)
@@ -170,6 +170,11 @@ class SurfaceControlWithBackground extends SurfaceControl {
         // Track overall progress of animation by computing cropped portion of status bar.
         final Rect contentInsets = mWindowSurfaceController.mAnimator.mWin.mContentInsets;
         float d = contentInsets.top == 0 ? 0 : (float) crop.top / contentInsets.top;
+        if (d > 1.f) {
+            // We're running expand animation from launcher, won't compute custom bg crop here.
+            mTmpContainerRect.set(crop);
+            return;
+        }
 
         // Compute additional offset for the background when app window is positioned not at (0,0).
         // E.g. landscape with navigation bar on the left.