Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1d50567 authored by LuK1337's avatar LuK1337 Committed by Bruno Martins
Browse files

SystemUI: Use max Display.Mode in AuthController as well

This was missed in 0f7cc012.

Test: On device with UDFPS and multiple resolutions, switch resolution
      and observe that UDFPS icon is still in correct location.
Change-Id: Ib6c4625a17032c913e4efc57dd41d16d3a3a25ee
parent 7f846d20
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -54,8 +54,10 @@ 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.SparseBooleanArray;
import android.view.Display;
import android.view.DisplayInfo;
import android.view.MotionEvent;
import android.view.WindowManager;
@@ -112,8 +114,6 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
    private final Provider<UdfpsController> mUdfpsControllerFactory;
    private final Provider<SidefpsController> mSidefpsControllerFactory;

    @NonNull private Point mStableDisplaySize = new Point();

    @Nullable private final PointF mFaceAuthSensorLocation;
    @Nullable private PointF mFingerprintLocation;
    @Nullable private Rect mUdfpsBounds;
@@ -486,9 +486,11 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
        }
        DisplayInfo displayInfo = new DisplayInfo();
        mContext.getDisplay().getDisplayInfo(displayInfo);
        final float scaleFactor = android.util.DisplayUtils.getPhysicalPixelDisplaySizeRatio(
                mStableDisplaySize.x, mStableDisplaySize.y, displayInfo.getNaturalWidth(),
                displayInfo.getNaturalHeight());
        final Display.Mode maxDisplayMode =
                DisplayUtils.getMaximumResolutionDisplayMode(displayInfo.supportedModes);
        final float scaleFactor = DisplayUtils.getPhysicalPixelDisplaySizeRatio(
                maxDisplayMode.getPhysicalWidth(), maxDisplayMode.getPhysicalHeight(),
                displayInfo.getNaturalWidth(), displayInfo.getNaturalHeight());
        return new PointF(mFaceAuthSensorLocation.x * scaleFactor,
                mFaceAuthSensorLocation.y * scaleFactor);
    }
@@ -636,9 +638,11 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
        if (mUdfpsController != null) {
            final DisplayInfo displayInfo = new DisplayInfo();
            mContext.getDisplay().getDisplayInfo(displayInfo);
            final float scaleFactor = android.util.DisplayUtils.getPhysicalPixelDisplaySizeRatio(
                    mStableDisplaySize.x, mStableDisplaySize.y, displayInfo.getNaturalWidth(),
                    displayInfo.getNaturalHeight());
            final Display.Mode maxDisplayMode =
                    DisplayUtils.getMaximumResolutionDisplayMode(displayInfo.supportedModes);
            final float scaleFactor = DisplayUtils.getPhysicalPixelDisplaySizeRatio(
                    maxDisplayMode.getPhysicalWidth(), maxDisplayMode.getPhysicalHeight(),
                    displayInfo.getNaturalWidth(), displayInfo.getNaturalHeight());

            final FingerprintSensorPropertiesInternal udfpsProp = mUdfpsProps.get(0);
            final Rect previousUdfpsBounds = mUdfpsBounds;
@@ -665,7 +669,6 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
                    mFingerprintAuthenticatorsRegisteredCallback);
        }

        mStableDisplaySize = mDisplayManager.getStableDisplaySize();
        mActivityTaskManager.registerTaskStackListener(mTaskStackListener);
    }