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

Commit 5756cacd authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Only request max refresh rate when Optical UDFPS is enrolled" into main

parents 4eb8c81d 25182222
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import android.hardware.face.FaceManager;
import android.hardware.face.FaceSensorPropertiesInternal;
import android.hardware.face.IFaceAuthenticatorsRegisteredCallback;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorProperties;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.hardware.fingerprint.IFingerprintAuthenticatorsRegisteredCallback;
import android.hardware.fingerprint.IUdfpsRefreshRateRequestCallback;
@@ -1158,6 +1159,15 @@ public class AuthController implements
        return mFaceEnrolledForUser.get(userId);
    }

    /**
     * Does the provided user have at least one optical udfps fingerprint enrolled?
     */
    public boolean isOpticalUdfpsEnrolled(int userId) {
        return isUdfpsEnrolled(userId)
                && mUdfpsProps != null
                && mUdfpsProps.get(0).sensorType == FingerprintSensorProperties.TYPE_UDFPS_OPTICAL;
    }

    /**
     * Whether the passed userId has enrolled UDFPS.
     */
+5 −1
Original line number Diff line number Diff line
@@ -373,7 +373,9 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
            boolean onKeyguard = state.statusBarState == StatusBarState.KEYGUARD
                    && !state.keyguardFadingAway && !state.keyguardGoingAway;
            if (onKeyguard
                    && mAuthController.isUdfpsEnrolled(mUserInteractor.get().getSelectedUserId())) {
                    && mAuthController.isOpticalUdfpsEnrolled(
                            mUserInteractor.get().getSelectedUserId())
            ) {
                // Requests the max refresh rate (ie: for smooth display). Note: By setting
                // the preferred refresh rates below, the refresh rate will not override the max
                // refresh rate in settings (ie: if smooth display is OFF).
@@ -892,6 +894,8 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
        pw.println(TAG + ":");
        pw.println("  mKeyguardMaxRefreshRate=" + mKeyguardMaxRefreshRate);
        pw.println("  mKeyguardPreferredRefreshRate=" + mKeyguardPreferredRefreshRate);
        pw.println("  preferredMinDisplayRefreshRate=" + mLpChanged.preferredMinDisplayRefreshRate);
        pw.println("  preferredMaxDisplayRefreshRate=" + mLpChanged.preferredMaxDisplayRefreshRate);
        pw.println("  mDeferWindowLayoutParams=" + mDeferWindowLayoutParams);
        pw.println(mCurrentState);
        if (mWindowRootView != null && mWindowRootView.getViewRootImpl() != null) {
+6 −6
Original line number Diff line number Diff line
@@ -525,8 +525,8 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {

    @Test
    public void udfpsEnrolled_minAndMaxRefreshRateSetToPreferredRefreshRate() {
        // GIVEN udfps is enrolled
        when(mAuthController.isUdfpsEnrolled(anyInt())).thenReturn(true);
        // GIVEN optical udfps is enrolled
        when(mAuthController.isOpticalUdfpsEnrolled(anyInt())).thenReturn(true);

        // WHEN keyguard is showing
        setKeyguardShowing();
@@ -540,9 +540,9 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
    }

    @Test
    public void udfpsNotEnrolled_refreshRateUnset() {
    public void opticalUdfpsNotEnrolled_refreshRateUnset() {
        // GIVEN udfps is NOT enrolled
        when(mAuthController.isUdfpsEnrolled(anyInt())).thenReturn(false);
        when(mAuthController.isOpticalUdfpsEnrolled(anyInt())).thenReturn(false);

        // WHEN keyguard is showing
        setKeyguardShowing();
@@ -557,8 +557,8 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {

    @Test
    public void keyguardNotShowing_refreshRateUnset() {
        // GIVEN UDFPS is enrolled
        when(mAuthController.isUdfpsEnrolled(anyInt())).thenReturn(true);
        // GIVEN optical UDFPS is enrolled
        when(mAuthController.isOpticalUdfpsEnrolled(anyInt())).thenReturn(true);

        // WHEN keyguard is NOT showing
        mNotificationShadeWindowController.setKeyguardShowing(false);