summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Brian Colonna <bcolonna@google.com> 2013-04-15 11:45:40 -0400
committer Brian Colonna <bcolonna@google.com> 2013-04-15 11:45:40 -0400
commita5239891dc324db21beb87535f90ea76fba803b9 (patch)
treea396fd65a90625cbca4602bdf733b44a22335f62
parent330a9fe323cfb2f492665b73822f056c2c6689c2 (diff)
Enabling Face Unlock for user switching (bug 8495282)
We had been intentionally disabling FUL when switching to a new user. The reason was that we were only getting a signal when the user switch started, not when it completed. If we started FUL at the beginning of the user switch, it could be completed by the time the user switch completed. We now have a signal to tell us that the switch completed. Prior to this change, FUL would start whenever keyguard is created. For a user switch, keyguard is recreated when we get onUserSwitching(), but we don't want FUL to start until we get onUserSwitchComplete(). So with this change, if onResume() happens because of a user switch it doesn't start FUL until we get onUserSwitchComplete(). Change-Id: I1d3da0a32b9b4cf0cfa5c577f1697d2a41ee4fda
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardFaceUnlockView.java12
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java9
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java5
3 files changed, 22 insertions, 4 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardFaceUnlockView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardFaceUnlockView.java
index 965e3786439f..7315aad5566a 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardFaceUnlockView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardFaceUnlockView.java
@@ -151,7 +151,9 @@ public class KeyguardFaceUnlockView extends LinearLayout implements KeyguardSecu
public void onResume(int reason) {
if (DEBUG) Log.d(TAG, "onResume()");
mIsShowing = KeyguardUpdateMonitor.getInstance(mContext).isKeyguardVisible();
- maybeStartBiometricUnlock();
+ if (!KeyguardUpdateMonitor.getInstance(mContext).isSwitchingUser()) {
+ maybeStartBiometricUnlock();
+ }
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateCallback);
// Registers a callback which handles stopping the biometric unlock and restarting it in
@@ -269,6 +271,14 @@ public class KeyguardFaceUnlockView extends LinearLayout implements KeyguardSecu
}
@Override
+ public void onUserSwitchComplete(int userId) {
+ if (DEBUG) Log.d(TAG, "onUserSwitchComplete(" + userId + ")");
+ if (mBiometricUnlock != null) {
+ maybeStartBiometricUnlock();
+ }
+ }
+
+ @Override
public void onKeyguardVisibilityChanged(boolean showing) {
if (DEBUG) Log.d(TAG, "onKeyguardVisibilityChanged(" + showing + ")");
boolean wasShowing = false;
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java
index ad87a4ba5c4c..986dc49b29a9 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java
@@ -124,6 +124,8 @@ public class KeyguardUpdateMonitor {
mCallbacks = Lists.newArrayList();
private ContentObserver mDeviceProvisionedObserver;
+ private boolean mSwitchingUser;
+
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
@@ -461,11 +463,13 @@ public class KeyguardUpdateMonitor {
public void onUserSwitching(int newUserId, IRemoteCallback reply) {
mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCHING,
newUserId, 0, reply));
+ mSwitchingUser = true;
}
@Override
public void onUserSwitchComplete(int newUserId) throws RemoteException {
mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCH_COMPLETE,
newUserId));
+ mSwitchingUser = false;
}
});
} catch (RemoteException e) {
@@ -529,7 +533,6 @@ public class KeyguardUpdateMonitor {
cb.onUserSwitching(userId);
}
}
- setAlternateUnlockEnabled(false);
try {
reply.sendResult(null);
} catch (RemoteException e) {
@@ -733,6 +736,10 @@ public class KeyguardUpdateMonitor {
return mKeyguardIsVisible;
}
+ public boolean isSwitchingUser() {
+ return mSwitchingUser;
+ }
+
private static boolean isBatteryUpdateInteresting(BatteryStatus old, BatteryStatus current) {
final boolean nowPluggedIn = current.isPluggedIn();
final boolean wasPluggedIn = old.isPluggedIn();
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
index c49228e44f38..08a95a6dd27e 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
@@ -319,8 +319,9 @@ public class KeyguardViewMediator {
mSwitchingUser = true;
resetStateLocked(null);
adjustStatusBarLocked();
- // Disable face unlock when the user switches.
- KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(false);
+ // When we switch users we want to bring the new user to the biometric unlock even
+ // if the current user has gone to the backup.
+ KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true);
}
}