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

Commit f16219e8 authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Add new method instead of exposing the udfpsRefreshRateCallback

We still expose the callback for other biometrics use cases,
but we abstract away the requestMaxRefreshRate method.

Test: atest AuthControllerTest
Test: manual
Bug: 300348919
Flag: NONE
Change-Id: I05ec7e7d25dc44fdacf368e1c9f0255f89b1c402
parent ed8cda6a
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ import com.android.systemui.doze.DozeReceiver;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.keyguard.data.repository.BiometricType;
import com.android.systemui.log.core.LogLevel;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.util.concurrency.DelayableExecutor;
@@ -158,7 +159,7 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks,
    @Nullable private UdfpsOverlayParams mUdfpsOverlayParams;
    @Nullable private IUdfpsRefreshRateRequestCallback mUdfpsRefreshRateRequestCallback;
    @Nullable private SideFpsController mSideFpsController;
    @Nullable private UdfpsLogger mUdfpsLogger;
    @NonNull private UdfpsLogger mUdfpsLogger;
    @VisibleForTesting IBiometricSysuiReceiver mReceiver;
    @VisibleForTesting @NonNull final BiometricDisplayListener mOrientationListener;
    @Nullable private final List<FaceSensorPropertiesInternal> mFaceProps;
@@ -930,6 +931,23 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks,
        return mUdfpsRefreshRateRequestCallback;
    }

    /**
     * Requests (or stops requesting) the max refresh rate. This can override user settings
     * for the max refresh rate.
     */
    public void requestMaxRefreshRate(boolean request) throws RemoteException {
        if (mUdfpsRefreshRateRequestCallback == null) {
            mUdfpsLogger.log(
                    "PreAuthRefreshRate",
                    "skip request - refreshRateCallback is null",
                    LogLevel.DEBUG
            );
            return;
        }
        mUdfpsLogger.requestMaxRefreshRate(request);
        mUdfpsRefreshRateRequestCallback.onAuthenticationPossible(mContext.getDisplayId(), request);
    }

    @Override
    public void showAuthenticationDialog(PromptInfo promptInfo, IBiometricSysuiReceiver receiver,
            int[] sensorIds, boolean credentialAllowed, boolean requireConfirmation,
+4 −0
Original line number Diff line number Diff line
@@ -42,4 +42,8 @@ class UdfpsLogger @Inject constructor(@UdfpsLog private val logBuffer: LogBuffer
    fun log(tag: String, @CompileTimeConstant msg: String, level: LogLevel) {
        logBuffer.log(tag, level, msg)
    }

    fun requestMaxRefreshRate(request: Boolean) {
        logBuffer.log("RefreshRate", LogLevel.DEBUG, { bool1 = request }, { "Request max: $bool1" })
    }
}
+4 −1
Original line number Diff line number Diff line
@@ -352,7 +352,10 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
                    && !state.keyguardFadingAway && !state.keyguardGoingAway;
            if (onKeyguard
                    && mAuthController.isUdfpsEnrolled(mUserInteractor.get().getSelectedUserId())) {
                // both max and min display refresh rate must be set to take effect:
                // 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).
                // Both max and min display refresh rate must be set to take effect:
                mLpChanged.preferredMaxDisplayRefreshRate = mKeyguardPreferredRefreshRate;
                mLpChanged.preferredMinDisplayRefreshRate = mKeyguardPreferredRefreshRate;
            } else {