Merge "Update KUM usage of primaryUser to systemUser" into udc-dev am: 5526b81010
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22599196 Change-Id: I409998d7d895f8b5b2e2e7198e61f41e29f203ff Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -41,10 +41,10 @@ data class KeyguardFaceListenModel(
|
|||||||
var listeningForFaceAssistant: Boolean = false,
|
var listeningForFaceAssistant: Boolean = false,
|
||||||
var occludingAppRequestingFaceAuth: Boolean = false,
|
var occludingAppRequestingFaceAuth: Boolean = false,
|
||||||
var postureAllowsListening: Boolean = false,
|
var postureAllowsListening: Boolean = false,
|
||||||
var primaryUser: Boolean = false,
|
|
||||||
var secureCameraLaunched: Boolean = false,
|
var secureCameraLaunched: Boolean = false,
|
||||||
var supportsDetect: Boolean = false,
|
var supportsDetect: Boolean = false,
|
||||||
var switchingUser: Boolean = false,
|
var switchingUser: Boolean = false,
|
||||||
|
var systemUser: Boolean = false,
|
||||||
var udfpsFingerDown: Boolean = false,
|
var udfpsFingerDown: Boolean = false,
|
||||||
var userNotTrustedOrDetectionIsNeeded: Boolean = false,
|
var userNotTrustedOrDetectionIsNeeded: Boolean = false,
|
||||||
) : KeyguardListenModel() {
|
) : KeyguardListenModel() {
|
||||||
@@ -69,11 +69,11 @@ data class KeyguardFaceListenModel(
|
|||||||
keyguardGoingAway.toString(),
|
keyguardGoingAway.toString(),
|
||||||
listeningForFaceAssistant.toString(),
|
listeningForFaceAssistant.toString(),
|
||||||
occludingAppRequestingFaceAuth.toString(),
|
occludingAppRequestingFaceAuth.toString(),
|
||||||
primaryUser.toString(),
|
|
||||||
postureAllowsListening.toString(),
|
postureAllowsListening.toString(),
|
||||||
secureCameraLaunched.toString(),
|
secureCameraLaunched.toString(),
|
||||||
supportsDetect.toString(),
|
supportsDetect.toString(),
|
||||||
switchingUser.toString(),
|
switchingUser.toString(),
|
||||||
|
systemUser.toString(),
|
||||||
alternateBouncerShowing.toString(),
|
alternateBouncerShowing.toString(),
|
||||||
udfpsFingerDown.toString(),
|
udfpsFingerDown.toString(),
|
||||||
userNotTrustedOrDetectionIsNeeded.toString(),
|
userNotTrustedOrDetectionIsNeeded.toString(),
|
||||||
@@ -109,12 +109,11 @@ data class KeyguardFaceListenModel(
|
|||||||
keyguardGoingAway = model.keyguardGoingAway
|
keyguardGoingAway = model.keyguardGoingAway
|
||||||
listeningForFaceAssistant = model.listeningForFaceAssistant
|
listeningForFaceAssistant = model.listeningForFaceAssistant
|
||||||
occludingAppRequestingFaceAuth = model.occludingAppRequestingFaceAuth
|
occludingAppRequestingFaceAuth = model.occludingAppRequestingFaceAuth
|
||||||
primaryUser = model.primaryUser
|
|
||||||
postureAllowsListening = model.postureAllowsListening
|
postureAllowsListening = model.postureAllowsListening
|
||||||
secureCameraLaunched = model.secureCameraLaunched
|
secureCameraLaunched = model.secureCameraLaunched
|
||||||
supportsDetect = model.supportsDetect
|
supportsDetect = model.supportsDetect
|
||||||
switchingUser = model.switchingUser
|
switchingUser = model.switchingUser
|
||||||
switchingUser = model.switchingUser
|
systemUser = model.systemUser
|
||||||
udfpsFingerDown = model.udfpsFingerDown
|
udfpsFingerDown = model.udfpsFingerDown
|
||||||
userNotTrustedOrDetectionIsNeeded = model.userNotTrustedOrDetectionIsNeeded
|
userNotTrustedOrDetectionIsNeeded = model.userNotTrustedOrDetectionIsNeeded
|
||||||
}
|
}
|
||||||
@@ -153,11 +152,11 @@ data class KeyguardFaceListenModel(
|
|||||||
"keyguardGoingAway",
|
"keyguardGoingAway",
|
||||||
"listeningForFaceAssistant",
|
"listeningForFaceAssistant",
|
||||||
"occludingAppRequestingFaceAuth",
|
"occludingAppRequestingFaceAuth",
|
||||||
"primaryUser",
|
|
||||||
"postureAllowsListening",
|
"postureAllowsListening",
|
||||||
"secureCameraLaunched",
|
"secureCameraLaunched",
|
||||||
"supportsDetect",
|
"supportsDetect",
|
||||||
"switchingUser",
|
"switchingUser",
|
||||||
|
"systemUser",
|
||||||
"udfpsBouncerShowing",
|
"udfpsBouncerShowing",
|
||||||
"udfpsFingerDown",
|
"udfpsFingerDown",
|
||||||
"userNotTrustedOrDetectionIsNeeded",
|
"userNotTrustedOrDetectionIsNeeded",
|
||||||
|
|||||||
@@ -41,11 +41,11 @@ data class KeyguardFingerprintListenModel(
|
|||||||
var keyguardIsVisible: Boolean = false,
|
var keyguardIsVisible: Boolean = false,
|
||||||
var keyguardOccluded: Boolean = false,
|
var keyguardOccluded: Boolean = false,
|
||||||
var occludingAppRequestingFp: Boolean = false,
|
var occludingAppRequestingFp: Boolean = false,
|
||||||
var primaryUser: Boolean = false,
|
|
||||||
var shouldListenSfpsState: Boolean = false,
|
var shouldListenSfpsState: Boolean = false,
|
||||||
var shouldListenForFingerprintAssistant: Boolean = false,
|
var shouldListenForFingerprintAssistant: Boolean = false,
|
||||||
var strongerAuthRequired: Boolean = false,
|
var strongerAuthRequired: Boolean = false,
|
||||||
var switchingUser: Boolean = false,
|
var switchingUser: Boolean = false,
|
||||||
|
var systemUser: Boolean = false,
|
||||||
var udfps: Boolean = false,
|
var udfps: Boolean = false,
|
||||||
var userDoesNotHaveTrust: Boolean = false,
|
var userDoesNotHaveTrust: Boolean = false,
|
||||||
) : KeyguardListenModel() {
|
) : KeyguardListenModel() {
|
||||||
@@ -72,11 +72,11 @@ data class KeyguardFingerprintListenModel(
|
|||||||
keyguardIsVisible.toString(),
|
keyguardIsVisible.toString(),
|
||||||
keyguardOccluded.toString(),
|
keyguardOccluded.toString(),
|
||||||
occludingAppRequestingFp.toString(),
|
occludingAppRequestingFp.toString(),
|
||||||
primaryUser.toString(),
|
|
||||||
shouldListenSfpsState.toString(),
|
shouldListenSfpsState.toString(),
|
||||||
shouldListenForFingerprintAssistant.toString(),
|
shouldListenForFingerprintAssistant.toString(),
|
||||||
strongerAuthRequired.toString(),
|
strongerAuthRequired.toString(),
|
||||||
switchingUser.toString(),
|
switchingUser.toString(),
|
||||||
|
systemUser.toString(),
|
||||||
udfps.toString(),
|
udfps.toString(),
|
||||||
userDoesNotHaveTrust.toString(),
|
userDoesNotHaveTrust.toString(),
|
||||||
)
|
)
|
||||||
@@ -112,11 +112,11 @@ data class KeyguardFingerprintListenModel(
|
|||||||
keyguardIsVisible = model.keyguardIsVisible
|
keyguardIsVisible = model.keyguardIsVisible
|
||||||
keyguardOccluded = model.keyguardOccluded
|
keyguardOccluded = model.keyguardOccluded
|
||||||
occludingAppRequestingFp = model.occludingAppRequestingFp
|
occludingAppRequestingFp = model.occludingAppRequestingFp
|
||||||
primaryUser = model.primaryUser
|
|
||||||
shouldListenSfpsState = model.shouldListenSfpsState
|
shouldListenSfpsState = model.shouldListenSfpsState
|
||||||
shouldListenForFingerprintAssistant = model.shouldListenForFingerprintAssistant
|
shouldListenForFingerprintAssistant = model.shouldListenForFingerprintAssistant
|
||||||
strongerAuthRequired = model.strongerAuthRequired
|
strongerAuthRequired = model.strongerAuthRequired
|
||||||
switchingUser = model.switchingUser
|
switchingUser = model.switchingUser
|
||||||
|
systemUser = model.systemUser
|
||||||
udfps = model.udfps
|
udfps = model.udfps
|
||||||
userDoesNotHaveTrust = model.userDoesNotHaveTrust
|
userDoesNotHaveTrust = model.userDoesNotHaveTrust
|
||||||
}
|
}
|
||||||
@@ -158,11 +158,11 @@ data class KeyguardFingerprintListenModel(
|
|||||||
"keyguardIsVisible",
|
"keyguardIsVisible",
|
||||||
"keyguardOccluded",
|
"keyguardOccluded",
|
||||||
"occludingAppRequestingFp",
|
"occludingAppRequestingFp",
|
||||||
"primaryUser",
|
|
||||||
"shouldListenSidFingerprintState",
|
"shouldListenSidFingerprintState",
|
||||||
"shouldListenForFingerprintAssistant",
|
"shouldListenForFingerprintAssistant",
|
||||||
"strongAuthRequired",
|
"strongAuthRequired",
|
||||||
"switchingUser",
|
"switchingUser",
|
||||||
|
"systemUser",
|
||||||
"underDisplayFingerprint",
|
"underDisplayFingerprint",
|
||||||
"userDoesNotHaveTrust",
|
"userDoesNotHaveTrust",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final UserTracker mUserTracker;
|
private final UserTracker mUserTracker;
|
||||||
private final KeyguardUpdateMonitorLogger mLogger;
|
private final KeyguardUpdateMonitorLogger mLogger;
|
||||||
private final boolean mIsPrimaryUser;
|
private final boolean mIsSystemUser;
|
||||||
private final AuthController mAuthController;
|
private final AuthController mAuthController;
|
||||||
private final UiEventLogger mUiEventLogger;
|
private final UiEventLogger mUiEventLogger;
|
||||||
private final Set<Integer> mFaceAcquiredInfoIgnoreList;
|
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);
|
updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE, FACE_AUTH_UPDATED_ON_KEYGUARD_INIT);
|
||||||
|
|
||||||
TaskStackChangeListeners.getInstance().registerTaskStackListener(mTaskStackListener);
|
TaskStackChangeListeners.getInstance().registerTaskStackListener(mTaskStackListener);
|
||||||
mIsPrimaryUser = mUserManager.isPrimaryUser();
|
mIsSystemUser = mUserManager.isSystemUser();
|
||||||
int user = mUserTracker.getUserId();
|
int user = mUserTracker.getUserId();
|
||||||
mUserIsUnlocked.put(user, mUserManager.isUserUnlocked(user));
|
mUserIsUnlocked.put(user, mUserManager.isUserUnlocked(user));
|
||||||
mLogoutEnabled = mDevicePolicyManager.isLogoutEnabled();
|
mLogoutEnabled = mDevicePolicyManager.isLogoutEnabled();
|
||||||
@@ -2968,7 +2968,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
|| (mKeyguardOccluded && userDoesNotHaveTrust && mKeyguardShowing
|
|| (mKeyguardOccluded && userDoesNotHaveTrust && mKeyguardShowing
|
||||||
&& (mOccludingAppRequestingFp || isUdfps || mAlternateBouncerShowing));
|
&& (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.
|
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
|
||||||
final boolean biometricEnabledForUser = mBiometricEnabledForUser.get(user);
|
final boolean biometricEnabledForUser = mBiometricEnabledForUser.get(user);
|
||||||
final boolean userCanSkipBouncer = getUserCanSkipBouncer(user);
|
final boolean userCanSkipBouncer = getUserCanSkipBouncer(user);
|
||||||
@@ -2977,7 +2977,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
!mSwitchingUser
|
!mSwitchingUser
|
||||||
&& !fingerprintDisabledForUser
|
&& !fingerprintDisabledForUser
|
||||||
&& (!mKeyguardGoingAway || !mDeviceInteractive)
|
&& (!mKeyguardGoingAway || !mDeviceInteractive)
|
||||||
&& mIsPrimaryUser
|
&& mIsSystemUser
|
||||||
&& biometricEnabledForUser
|
&& biometricEnabledForUser
|
||||||
&& !isUserInLockdown(user);
|
&& !isUserInLockdown(user);
|
||||||
final boolean strongerAuthRequired = !isUnlockingWithFingerprintAllowed();
|
final boolean strongerAuthRequired = !isUnlockingWithFingerprintAllowed();
|
||||||
@@ -3021,11 +3021,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
isKeyguardVisible(),
|
isKeyguardVisible(),
|
||||||
mKeyguardOccluded,
|
mKeyguardOccluded,
|
||||||
mOccludingAppRequestingFp,
|
mOccludingAppRequestingFp,
|
||||||
mIsPrimaryUser,
|
|
||||||
shouldListenSideFpsState,
|
shouldListenSideFpsState,
|
||||||
shouldListenForFingerprintAssistant,
|
shouldListenForFingerprintAssistant,
|
||||||
strongerAuthRequired,
|
strongerAuthRequired,
|
||||||
mSwitchingUser,
|
mSwitchingUser,
|
||||||
|
mIsSystemUser,
|
||||||
isUdfps,
|
isUdfps,
|
||||||
userDoesNotHaveTrust));
|
userDoesNotHaveTrust));
|
||||||
|
|
||||||
@@ -3070,7 +3070,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
final boolean shouldListenForFaceAssistant = shouldListenForFaceAssistant();
|
final boolean shouldListenForFaceAssistant = shouldListenForFaceAssistant();
|
||||||
final boolean isUdfpsFingerDown = mAuthController.isUdfpsFingerDown();
|
final boolean isUdfpsFingerDown = mAuthController.isUdfpsFingerDown();
|
||||||
final boolean isPostureAllowedForFaceAuth = doesPostureAllowFaceAuth(mPostureState);
|
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.
|
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
|
||||||
final boolean shouldListen =
|
final boolean shouldListen =
|
||||||
(mPrimaryBouncerFullyShown
|
(mPrimaryBouncerFullyShown
|
||||||
@@ -3082,7 +3082,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
|| mAlternateBouncerShowing)
|
|| mAlternateBouncerShowing)
|
||||||
&& !mSwitchingUser && !faceDisabledForUser && userNotTrustedOrDetectionIsNeeded
|
&& !mSwitchingUser && !faceDisabledForUser && userNotTrustedOrDetectionIsNeeded
|
||||||
&& !mKeyguardGoingAway && biometricEnabledForUser
|
&& !mKeyguardGoingAway && biometricEnabledForUser
|
||||||
&& faceAuthAllowedOrDetectionIsNeeded && mIsPrimaryUser
|
&& faceAuthAllowedOrDetectionIsNeeded && mIsSystemUser
|
||||||
&& (!mSecureCameraLaunched || mAlternateBouncerShowing)
|
&& (!mSecureCameraLaunched || mAlternateBouncerShowing)
|
||||||
&& faceAndFpNotAuthenticated
|
&& faceAndFpNotAuthenticated
|
||||||
&& !mGoingToSleep
|
&& !mGoingToSleep
|
||||||
@@ -3108,10 +3108,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
shouldListenForFaceAssistant,
|
shouldListenForFaceAssistant,
|
||||||
mOccludingAppRequestingFace,
|
mOccludingAppRequestingFace,
|
||||||
isPostureAllowedForFaceAuth,
|
isPostureAllowedForFaceAuth,
|
||||||
mIsPrimaryUser,
|
|
||||||
mSecureCameraLaunched,
|
mSecureCameraLaunched,
|
||||||
supportsDetect,
|
supportsDetect,
|
||||||
mSwitchingUser,
|
mSwitchingUser,
|
||||||
|
mIsSystemUser,
|
||||||
isUdfpsFingerDown,
|
isUdfpsFingerDown,
|
||||||
userNotTrustedOrDetectionIsNeeded));
|
userNotTrustedOrDetectionIsNeeded));
|
||||||
|
|
||||||
|
|||||||
@@ -347,11 +347,6 @@ constructor(
|
|||||||
"nonStrongBiometricIsAllowed",
|
"nonStrongBiometricIsAllowed",
|
||||||
faceAuthLog
|
faceAuthLog
|
||||||
),
|
),
|
||||||
logAndObserve(
|
|
||||||
userRepository.selectedUserInfo.map { it.isPrimary },
|
|
||||||
"userIsPrimaryUser",
|
|
||||||
faceAuthLog
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.reduce(::and)
|
.reduce(::and)
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
when(mSessionTracker.getSessionId(SESSION_KEYGUARD)).thenReturn(mKeyguardInstanceId);
|
when(mSessionTracker.getSessionId(SESSION_KEYGUARD)).thenReturn(mKeyguardInstanceId);
|
||||||
|
|
||||||
when(mUserManager.isUserUnlocked(anyInt())).thenReturn(true);
|
when(mUserManager.isUserUnlocked(anyInt())).thenReturn(true);
|
||||||
when(mUserManager.isPrimaryUser()).thenReturn(true);
|
currentUserIsSystem();
|
||||||
when(mStrongAuthTracker.getStub()).thenReturn(mock(IStrongAuthTracker.Stub.class));
|
when(mStrongAuthTracker.getStub()).thenReturn(mock(IStrongAuthTracker.Stub.class));
|
||||||
when(mStrongAuthTracker
|
when(mStrongAuthTracker
|
||||||
.isUnlockingWithBiometricAllowed(anyBoolean() /* isClass3Biometric */))
|
.isUnlockingWithBiometricAllowed(anyBoolean() /* isClass3Biometric */))
|
||||||
@@ -960,7 +960,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
public void requestFaceAuth_whenFaceAuthWasStarted_returnsTrue() throws RemoteException {
|
public void requestFaceAuth_whenFaceAuthWasStarted_returnsTrue() throws RemoteException {
|
||||||
// This satisfies all the preconditions to run face auth.
|
// This satisfies all the preconditions to run face auth.
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -1467,7 +1467,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// Preconditions for sfps auth to run
|
// Preconditions for sfps auth to run
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -1503,7 +1503,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// GIVEN Preconditions for sfps auth to run
|
// GIVEN Preconditions for sfps auth to run
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -1532,7 +1532,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// GIVEN Preconditions for sfps auth to run
|
// GIVEN Preconditions for sfps auth to run
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -1684,7 +1684,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
// Face auth should run when the following is true.
|
// Face auth should run when the following is true.
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
occludingAppRequestsFaceAuth();
|
occludingAppRequestsFaceAuth();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
primaryAuthNotRequiredByStrongAuthTracker();
|
primaryAuthNotRequiredByStrongAuthTracker();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
@@ -1705,7 +1705,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
// Face auth should run when the following is true.
|
// Face auth should run when the following is true.
|
||||||
bouncerFullyVisibleAndNotGoingToSleep();
|
bouncerFullyVisibleAndNotGoingToSleep();
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
primaryAuthNotRequiredByStrongAuthTracker();
|
primaryAuthNotRequiredByStrongAuthTracker();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
@@ -1728,7 +1728,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
// Face auth should run when the following is true.
|
// Face auth should run when the following is true.
|
||||||
bouncerFullyVisibleAndNotGoingToSleep();
|
bouncerFullyVisibleAndNotGoingToSleep();
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
primaryAuthNotRequiredByStrongAuthTracker();
|
primaryAuthNotRequiredByStrongAuthTracker();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
@@ -1749,7 +1749,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
public void testShouldListenForFace_whenUserIsNotPrimary_returnsFalse() throws RemoteException {
|
public void testShouldListenForFace_whenUserIsNotPrimary_returnsFalse() throws RemoteException {
|
||||||
cleanupKeyguardUpdateMonitor();
|
cleanupKeyguardUpdateMonitor();
|
||||||
// This disables face auth
|
// This disables face auth
|
||||||
when(mUserManager.isPrimaryUser()).thenReturn(false);
|
when(mUserManager.isSystemUser()).thenReturn(false);
|
||||||
mKeyguardUpdateMonitor =
|
mKeyguardUpdateMonitor =
|
||||||
new TestableKeyguardUpdateMonitor(mContext);
|
new TestableKeyguardUpdateMonitor(mContext);
|
||||||
|
|
||||||
@@ -1773,7 +1773,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
// Face auth should run when the following is true.
|
// Face auth should run when the following is true.
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
bouncerFullyVisibleAndNotGoingToSleep();
|
bouncerFullyVisibleAndNotGoingToSleep();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
@@ -1791,7 +1791,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
bouncerFullyVisibleAndNotGoingToSleep();
|
bouncerFullyVisibleAndNotGoingToSleep();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -1813,7 +1813,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
// Face auth should run when the following is true.
|
// Face auth should run when the following is true.
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
bouncerFullyVisibleAndNotGoingToSleep();
|
bouncerFullyVisibleAndNotGoingToSleep();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -1833,7 +1833,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
bouncerFullyVisibleAndNotGoingToSleep();
|
bouncerFullyVisibleAndNotGoingToSleep();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -1854,7 +1854,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
// Face auth should run when the following is true.
|
// Face auth should run when the following is true.
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
bouncerFullyVisibleAndNotGoingToSleep();
|
bouncerFullyVisibleAndNotGoingToSleep();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -1876,7 +1876,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
// Face auth should run when the following is true.
|
// Face auth should run when the following is true.
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -1896,7 +1896,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
// Face auth should run when the following is true.
|
// Face auth should run when the following is true.
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -1915,7 +1915,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
public void testShouldListenForFace_whenKeyguardIsAwake_returnsTrue() throws RemoteException {
|
public void testShouldListenForFace_whenKeyguardIsAwake_returnsTrue() throws RemoteException {
|
||||||
// Preconditions for face auth to run
|
// Preconditions for face auth to run
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -1940,7 +1940,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
public void testShouldListenForFace_whenUdfpsFingerDown_returnsTrue() throws RemoteException {
|
public void testShouldListenForFace_whenUdfpsFingerDown_returnsTrue() throws RemoteException {
|
||||||
// Preconditions for face auth to run
|
// Preconditions for face auth to run
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -1959,7 +1959,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
// Preconditions for face auth to run
|
// Preconditions for face auth to run
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -1977,7 +1977,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
// Preconditions for face auth to run
|
// Preconditions for face auth to run
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -2002,7 +2002,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
// Preconditions for face auth to run
|
// Preconditions for face auth to run
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -2324,7 +2324,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
bouncerFullyVisibleAndNotGoingToSleep();
|
bouncerFullyVisibleAndNotGoingToSleep();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -2455,7 +2455,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
mKeyguardUpdateMonitor.mConfigFaceAuthSupportedPosture = DEVICE_POSTURE_CLOSED;
|
mKeyguardUpdateMonitor.mConfigFaceAuthSupportedPosture = DEVICE_POSTURE_CLOSED;
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
bouncerFullyVisibleAndNotGoingToSleep();
|
bouncerFullyVisibleAndNotGoingToSleep();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -2479,7 +2479,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
mKeyguardUpdateMonitor.mConfigFaceAuthSupportedPosture = DEVICE_POSTURE_UNKNOWN;
|
mKeyguardUpdateMonitor.mConfigFaceAuthSupportedPosture = DEVICE_POSTURE_UNKNOWN;
|
||||||
keyguardNotGoingAway();
|
keyguardNotGoingAway();
|
||||||
bouncerFullyVisibleAndNotGoingToSleep();
|
bouncerFullyVisibleAndNotGoingToSleep();
|
||||||
currentUserIsPrimary();
|
currentUserIsSystem();
|
||||||
currentUserDoesNotHaveTrust();
|
currentUserDoesNotHaveTrust();
|
||||||
biometricsNotDisabledThroughDevicePolicyManager();
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
biometricsEnabledForCurrentUser();
|
biometricsEnabledForCurrentUser();
|
||||||
@@ -2877,8 +2877,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
new FaceManager.AuthenticationResult(null, null, mCurrentUserId, false));
|
new FaceManager.AuthenticationResult(null, null, mCurrentUserId, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void currentUserIsPrimary() {
|
private void currentUserIsSystem() {
|
||||||
when(mUserManager.isPrimaryUser()).thenReturn(true);
|
when(mUserManager.isSystemUser()).thenReturn(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void biometricsNotDisabledThroughDevicePolicyManager() {
|
private void biometricsNotDisabledThroughDevicePolicyManager() {
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ import com.google.common.truth.Truth.assertThat
|
|||||||
import java.io.PrintWriter
|
import java.io.PrintWriter
|
||||||
import java.io.StringWriter
|
import java.io.StringWriter
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import kotlinx.coroutines.test.StandardTestDispatcher
|
import kotlinx.coroutines.test.StandardTestDispatcher
|
||||||
import kotlinx.coroutines.test.TestDispatcher
|
import kotlinx.coroutines.test.TestDispatcher
|
||||||
import kotlinx.coroutines.test.TestScope
|
import kotlinx.coroutines.test.TestScope
|
||||||
@@ -541,14 +540,6 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun authenticateDoesNotRunWhenCurrentUserIsNotPrimary() =
|
|
||||||
testScope.runTest {
|
|
||||||
testGatingCheckForFaceAuth {
|
|
||||||
launch { fakeUserRepository.setSelectedUserInfo(secondaryUser) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun authenticateDoesNotRunWhenSecureCameraIsActive() =
|
fun authenticateDoesNotRunWhenSecureCameraIsActive() =
|
||||||
testScope.runTest {
|
testScope.runTest {
|
||||||
|
|||||||
Reference in New Issue
Block a user