From 29e7a58f1ae29002d3c5a0b6c68642ff6a6a05c3 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 4 May 2020 18:04:29 -0700 Subject: [PATCH] Fixing max-zoom-scale not taking into account the the fullScreen scale Also fixing the issue where display info is is not correctly initialized Bug: 155257023 Bug: 155682580 Change-Id: Ib2cc981c1900f3d14f158f4dbb60ae77311f339b --- .../com/android/quickstep/RecentsAnimationDeviceState.java | 2 ++ .../com/android/quickstep/util/RecentsOrientedState.java | 6 +++++- src/com/android/launcher3/util/DefaultDisplay.java | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java index ef14e2888d..8ac15e803f 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java @@ -17,6 +17,7 @@ package com.android.quickstep; import static android.content.Intent.ACTION_USER_UNLOCKED; +import static com.android.launcher3.util.DefaultDisplay.CHANGE_ALL; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import static com.android.quickstep.SysUINavigationMode.Mode.THREE_BUTTONS; @@ -216,6 +217,7 @@ public class RecentsAnimationDeviceState implements mDefaultDisplay.removeChangeListener(this); if (newMode.hasGestures) { mDefaultDisplay.addChangeListener(this); + onDisplayInfoChanged(mDefaultDisplay.getInfo(), CHANGE_ALL); } if (newMode == NO_BUTTON) { diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java index 5ca2095c32..b36c4ef827 100644 --- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java +++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java @@ -350,7 +350,11 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre } else { outPivot.set(fullWidth, fullHeight); } - final float scale = Math.min(outPivot.x / taskView.width(), outPivot.y / taskView.height()); + float scale = Math.min(outPivot.x / taskView.width(), outPivot.y / taskView.height()); + // We also scale the preview as part of fullScreenParams, so account for that as well. + if (fullWidth > 0) { + scale = scale * dp.widthPx / fullWidth; + } if (scale == 1) { outPivot.set(fullWidth / 2, fullHeight / 2); diff --git a/src/com/android/launcher3/util/DefaultDisplay.java b/src/com/android/launcher3/util/DefaultDisplay.java index d51f777995..fabdb4e86c 100644 --- a/src/com/android/launcher3/util/DefaultDisplay.java +++ b/src/com/android/launcher3/util/DefaultDisplay.java @@ -47,6 +47,8 @@ public class DefaultDisplay implements DisplayListener { public static final int CHANGE_ROTATION = 1 << 1; public static final int CHANGE_FRAME_DELAY = 1 << 2; + public static final int CHANGE_ALL = CHANGE_SIZE | CHANGE_ROTATION | CHANGE_FRAME_DELAY; + private final Context mContext; private final int mId; private final ArrayList mListeners = new ArrayList<>();