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

Commit 2a28fcc9 authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Update udfps states on enrollment changes

In case there's a delay between onAllAuthenticatorsRegistered
and onEnrollmentChanged

Test: atest KeyguardUpdateMonitorTest
Test: manually add delays to AuthController#onAllAuthenticatorsRegistered
  and #onEnrollmentsChanged and check that UDFPS still works after the
  delay on the lock screen and AOD
Fixes: 205670174
Change-Id: Id9a20f466750fa506b7a1d95d5fe764bef27de41
parent 3695613b
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -102,7 +102,6 @@ import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;
@@ -323,7 +322,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    private boolean mLockIconPressed;
    private int mActiveMobileDataSubscription = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
    private final Executor mBackgroundExecutor;
    private int mLockScreenMode;

    /**
     * Short delay before restarting fingerprint authentication after a successful try. This should
@@ -1736,11 +1734,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
            DumpManager dumpManager,
            RingerModeTracker ringerModeTracker,
            @Background Executor backgroundExecutor,
            @Main Executor mainExecutor,
            StatusBarStateController statusBarStateController,
            LockPatternUtils lockPatternUtils,
            AuthController authController,
            TelephonyListenerManager telephonyListenerManager,
            FeatureFlags featureFlags,
            InteractionJankMonitor interactionJankMonitor,
            LatencyTracker latencyTracker) {
        mContext = context;
@@ -1966,6 +1964,17 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
            mBiometricManager.registerEnabledOnKeyguardCallback(mBiometricEnabledCallback);
        }

        // in case authenticators aren't registered yet at this point:
        mAuthController.addCallback(new AuthController.Callback() {
            @Override
            public void onAllAuthenticatorsRegistered() {
            }

            @Override
            public void onEnrollmentsChanged() {
                mainExecutor.execute(() -> updateBiometricListeningState());
            }
        });
        updateBiometricListeningState();
        if (mFpm != null) {
            mFpm.addLockoutResetCallback(mFingerprintLockoutResetCallback);
@@ -2043,7 +2052,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab

    /**
     * @return if udfps is available on this device. will return true even if the user hasn't
     * enrolled udfps.
     * enrolled udfps. This may be false if called before onAllAuthenticatorsRegistered.
     */
    public boolean isUdfpsAvailable() {
        return mAuthController.getUdfpsProps() != null
@@ -2092,7 +2101,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
            return;
        }

        // TODO: Add support for multiple fingerprint sensors, b/173730729
        updateUdfpsEnrolled(getCurrentUser());
        final boolean shouldListenForFingerprint = shouldListenForFingerprint(isUdfpsEnrolled());
        final boolean runningOrRestarting = mFingerprintRunningState == BIOMETRIC_STATE_RUNNING
+14 −5
Original line number Diff line number Diff line
@@ -695,11 +695,20 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
    private final AuthController.Callback mAuthControllerCallback = new AuthController.Callback() {
        @Override
        public void onAllAuthenticatorsRegistered() {
            updateUdfpsConfig();
        }

        @Override
        public void onEnrollmentsChanged() {
            updateUdfpsConfig();
        }
    };

    private void updateUdfpsConfig() {
        // must be called from the main thread since it may update the views
        mExecutor.execute(() -> {
            updateIsUdfpsEnrolled();
            updateConfiguration();
        });
    }
    };
}
+10 −0
Original line number Diff line number Diff line
@@ -142,6 +142,10 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
                    mUdfpsEnrolledForUser.put(userId, hasEnrollments);
                }
            }

            for (Callback cb : mCallbacks) {
                cb.onEnrollmentsChanged();
            }
        }
    };

@@ -844,5 +848,11 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
         * registered before this call, this callback will never be triggered.
         */
        void onAllAuthenticatorsRegistered();

        /**
         * Called when UDFPS enrollments have changed. This is called after boot and on changes to
         * enrollment.
         */
        void onEnrollmentsChanged();
    }
}
+10 −4
Original line number Diff line number Diff line
@@ -292,11 +292,17 @@ class AuthRippleController @Inject constructor(
            }
        }

    private val authControllerCallback = AuthController.Callback {
    private val authControllerCallback =
        object : AuthController.Callback {
            override fun onAllAuthenticatorsRegistered() {
                updateSensorLocation()
                updateUdfpsDependentParams()
            }

            override fun onEnrollmentsChanged() {
            }
        }

    private fun updateUdfpsDependentParams() {
        authController.udfpsProps?.let {
            if (it.size > 0) {
+5 −0
Original line number Diff line number Diff line
@@ -107,6 +107,11 @@ public class DozeScreenState implements DozeMachine.Part {
                public void onAllAuthenticatorsRegistered() {
                    updateUdfpsController();
                }

                @Override
                public void onEnrollmentsChanged() {
                    updateUdfpsController();
                }
            });
        }
    }
Loading