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

Commit e570d8b5 authored by Joshua Mccloskey's avatar Joshua Mccloskey Committed by Automerger Merge Worker
Browse files

Merge changes from topic "require-screen-on-to-auth" into tm-qpr-dev am: 568ad42e

parents 7acebc18 568ad42e
Loading
Loading
Loading
Loading
+25 −30
Original line number Diff line number Diff line
@@ -400,6 +400,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    protected Handler getHandler() {
        return mHandler;
    }

    private final Handler mHandler;

    private final IBiometricEnabledOnKeyguardCallback mBiometricEnabledCallback =
@@ -724,6 +725,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab

    /**
     * Request to listen for face authentication when an app is occluding keyguard.
     *
     * @param request if true and mKeyguardOccluded, request face auth listening, else default
     *                to normal behavior.
     *                See {@link KeyguardUpdateMonitor#shouldListenForFace()}
@@ -736,6 +738,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab

    /**
     * Request to listen for fingerprint when an app is occluding keyguard.
     *
     * @param request if true and mKeyguardOccluded, request fingerprint listening, else default
     *                to normal behavior.
     *                See {@link KeyguardUpdateMonitor#shouldListenForFingerprint(boolean)}
@@ -2240,7 +2243,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                Settings.System.getUriFor(Settings.System.TIME_12_24),
                false, mTimeFormatChangeObserver, UserHandle.USER_ALL);

        if (isSfpsSupported() && isSfpsEnrolled()) {
        updateSfpsRequireScreenOnToAuthPref();
        mSfpsRequireScreenOnToAuthPrefObserver = new ContentObserver(mHandler) {
            @Override
@@ -2256,7 +2258,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                mSfpsRequireScreenOnToAuthPrefObserver,
                getCurrentUser());
    }
    }

    protected void updateSfpsRequireScreenOnToAuthPref() {
        final int defaultSfpsRequireScreenOnToAuthValue =
@@ -2648,27 +2649,21 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                !(mFingerprintLockedOut && mBouncerIsOrWillBeShowing && mCredentialAttempted);

        final boolean isEncryptedOrLockdownForUser = isEncryptedOrLockdown(user);

        final boolean shouldListenUdfpsState = !isUdfps
                || (!userCanSkipBouncer
                && !isEncryptedOrLockdownForUser
                && userDoesNotHaveTrust);

        boolean shouldListenSfpsState = true;
        // If mSfpsRequireScreenOnToAuthPrefEnabled, require screen on to listen to SFPS
        if (isSfpsSupported() && isSfpsEnrolled() && mSfpsRequireScreenOnToAuthPrefEnabled) {
            shouldListenSfpsState = isDeviceInteractive();
        boolean shouldListenSideFpsState = true;
        if (isSfpsSupported() && isSfpsEnrolled()) {
            shouldListenSideFpsState =
                    mSfpsRequireScreenOnToAuthPrefEnabled ? isDeviceInteractive() : true;
        }

        boolean shouldListen = shouldListenKeyguardState && shouldListenUserState
                && shouldListenBouncerState && !isFingerprintLockedOut();

        if (isUdfpsSupported()) {
            shouldListen = shouldListen && shouldListenUdfpsState;
        }

        if (isSfpsSupported()) {
            shouldListen = shouldListen && shouldListenSfpsState;
        }
                && shouldListenBouncerState && shouldListenUdfpsState && !isFingerprintLockedOut()
                && shouldListenSideFpsState;

        maybeLogListenerModelData(
                new KeyguardFingerprintListenModel(
@@ -2690,7 +2685,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                    mKeyguardOccluded,
                    mOccludingAppRequestingFp,
                    mIsPrimaryUser,
                    shouldListenSfpsState,
                    shouldListenSideFpsState,
                    shouldListenForFingerprintAssistant,
                    mSwitchingUser,
                    isUdfps,
+4 −7
Original line number Diff line number Diff line
@@ -1161,7 +1161,10 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
    public void testStartsListeningForSfps_whenKeyguardIsVisible_ifRequireScreenOnToAuthEnabled()
            throws RemoteException {
        // SFPS supported and enrolled
        setup_SfpsProps();
        final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>();
        props.add(newFingerprintSensorPropertiesInternal(TYPE_POWER_BUTTON));
        when(mAuthController.getSfpsProps()).thenReturn(props);
        when(mAuthController.isSfpsEnrolled(anyInt())).thenReturn(true);

        // WHEN require screen on to auth is disabled, and keyguard is not awake
        when(mSecureSettings.getIntForUser(anyString(), anyInt(), anyInt())).thenReturn(0);
@@ -1200,12 +1203,6 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue();
    }

    private void setup_SfpsProps() {
        final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>();
        props.add(newFingerprintSensorPropertiesInternal(TYPE_POWER_BUTTON));
        when(mAuthController.getSfpsProps()).thenReturn(props);
        when(mAuthController.isSfpsEnrolled(anyInt())).thenReturn(true);
    }

    private FingerprintSensorPropertiesInternal newFingerprintSensorPropertiesInternal(
            @FingerprintSensorProperties.SensorType int sensorType) {