Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +8 −5 Original line number Diff line number Diff line Loading @@ -712,8 +712,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab */ public void setKeyguardGoingAway(boolean goingAway) { mKeyguardGoingAway = goingAway; // This is set specifically to stop face authentication from running. updateBiometricListeningState(BIOMETRIC_ACTION_STOP, FACE_AUTH_STOPPED_KEYGUARD_GOING_AWAY); if (mKeyguardGoingAway) { updateFaceListeningState(BIOMETRIC_ACTION_STOP, FACE_AUTH_STOPPED_KEYGUARD_GOING_AWAY); } updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE); } /** Loading Loading @@ -1951,9 +1954,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab cb.onFinishedGoingToSleep(arg1); } } // This is set specifically to stop face authentication from running. updateBiometricListeningState(BIOMETRIC_ACTION_STOP, updateFaceListeningState(BIOMETRIC_ACTION_STOP, FACE_AUTH_STOPPED_FINISHED_GOING_TO_SLEEP); updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE); } private void handleScreenTurnedOff() { Loading Loading @@ -2719,7 +2722,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mFingerprintInteractiveToAuthProvider != null && mFingerprintInteractiveToAuthProvider.isEnabled(getCurrentUser()); shouldListenSideFpsState = interactiveToAuthEnabled ? isDeviceInteractive() : true; interactiveToAuthEnabled ? isDeviceInteractive() && !mGoingToSleep : true; } boolean shouldListen = shouldListenKeyguardState && shouldListenUserState Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +59 −6 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ import android.os.PowerManager; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.service.dreams.IDreamManager; import android.service.trust.TrustAgentService; import android.telephony.ServiceState; Loading Loading @@ -1254,7 +1255,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { } @Test public void testStartsListeningForSfps_whenKeyguardIsVisible_ifRequireScreenOnToAuthEnabled() public void startsListeningForSfps_whenKeyguardIsVisible_ifRequireInteractiveToAuthEnabled() throws RemoteException { // SFPS supported and enrolled final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>(); Loading @@ -1262,12 +1263,9 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { 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 interactive to auth is disabled, and keyguard is not awake when(mInteractiveToAuthProvider.isEnabled(anyInt())).thenReturn(false); mContext.getOrCreateTestableResources().addOverride( com.android.internal.R.bool.config_requireScreenOnToAuthEnabled, true); // Preconditions for sfps auth to run keyguardNotGoingAway(); currentUserIsPrimary(); Loading @@ -1282,7 +1280,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { // THEN we should listen for sfps when screen off, because require screen on is disabled assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue(); // WHEN require screen on to auth is enabled, and keyguard is not awake // WHEN require interactive to auth is enabled, and keyguard is not awake when(mInteractiveToAuthProvider.isEnabled(anyInt())).thenReturn(true); // THEN we shouldn't listen for sfps when screen off, because require screen on is enabled Loading @@ -1297,6 +1295,61 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue(); } @Test public void notListeningForSfps_whenGoingToSleep_ifRequireInteractiveToAuthEnabled() throws RemoteException { // GIVEN SFPS supported and enrolled final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>(); props.add(newFingerprintSensorPropertiesInternal(TYPE_POWER_BUTTON)); when(mAuthController.getSfpsProps()).thenReturn(props); when(mAuthController.isSfpsEnrolled(anyInt())).thenReturn(true); // GIVEN Preconditions for sfps auth to run keyguardNotGoingAway(); currentUserIsPrimary(); currentUserDoesNotHaveTrust(); biometricsNotDisabledThroughDevicePolicyManager(); biometricsEnabledForCurrentUser(); userNotCurrentlySwitching(); statusBarShadeIsLocked(); // WHEN require interactive to auth is enabled & keyguard is going to sleep when(mInteractiveToAuthProvider.isEnabled(anyInt())).thenReturn(true); deviceGoingToSleep(); mTestableLooper.processAllMessages(); // THEN we should NOT listen for sfps because device is going to sleep assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isFalse(); } @Test public void listeningForSfps_whenGoingToSleep_ifRequireInteractiveToAuthDisabled() throws RemoteException { // GIVEN SFPS supported and enrolled final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>(); props.add(newFingerprintSensorPropertiesInternal(TYPE_POWER_BUTTON)); when(mAuthController.getSfpsProps()).thenReturn(props); when(mAuthController.isSfpsEnrolled(anyInt())).thenReturn(true); // GIVEN Preconditions for sfps auth to run keyguardNotGoingAway(); currentUserIsPrimary(); currentUserDoesNotHaveTrust(); biometricsNotDisabledThroughDevicePolicyManager(); biometricsEnabledForCurrentUser(); userNotCurrentlySwitching(); statusBarShadeIsLocked(); // WHEN require interactive to auth is disabled & keyguard is going to sleep when(mInteractiveToAuthProvider.isEnabled(anyInt())).thenReturn(false); deviceGoingToSleep(); mTestableLooper.processAllMessages(); // THEN we should listen for sfps because screen on to auth is disabled assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue(); } private FingerprintSensorPropertiesInternal newFingerprintSensorPropertiesInternal( @FingerprintSensorProperties.SensorType int sensorType) { Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +8 −5 Original line number Diff line number Diff line Loading @@ -712,8 +712,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab */ public void setKeyguardGoingAway(boolean goingAway) { mKeyguardGoingAway = goingAway; // This is set specifically to stop face authentication from running. updateBiometricListeningState(BIOMETRIC_ACTION_STOP, FACE_AUTH_STOPPED_KEYGUARD_GOING_AWAY); if (mKeyguardGoingAway) { updateFaceListeningState(BIOMETRIC_ACTION_STOP, FACE_AUTH_STOPPED_KEYGUARD_GOING_AWAY); } updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE); } /** Loading Loading @@ -1951,9 +1954,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab cb.onFinishedGoingToSleep(arg1); } } // This is set specifically to stop face authentication from running. updateBiometricListeningState(BIOMETRIC_ACTION_STOP, updateFaceListeningState(BIOMETRIC_ACTION_STOP, FACE_AUTH_STOPPED_FINISHED_GOING_TO_SLEEP); updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE); } private void handleScreenTurnedOff() { Loading Loading @@ -2719,7 +2722,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mFingerprintInteractiveToAuthProvider != null && mFingerprintInteractiveToAuthProvider.isEnabled(getCurrentUser()); shouldListenSideFpsState = interactiveToAuthEnabled ? isDeviceInteractive() : true; interactiveToAuthEnabled ? isDeviceInteractive() && !mGoingToSleep : true; } boolean shouldListen = shouldListenKeyguardState && shouldListenUserState Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +59 −6 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ import android.os.PowerManager; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.service.dreams.IDreamManager; import android.service.trust.TrustAgentService; import android.telephony.ServiceState; Loading Loading @@ -1254,7 +1255,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { } @Test public void testStartsListeningForSfps_whenKeyguardIsVisible_ifRequireScreenOnToAuthEnabled() public void startsListeningForSfps_whenKeyguardIsVisible_ifRequireInteractiveToAuthEnabled() throws RemoteException { // SFPS supported and enrolled final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>(); Loading @@ -1262,12 +1263,9 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { 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 interactive to auth is disabled, and keyguard is not awake when(mInteractiveToAuthProvider.isEnabled(anyInt())).thenReturn(false); mContext.getOrCreateTestableResources().addOverride( com.android.internal.R.bool.config_requireScreenOnToAuthEnabled, true); // Preconditions for sfps auth to run keyguardNotGoingAway(); currentUserIsPrimary(); Loading @@ -1282,7 +1280,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { // THEN we should listen for sfps when screen off, because require screen on is disabled assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue(); // WHEN require screen on to auth is enabled, and keyguard is not awake // WHEN require interactive to auth is enabled, and keyguard is not awake when(mInteractiveToAuthProvider.isEnabled(anyInt())).thenReturn(true); // THEN we shouldn't listen for sfps when screen off, because require screen on is enabled Loading @@ -1297,6 +1295,61 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue(); } @Test public void notListeningForSfps_whenGoingToSleep_ifRequireInteractiveToAuthEnabled() throws RemoteException { // GIVEN SFPS supported and enrolled final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>(); props.add(newFingerprintSensorPropertiesInternal(TYPE_POWER_BUTTON)); when(mAuthController.getSfpsProps()).thenReturn(props); when(mAuthController.isSfpsEnrolled(anyInt())).thenReturn(true); // GIVEN Preconditions for sfps auth to run keyguardNotGoingAway(); currentUserIsPrimary(); currentUserDoesNotHaveTrust(); biometricsNotDisabledThroughDevicePolicyManager(); biometricsEnabledForCurrentUser(); userNotCurrentlySwitching(); statusBarShadeIsLocked(); // WHEN require interactive to auth is enabled & keyguard is going to sleep when(mInteractiveToAuthProvider.isEnabled(anyInt())).thenReturn(true); deviceGoingToSleep(); mTestableLooper.processAllMessages(); // THEN we should NOT listen for sfps because device is going to sleep assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isFalse(); } @Test public void listeningForSfps_whenGoingToSleep_ifRequireInteractiveToAuthDisabled() throws RemoteException { // GIVEN SFPS supported and enrolled final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>(); props.add(newFingerprintSensorPropertiesInternal(TYPE_POWER_BUTTON)); when(mAuthController.getSfpsProps()).thenReturn(props); when(mAuthController.isSfpsEnrolled(anyInt())).thenReturn(true); // GIVEN Preconditions for sfps auth to run keyguardNotGoingAway(); currentUserIsPrimary(); currentUserDoesNotHaveTrust(); biometricsNotDisabledThroughDevicePolicyManager(); biometricsEnabledForCurrentUser(); userNotCurrentlySwitching(); statusBarShadeIsLocked(); // WHEN require interactive to auth is disabled & keyguard is going to sleep when(mInteractiveToAuthProvider.isEnabled(anyInt())).thenReturn(false); deviceGoingToSleep(); mTestableLooper.processAllMessages(); // THEN we should listen for sfps because screen on to auth is disabled assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue(); } private FingerprintSensorPropertiesInternal newFingerprintSensorPropertiesInternal( @FingerprintSensorProperties.SensorType int sensorType) { Loading