From 54a7b623b1a165b085bd74358268636675453bad Mon Sep 17 00:00:00 2001 From: Beverly Date: Mon, 19 Sep 2022 14:23:44 +0000 Subject: [PATCH] Do not use stableDisplaySize for scale factor The stableDisplaySize doesn't account for different displays, and only returns the stable display size of one of the displays. Instead of using stableDisplaySize, use the maxResolutionDisplayMode for the current display to determine whether the resolution of the device changed. Test: manually check that lock icon is an expected size on a device with multiple displays Test: UDFPS is the correct size at different display resolutions Fixes: 246631157 Change-Id: Iea933733f00ac7b8446ce6fc5825475e4b490655 --- .../android/systemui/biometrics/AuthController.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java index a3b6cfc118035..66a4d2cc6ea80 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java @@ -56,6 +56,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.RemoteException; import android.os.UserManager; +import android.util.DisplayUtils; import android.util.Log; import android.util.RotationUtils; import android.util.SparseBooleanArray; @@ -118,8 +119,6 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba private final Provider mUdfpsControllerFactory; private final Provider mSidefpsControllerFactory; - @NonNull private Point mStableDisplaySize = new Point(); - private final Display mDisplay; private float mScaleFactor = 1f; // sensor locations without any resolution scaling nor rotation adjustments: @@ -509,10 +508,11 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba */ private void updateSensorLocations() { mDisplay.getDisplayInfo(mCachedDisplayInfo); - + final Display.Mode maxDisplayMode = + DisplayUtils.getMaximumResolutionDisplayMode(mCachedDisplayInfo.supportedModes); final float scaleFactor = android.util.DisplayUtils.getPhysicalPixelDisplaySizeRatio( - mStableDisplaySize.x, mStableDisplaySize.y, mCachedDisplayInfo.getNaturalWidth(), - mCachedDisplayInfo.getNaturalHeight()); + maxDisplayMode.getPhysicalWidth(), maxDisplayMode.getPhysicalHeight(), + mCachedDisplayInfo.getNaturalWidth(), mCachedDisplayInfo.getNaturalHeight()); if (scaleFactor == Float.POSITIVE_INFINITY) { mScaleFactor = 1f; } else { @@ -769,7 +769,6 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba mFingerprintAuthenticatorsRegisteredCallback); } - mStableDisplaySize = mDisplayManager.getStableDisplaySize(); mActivityTaskManager.registerTaskStackListener(mTaskStackListener); mOrientationListener.enable(); updateSensorLocations(); @@ -1149,7 +1148,6 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba @Override public void dump(@NonNull PrintWriter pw, @NonNull String[] args) { final AuthDialog dialog = mCurrentDialog; - pw.println(" stableDisplaySize=" + mStableDisplaySize); pw.println(" mCachedDisplayInfo=" + mCachedDisplayInfo); pw.println(" mScaleFactor=" + mScaleFactor); pw.println(" faceAuthSensorLocationDefault=" + mFaceSensorLocationDefault);