OSDN Git Service

DO NOT MERGE - Also scale down thumbnail in app transitions for grid recents
authorManu Cornet <manucornet@google.com>
Thu, 12 Jan 2017 23:05:13 +0000 (15:05 -0800)
committerManu Cornet <manucornet@google.com>
Fri, 13 Jan 2017 01:05:17 +0000 (01:05 +0000)
Bug: 32101881
Test: Checked the effect on app -> recents transition on local sw600dp device
Change-Id: Ic3e3af6e8db4a62028e1283e915a7cd12db49607

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

index cd46165..2379374 100644 (file)
@@ -57,6 +57,7 @@ import android.os.Debug;
 import android.os.IBinder;
 import android.os.IRemoteCallback;
 import android.os.RemoteException;
+import android.os.SystemProperties;
 import android.util.ArraySet;
 import android.util.Slog;
 import android.util.SparseArray;
@@ -234,6 +235,8 @@ public class AppTransition implements Dump {
     private boolean mLastHadClipReveal;
     private boolean mProlongedAnimationsEnded;
 
+    private final boolean mGridLayoutRecentsEnabled;
+
     AppTransition(Context context, WindowManagerService service) {
         mContext = context;
         mService = service;
@@ -272,6 +275,7 @@ public class AppTransition implements Dump {
         };
         mClipRevealTranslationY = (int) (CLIP_REVEAL_TRANSLATION_Y_DP
                 * mContext.getResources().getDisplayMetrics().density);
+        mGridLayoutRecentsEnabled = SystemProperties.getBoolean("ro.recents.grid", false);
     }
 
     boolean isTransitionSet() {
@@ -926,7 +930,7 @@ public class AppTransition implements Dump {
         final float toY;
         final float pivotX;
         final float pivotY;
-        if (isTvUiMode(uiMode) || orientation == Configuration.ORIENTATION_PORTRAIT) {
+        if (shouldScaleDownThumbnailTransition(uiMode, orientation)) {
             fromX = mTmpRect.left;
             fromY = mTmpRect.top;
 
@@ -1097,7 +1101,7 @@ public class AppTransition implements Dump {
                     mTmpFromClipRect.inset(contentInsets);
                     mNextAppTransitionInsets.set(contentInsets);
 
-                    if (isTvUiMode(uiMode) || orientation == Configuration.ORIENTATION_PORTRAIT) {
+                    if (shouldScaleDownThumbnailTransition(uiMode, orientation)) {
                         // We scale the width and clip to the top/left square
                         float scale = thumbWidth /
                                 (appWidth - contentInsets.left - contentInsets.right);
@@ -1960,6 +1964,15 @@ public class AppTransition implements Dump {
     }
 
     /**
+     * @return whether the transition should show the thumbnail being scaled down.
+     */
+    private boolean shouldScaleDownThumbnailTransition(int uiMode, int orientation) {
+        return isTvUiMode(uiMode)
+                || mGridLayoutRecentsEnabled
+                || orientation == Configuration.ORIENTATION_PORTRAIT;
+    }
+
+    /**
      * @return whether the specified {@param uiMode} is the TV mode.
      */
     private boolean isTvUiMode(int uiMode) {