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

Commit 333bb988 authored by Beverly Tai's avatar Beverly Tai Committed by Automerger Merge Worker
Browse files

Merge "Update KUM usage of primaryUser to systemUser" into udc-dev am: 5526b810 am: aac98e33

parents b36c51f2 aac98e33
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -41,10 +41,10 @@ data class KeyguardFaceListenModel(
    var listeningForFaceAssistant: Boolean = false,
    var occludingAppRequestingFaceAuth: Boolean = false,
    var postureAllowsListening: Boolean = false,
    var primaryUser: Boolean = false,
    var secureCameraLaunched: Boolean = false,
    var supportsDetect: Boolean = false,
    var switchingUser: Boolean = false,
    var systemUser: Boolean = false,
    var udfpsFingerDown: Boolean = false,
    var userNotTrustedOrDetectionIsNeeded: Boolean = false,
) : KeyguardListenModel() {
@@ -69,11 +69,11 @@ data class KeyguardFaceListenModel(
            keyguardGoingAway.toString(),
            listeningForFaceAssistant.toString(),
            occludingAppRequestingFaceAuth.toString(),
            primaryUser.toString(),
            postureAllowsListening.toString(),
            secureCameraLaunched.toString(),
            supportsDetect.toString(),
            switchingUser.toString(),
            systemUser.toString(),
            alternateBouncerShowing.toString(),
            udfpsFingerDown.toString(),
            userNotTrustedOrDetectionIsNeeded.toString(),
@@ -109,12 +109,11 @@ data class KeyguardFaceListenModel(
                keyguardGoingAway = model.keyguardGoingAway
                listeningForFaceAssistant = model.listeningForFaceAssistant
                occludingAppRequestingFaceAuth = model.occludingAppRequestingFaceAuth
                primaryUser = model.primaryUser
                postureAllowsListening = model.postureAllowsListening
                secureCameraLaunched = model.secureCameraLaunched
                supportsDetect = model.supportsDetect
                switchingUser = model.switchingUser
                switchingUser = model.switchingUser
                systemUser = model.systemUser
                udfpsFingerDown = model.udfpsFingerDown
                userNotTrustedOrDetectionIsNeeded = model.userNotTrustedOrDetectionIsNeeded
            }
@@ -153,11 +152,11 @@ data class KeyguardFaceListenModel(
                "keyguardGoingAway",
                "listeningForFaceAssistant",
                "occludingAppRequestingFaceAuth",
                "primaryUser",
                "postureAllowsListening",
                "secureCameraLaunched",
                "supportsDetect",
                "switchingUser",
                "systemUser",
                "udfpsBouncerShowing",
                "udfpsFingerDown",
                "userNotTrustedOrDetectionIsNeeded",
+4 −4
Original line number Diff line number Diff line
@@ -41,11 +41,11 @@ data class KeyguardFingerprintListenModel(
    var keyguardIsVisible: Boolean = false,
    var keyguardOccluded: Boolean = false,
    var occludingAppRequestingFp: Boolean = false,
    var primaryUser: Boolean = false,
    var shouldListenSfpsState: Boolean = false,
    var shouldListenForFingerprintAssistant: Boolean = false,
    var strongerAuthRequired: Boolean = false,
    var switchingUser: Boolean = false,
    var systemUser: Boolean = false,
    var udfps: Boolean = false,
    var userDoesNotHaveTrust: Boolean = false,
) : KeyguardListenModel() {
@@ -72,11 +72,11 @@ data class KeyguardFingerprintListenModel(
            keyguardIsVisible.toString(),
            keyguardOccluded.toString(),
            occludingAppRequestingFp.toString(),
            primaryUser.toString(),
            shouldListenSfpsState.toString(),
            shouldListenForFingerprintAssistant.toString(),
            strongerAuthRequired.toString(),
            switchingUser.toString(),
            systemUser.toString(),
            udfps.toString(),
            userDoesNotHaveTrust.toString(),
        )
@@ -112,11 +112,11 @@ data class KeyguardFingerprintListenModel(
                keyguardIsVisible = model.keyguardIsVisible
                keyguardOccluded = model.keyguardOccluded
                occludingAppRequestingFp = model.occludingAppRequestingFp
                primaryUser = model.primaryUser
                shouldListenSfpsState = model.shouldListenSfpsState
                shouldListenForFingerprintAssistant = model.shouldListenForFingerprintAssistant
                strongerAuthRequired = model.strongerAuthRequired
                switchingUser = model.switchingUser
                systemUser = model.systemUser
                udfps = model.udfps
                userDoesNotHaveTrust = model.userDoesNotHaveTrust
            }
@@ -158,11 +158,11 @@ data class KeyguardFingerprintListenModel(
                "keyguardIsVisible",
                "keyguardOccluded",
                "occludingAppRequestingFp",
                "primaryUser",
                "shouldListenSidFingerprintState",
                "shouldListenForFingerprintAssistant",
                "strongAuthRequired",
                "switchingUser",
                "systemUser",
                "underDisplayFingerprint",
                "userDoesNotHaveTrust",
            )
+8 −8
Original line number Diff line number Diff line
@@ -297,7 +297,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    private final Context mContext;
    private final UserTracker mUserTracker;
    private final KeyguardUpdateMonitorLogger mLogger;
    private final boolean mIsPrimaryUser;
    private final boolean mIsSystemUser;
    private final AuthController mAuthController;
    private final UiEventLogger mUiEventLogger;
    private final Set<Integer> mFaceAcquiredInfoIgnoreList;
@@ -2522,7 +2522,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE, FACE_AUTH_UPDATED_ON_KEYGUARD_INIT);

        TaskStackChangeListeners.getInstance().registerTaskStackListener(mTaskStackListener);
        mIsPrimaryUser = mUserManager.isPrimaryUser();
        mIsSystemUser = mUserManager.isSystemUser();
        int user = mUserTracker.getUserId();
        mUserIsUnlocked.put(user, mUserManager.isUserUnlocked(user));
        mLogoutEnabled = mDevicePolicyManager.isLogoutEnabled();
@@ -2968,7 +2968,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                        || (mKeyguardOccluded && userDoesNotHaveTrust && mKeyguardShowing
                            && (mOccludingAppRequestingFp || isUdfps || mAlternateBouncerShowing));

        // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
        // Only listen if this KeyguardUpdateMonitor belongs to the system user. There is an
        // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
        final boolean biometricEnabledForUser = mBiometricEnabledForUser.get(user);
        final boolean userCanSkipBouncer = getUserCanSkipBouncer(user);
@@ -2977,7 +2977,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                !mSwitchingUser
                        && !fingerprintDisabledForUser
                        && (!mKeyguardGoingAway || !mDeviceInteractive)
                        && mIsPrimaryUser
                        && mIsSystemUser
                        && biometricEnabledForUser
                        && !isUserInLockdown(user);
        final boolean strongerAuthRequired = !isUnlockingWithFingerprintAllowed();
@@ -3021,11 +3021,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                    isKeyguardVisible(),
                    mKeyguardOccluded,
                    mOccludingAppRequestingFp,
                    mIsPrimaryUser,
                    shouldListenSideFpsState,
                    shouldListenForFingerprintAssistant,
                    strongerAuthRequired,
                    mSwitchingUser,
                    mIsSystemUser,
                    isUdfps,
                    userDoesNotHaveTrust));

@@ -3070,7 +3070,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        final boolean shouldListenForFaceAssistant = shouldListenForFaceAssistant();
        final boolean isUdfpsFingerDown = mAuthController.isUdfpsFingerDown();
        final boolean isPostureAllowedForFaceAuth = doesPostureAllowFaceAuth(mPostureState);
        // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
        // Only listen if this KeyguardUpdateMonitor belongs to the system user. There is an
        // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
        final boolean shouldListen =
                (mPrimaryBouncerFullyShown
@@ -3082,7 +3082,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                        || mAlternateBouncerShowing)
                && !mSwitchingUser && !faceDisabledForUser && userNotTrustedOrDetectionIsNeeded
                && !mKeyguardGoingAway && biometricEnabledForUser
                && faceAuthAllowedOrDetectionIsNeeded && mIsPrimaryUser
                && faceAuthAllowedOrDetectionIsNeeded && mIsSystemUser
                && (!mSecureCameraLaunched || mAlternateBouncerShowing)
                && faceAndFpNotAuthenticated
                && !mGoingToSleep
@@ -3108,10 +3108,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                    shouldListenForFaceAssistant,
                    mOccludingAppRequestingFace,
                    isPostureAllowedForFaceAuth,
                    mIsPrimaryUser,
                    mSecureCameraLaunched,
                    supportsDetect,
                    mSwitchingUser,
                    mIsSystemUser,
                    isUdfpsFingerDown,
                    userNotTrustedOrDetectionIsNeeded));

+0 −5
Original line number Diff line number Diff line
@@ -347,11 +347,6 @@ constructor(
                    "nonStrongBiometricIsAllowed",
                    faceAuthLog
                ),
                logAndObserve(
                    userRepository.selectedUserInfo.map { it.isPrimary },
                    "userIsPrimaryUser",
                    faceAuthLog
                ),
            )
            .reduce(::and)
            .distinctUntilChanged()
+26 −26
Original line number Diff line number Diff line
@@ -291,7 +291,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        when(mSessionTracker.getSessionId(SESSION_KEYGUARD)).thenReturn(mKeyguardInstanceId);

        when(mUserManager.isUserUnlocked(anyInt())).thenReturn(true);
        when(mUserManager.isPrimaryUser()).thenReturn(true);
        currentUserIsSystem();
        when(mStrongAuthTracker.getStub()).thenReturn(mock(IStrongAuthTracker.Stub.class));
        when(mStrongAuthTracker
                .isUnlockingWithBiometricAllowed(anyBoolean() /* isClass3Biometric */))
@@ -960,7 +960,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
    public void requestFaceAuth_whenFaceAuthWasStarted_returnsTrue() throws RemoteException {
        // This satisfies all the preconditions to run face auth.
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -1467,7 +1467,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {

        // Preconditions for sfps auth to run
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -1503,7 +1503,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {

        // GIVEN Preconditions for sfps auth to run
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -1532,7 +1532,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {

        // GIVEN Preconditions for sfps auth to run
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -1684,7 +1684,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        // Face auth should run when the following is true.
        keyguardNotGoingAway();
        occludingAppRequestsFaceAuth();
        currentUserIsPrimary();
        currentUserIsSystem();
        primaryAuthNotRequiredByStrongAuthTracker();
        biometricsEnabledForCurrentUser();
        currentUserDoesNotHaveTrust();
@@ -1705,7 +1705,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        // Face auth should run when the following is true.
        bouncerFullyVisibleAndNotGoingToSleep();
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserIsSystem();
        primaryAuthNotRequiredByStrongAuthTracker();
        biometricsEnabledForCurrentUser();
        currentUserDoesNotHaveTrust();
@@ -1728,7 +1728,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        // Face auth should run when the following is true.
        bouncerFullyVisibleAndNotGoingToSleep();
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserIsSystem();
        primaryAuthNotRequiredByStrongAuthTracker();
        biometricsEnabledForCurrentUser();
        currentUserDoesNotHaveTrust();
@@ -1749,7 +1749,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
    public void testShouldListenForFace_whenUserIsNotPrimary_returnsFalse() throws RemoteException {
        cleanupKeyguardUpdateMonitor();
        // This disables face auth
        when(mUserManager.isPrimaryUser()).thenReturn(false);
        when(mUserManager.isSystemUser()).thenReturn(false);
        mKeyguardUpdateMonitor =
                new TestableKeyguardUpdateMonitor(mContext);

@@ -1773,7 +1773,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        // Face auth should run when the following is true.
        keyguardNotGoingAway();
        bouncerFullyVisibleAndNotGoingToSleep();
        currentUserIsPrimary();
        currentUserIsSystem();
        biometricsEnabledForCurrentUser();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
@@ -1791,7 +1791,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
            throws RemoteException {
        keyguardNotGoingAway();
        bouncerFullyVisibleAndNotGoingToSleep();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -1813,7 +1813,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        // Face auth should run when the following is true.
        keyguardNotGoingAway();
        bouncerFullyVisibleAndNotGoingToSleep();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -1833,7 +1833,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
            throws RemoteException {
        keyguardNotGoingAway();
        bouncerFullyVisibleAndNotGoingToSleep();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -1854,7 +1854,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        // Face auth should run when the following is true.
        keyguardNotGoingAway();
        bouncerFullyVisibleAndNotGoingToSleep();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -1876,7 +1876,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
            throws RemoteException {
        // Face auth should run when the following is true.
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -1896,7 +1896,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
            throws RemoteException {
        // Face auth should run when the following is true.
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -1915,7 +1915,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
    public void testShouldListenForFace_whenKeyguardIsAwake_returnsTrue() throws RemoteException {
        // Preconditions for face auth to run
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -1940,7 +1940,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
    public void testShouldListenForFace_whenUdfpsFingerDown_returnsTrue() throws RemoteException {
        // Preconditions for face auth to run
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -1959,7 +1959,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
            throws RemoteException {
        // Preconditions for face auth to run
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -1977,7 +1977,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
            throws RemoteException {
        // Preconditions for face auth to run
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -2002,7 +2002,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
            throws RemoteException {
        // Preconditions for face auth to run
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -2324,7 +2324,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
            throws RemoteException {
        keyguardNotGoingAway();
        bouncerFullyVisibleAndNotGoingToSleep();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -2455,7 +2455,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        mKeyguardUpdateMonitor.mConfigFaceAuthSupportedPosture = DEVICE_POSTURE_CLOSED;
        keyguardNotGoingAway();
        bouncerFullyVisibleAndNotGoingToSleep();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -2479,7 +2479,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        mKeyguardUpdateMonitor.mConfigFaceAuthSupportedPosture = DEVICE_POSTURE_UNKNOWN;
        keyguardNotGoingAway();
        bouncerFullyVisibleAndNotGoingToSleep();
        currentUserIsPrimary();
        currentUserIsSystem();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
@@ -2877,8 +2877,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
                        new FaceManager.AuthenticationResult(null, null, mCurrentUserId, false));
    }

    private void currentUserIsPrimary() {
        when(mUserManager.isPrimaryUser()).thenReturn(true);
    private void currentUserIsSystem() {
        when(mUserManager.isSystemUser()).thenReturn(true);
    }

    private void biometricsNotDisabledThroughDevicePolicyManager() {
Loading