Also scale down thumbnail in app transitions for grid recents
This is a manual cherrypick of change 1779235 since automerging had
conflicts.
Bug: 32101881
Test: Checked the effect on app -> recents transition on local sw600dp device
Change-Id: I3dec10b2293ceb50bf02db2432766e5d34f91736
diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java
index 862c145..9159513 100644
--- a/services/core/java/com/android/server/wm/AppTransition.java
+++ b/services/core/java/com/android/server/wm/AppTransition.java
@@ -57,6 +57,7 @@
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;
@@ -250,6 +251,8 @@
private boolean mLastHadClipReveal;
private boolean mProlongedAnimationsEnded;
+ private final boolean mGridLayoutRecentsEnabled;
+
AppTransition(Context context, WindowManagerService service) {
mContext = context;
mService = service;
@@ -288,6 +291,7 @@
};
mClipRevealTranslationY = (int) (CLIP_REVEAL_TRANSLATION_Y_DP
* mContext.getResources().getDisplayMetrics().density);
+ mGridLayoutRecentsEnabled = SystemProperties.getBoolean("ro.recents.grid", false);
}
boolean isTransitionSet() {
@@ -952,7 +956,7 @@
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;
@@ -1123,7 +1127,7 @@
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);
@@ -2037,6 +2041,15 @@
}
/**
+ * @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) {