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

Commit 25182222 authored by Beverly's avatar Beverly
Browse files

Only request max refresh rate when Optical UDFPS is enrolled

Only optical UDDFPS requires the highest refresh rate.

Test: atest NotificationShadeWindowControllerImplTest
Fixes: 304557049
Flag: NONE
Change-Id: Id6742cd03934876ed6f874e27d3ab970e87b0a83
parent b62d174c
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;
@@ -1155,6 +1156,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) {
+8 −8
Original line number Diff line number Diff line
@@ -23,8 +23,6 @@ import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;

import static com.google.common.truth.Truth.assertThat;

import static kotlinx.coroutines.flow.FlowKt.emptyFlow;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
@@ -38,6 +36,8 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

import static kotlinx.coroutines.flow.FlowKt.emptyFlow;

import android.app.IActivityManager;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
@@ -521,8 +521,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();
@@ -536,9 +536,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();
@@ -553,8 +553,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);