diff options
| author | 2023-04-18 12:10:29 +0000 | |
|---|---|---|
| committer | 2023-04-18 12:10:29 +0000 | |
| commit | 5526b81010b9af591146b630cd53746a0ffd6c10 (patch) | |
| tree | 8ad3b5d54f5bfafc035df021540d07c3a16651f7 | |
| parent | db7fb92a69785966ac731d6e43d5fa93e249bad7 (diff) | |
| parent | 002b09c340866966824b48467d1b42fc4c42d6fe (diff) | |
Merge "Update KUM usage of primaryUser to systemUser" into udc-dev
6 files changed, 42 insertions, 57 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardFaceListenModel.kt b/packages/SystemUI/src/com/android/keyguard/KeyguardFaceListenModel.kt index 5b0e29005d82..461d390fd477 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardFaceListenModel.kt +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardFaceListenModel.kt @@ -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", diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardFingerprintListenModel.kt b/packages/SystemUI/src/com/android/keyguard/KeyguardFingerprintListenModel.kt index b8c0ccbd8aaa..f2685c5200ad 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardFingerprintListenModel.kt +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardFingerprintListenModel.kt @@ -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", ) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index ea043763c5b9..10c08bc3e8b3 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -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)); diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepository.kt index 05ab01bf2b9a..dc5ac88472e4 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepository.kt @@ -347,11 +347,6 @@ constructor( "nonStrongBiometricIsAllowed", faceAuthLog ), - logAndObserve( - userRepository.selectedUserInfo.map { it.isPrimary }, - "userIsPrimaryUser", - faceAuthLog - ), ) .reduce(::and) .distinctUntilChanged() diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java index ed40eed54978..2962c14b813a 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java @@ -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() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepositoryTest.kt index a76d03b8ba93..ffc6ee2a5a31 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepositoryTest.kt @@ -72,7 +72,6 @@ import com.google.common.truth.Truth.assertThat import java.io.PrintWriter import java.io.StringWriter import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.launch import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestDispatcher import kotlinx.coroutines.test.TestScope @@ -542,14 +541,6 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() { } @Test - fun authenticateDoesNotRunWhenCurrentUserIsNotPrimary() = - testScope.runTest { - testGatingCheckForFaceAuth { - launch { fakeUserRepository.setSelectedUserInfo(secondaryUser) } - } - } - - @Test fun authenticateDoesNotRunWhenSecureCameraIsActive() = testScope.runTest { testGatingCheckForFaceAuth { |