Skip to content

Commit cc4104f

Browse files
author
Brian Colonna
committed
Suppressing FUL after user switch (fix b/7316467)
When switching users, Face Unlock starts in onResume(). However, there is no signal to indicate when the user actually sees their unlock screen. This means Face Unlock could be running unseen, timing out soon after it becomes visible, or letting the user in before they see the preview. This fix simply suppresses Face Unlock immediately after switching users. This is not the ideal behavior, but there is no easy way to make Face Unlock start only after the unlock screen becomes visible. When the user changes screens it becomes unsuppressed, so if they go back to the multi-select widget screen or login, Face Unlock works as expected and is only suppressed again when the user is switched. Change-Id: I80a302b0aefc1dee3c2dc77557978cbe062de435
1 parent eb7f157 commit cc4104f

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ public void userActivity(long timeout) {
248248
}
249249

250250
public void dismiss(boolean authenticated) {
251+
// If the biometric unlock was suppressed due to a user switch, it can now be safely
252+
// unsuppressed because the user has left the unlock screen.
253+
KeyguardUpdateMonitor.getInstance(mContext).clearBiometricUnlockUserSwitched();
251254
showNextSecurityScreenOrFinish(authenticated);
252255
}
253256

policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityModel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ private boolean isBiometricUnlockSuppressed() {
6565
KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
6666
final boolean backupIsTimedOut = monitor.getFailedUnlockAttempts() >=
6767
LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
68-
return monitor.getMaxBiometricUnlockAttemptsReached() || backupIsTimedOut;
68+
return monitor.getMaxBiometricUnlockAttemptsReached() || backupIsTimedOut
69+
|| monitor.didBiometricUnlockUserSwitch();
6970
}
7071

7172
SecurityMode getSecurityMode() {

policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ public class KeyguardUpdateMonitor {
102102
private int mFailedAttempts = 0;
103103
private int mFailedBiometricUnlockAttempts = 0;
104104

105+
private boolean mBiometricUnlockUserSwitched;
106+
105107
private boolean mClockVisible;
106108

107109
private final ArrayList<WeakReference<KeyguardUpdateMonitorCallback>>
@@ -404,6 +406,7 @@ protected void handleUserSwitched(int userId, IRemoteCallback reply) {
404406
cb.onUserSwitched(userId);
405407
}
406408
}
409+
mBiometricUnlockUserSwitched = true;
407410
try {
408411
reply.sendResult(null);
409412
} catch (RemoteException e) {
@@ -721,6 +724,14 @@ public boolean getMaxBiometricUnlockAttemptsReached() {
721724
return mFailedBiometricUnlockAttempts >= FAILED_BIOMETRIC_UNLOCK_ATTEMPTS_BEFORE_BACKUP;
722725
}
723726

727+
public boolean didBiometricUnlockUserSwitch() {
728+
return mBiometricUnlockUserSwitched;
729+
}
730+
731+
public void clearBiometricUnlockUserSwitched() {
732+
mBiometricUnlockUserSwitched = false;
733+
}
734+
724735
public boolean isSimLocked() {
725736
return isSimLocked(mSimState);
726737
}

0 commit comments

Comments
 (0)