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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20346390

Change-Id: I4bbe48cbebba6453a648ca6a29b20dbda9c9f80b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Joshua Mccloskey
2022-11-03 02:39:29 +00:00
committed by Automerger Merge Worker
2 changed files with 29 additions and 37 deletions

View File

@@ -400,6 +400,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
protected Handler getHandler() { protected Handler getHandler() {
return mHandler; return mHandler;
} }
private final Handler mHandler; private final Handler mHandler;
private final IBiometricEnabledOnKeyguardCallback mBiometricEnabledCallback = 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. * Request to listen for face authentication when an app is occluding keyguard.
*
* @param request if true and mKeyguardOccluded, request face auth listening, else default * @param request if true and mKeyguardOccluded, request face auth listening, else default
* to normal behavior. * to normal behavior.
* See {@link KeyguardUpdateMonitor#shouldListenForFace()} * 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. * Request to listen for fingerprint when an app is occluding keyguard.
*
* @param request if true and mKeyguardOccluded, request fingerprint listening, else default * @param request if true and mKeyguardOccluded, request fingerprint listening, else default
* to normal behavior. * to normal behavior.
* See {@link KeyguardUpdateMonitor#shouldListenForFingerprint(boolean)} * See {@link KeyguardUpdateMonitor#shouldListenForFingerprint(boolean)}
@@ -2240,7 +2243,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
Settings.System.getUriFor(Settings.System.TIME_12_24), Settings.System.getUriFor(Settings.System.TIME_12_24),
false, mTimeFormatChangeObserver, UserHandle.USER_ALL); false, mTimeFormatChangeObserver, UserHandle.USER_ALL);
if (isSfpsSupported() && isSfpsEnrolled()) {
updateSfpsRequireScreenOnToAuthPref(); updateSfpsRequireScreenOnToAuthPref();
mSfpsRequireScreenOnToAuthPrefObserver = new ContentObserver(mHandler) { mSfpsRequireScreenOnToAuthPrefObserver = new ContentObserver(mHandler) {
@Override @Override
@@ -2256,7 +2258,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
mSfpsRequireScreenOnToAuthPrefObserver, mSfpsRequireScreenOnToAuthPrefObserver,
getCurrentUser()); getCurrentUser());
} }
}
protected void updateSfpsRequireScreenOnToAuthPref() { protected void updateSfpsRequireScreenOnToAuthPref() {
final int defaultSfpsRequireScreenOnToAuthValue = final int defaultSfpsRequireScreenOnToAuthValue =
@@ -2648,27 +2649,21 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
!(mFingerprintLockedOut && mBouncerIsOrWillBeShowing && mCredentialAttempted); !(mFingerprintLockedOut && mBouncerIsOrWillBeShowing && mCredentialAttempted);
final boolean isEncryptedOrLockdownForUser = isEncryptedOrLockdown(user); final boolean isEncryptedOrLockdownForUser = isEncryptedOrLockdown(user);
final boolean shouldListenUdfpsState = !isUdfps final boolean shouldListenUdfpsState = !isUdfps
|| (!userCanSkipBouncer || (!userCanSkipBouncer
&& !isEncryptedOrLockdownForUser && !isEncryptedOrLockdownForUser
&& userDoesNotHaveTrust); && userDoesNotHaveTrust);
boolean shouldListenSfpsState = true; boolean shouldListenSideFpsState = true;
// If mSfpsRequireScreenOnToAuthPrefEnabled, require screen on to listen to SFPS if (isSfpsSupported() && isSfpsEnrolled()) {
if (isSfpsSupported() && isSfpsEnrolled() && mSfpsRequireScreenOnToAuthPrefEnabled) { shouldListenSideFpsState =
shouldListenSfpsState = isDeviceInteractive(); mSfpsRequireScreenOnToAuthPrefEnabled ? isDeviceInteractive() : true;
} }
boolean shouldListen = shouldListenKeyguardState && shouldListenUserState boolean shouldListen = shouldListenKeyguardState && shouldListenUserState
&& shouldListenBouncerState && !isFingerprintLockedOut(); && shouldListenBouncerState && shouldListenUdfpsState && !isFingerprintLockedOut()
&& shouldListenSideFpsState;
if (isUdfpsSupported()) {
shouldListen = shouldListen && shouldListenUdfpsState;
}
if (isSfpsSupported()) {
shouldListen = shouldListen && shouldListenSfpsState;
}
maybeLogListenerModelData( maybeLogListenerModelData(
new KeyguardFingerprintListenModel( new KeyguardFingerprintListenModel(
@@ -2690,7 +2685,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
mKeyguardOccluded, mKeyguardOccluded,
mOccludingAppRequestingFp, mOccludingAppRequestingFp,
mIsPrimaryUser, mIsPrimaryUser,
shouldListenSfpsState, shouldListenSideFpsState,
shouldListenForFingerprintAssistant, shouldListenForFingerprintAssistant,
mSwitchingUser, mSwitchingUser,
isUdfps, isUdfps,

View File

@@ -1161,7 +1161,10 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
public void testStartsListeningForSfps_whenKeyguardIsVisible_ifRequireScreenOnToAuthEnabled() public void testStartsListeningForSfps_whenKeyguardIsVisible_ifRequireScreenOnToAuthEnabled()
throws RemoteException { throws RemoteException {
// SFPS supported and enrolled // 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 require screen on to auth is disabled, and keyguard is not awake
when(mSecureSettings.getIntForUser(anyString(), anyInt(), anyInt())).thenReturn(0); when(mSecureSettings.getIntForUser(anyString(), anyInt(), anyInt())).thenReturn(0);
@@ -1200,12 +1203,6 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue(); 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( private FingerprintSensorPropertiesInternal newFingerprintSensorPropertiesInternal(
@FingerprintSensorProperties.SensorType int sensorType) { @FingerprintSensorProperties.SensorType int sensorType) {