am 3f1375e5: Merge "Enabling Face Unlock for user switching (bug 8495282)" into jb-mr2-dev

* commit '3f1375e50fa29c500f1ce746ec7421bf6afcd8ff':
  Enabling Face Unlock for user switching (bug 8495282)
This commit is contained in:
Brian Colonna
2013-04-15 14:24:10 -07:00
committed by Android Git Automerger
3 changed files with 22 additions and 4 deletions

View File

@ -151,7 +151,9 @@ public class KeyguardFaceUnlockView extends LinearLayout implements KeyguardSecu
public void onResume(int reason) { public void onResume(int reason) {
if (DEBUG) Log.d(TAG, "onResume()"); if (DEBUG) Log.d(TAG, "onResume()");
mIsShowing = KeyguardUpdateMonitor.getInstance(mContext).isKeyguardVisible(); mIsShowing = KeyguardUpdateMonitor.getInstance(mContext).isKeyguardVisible();
maybeStartBiometricUnlock(); if (!KeyguardUpdateMonitor.getInstance(mContext).isSwitchingUser()) {
maybeStartBiometricUnlock();
}
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateCallback); KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateCallback);
// Registers a callback which handles stopping the biometric unlock and restarting it in // Registers a callback which handles stopping the biometric unlock and restarting it in
@ -268,6 +270,14 @@ public class KeyguardFaceUnlockView extends LinearLayout implements KeyguardSecu
// mLockPatternUtils.setCurrentUser(userId); // mLockPatternUtils.setCurrentUser(userId);
} }
@Override
public void onUserSwitchComplete(int userId) {
if (DEBUG) Log.d(TAG, "onUserSwitchComplete(" + userId + ")");
if (mBiometricUnlock != null) {
maybeStartBiometricUnlock();
}
}
@Override @Override
public void onKeyguardVisibilityChanged(boolean showing) { public void onKeyguardVisibilityChanged(boolean showing) {
if (DEBUG) Log.d(TAG, "onKeyguardVisibilityChanged(" + showing + ")"); if (DEBUG) Log.d(TAG, "onKeyguardVisibilityChanged(" + showing + ")");

View File

@ -124,6 +124,8 @@ public class KeyguardUpdateMonitor {
mCallbacks = Lists.newArrayList(); mCallbacks = Lists.newArrayList();
private ContentObserver mDeviceProvisionedObserver; private ContentObserver mDeviceProvisionedObserver;
private boolean mSwitchingUser;
private final Handler mHandler = new Handler() { private final Handler mHandler = new Handler() {
@Override @Override
public void handleMessage(Message msg) { public void handleMessage(Message msg) {
@ -461,11 +463,13 @@ public class KeyguardUpdateMonitor {
public void onUserSwitching(int newUserId, IRemoteCallback reply) { public void onUserSwitching(int newUserId, IRemoteCallback reply) {
mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCHING, mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCHING,
newUserId, 0, reply)); newUserId, 0, reply));
mSwitchingUser = true;
} }
@Override @Override
public void onUserSwitchComplete(int newUserId) throws RemoteException { public void onUserSwitchComplete(int newUserId) throws RemoteException {
mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCH_COMPLETE, mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCH_COMPLETE,
newUserId)); newUserId));
mSwitchingUser = false;
} }
}); });
} catch (RemoteException e) { } catch (RemoteException e) {
@ -529,7 +533,6 @@ public class KeyguardUpdateMonitor {
cb.onUserSwitching(userId); cb.onUserSwitching(userId);
} }
} }
setAlternateUnlockEnabled(false);
try { try {
reply.sendResult(null); reply.sendResult(null);
} catch (RemoteException e) { } catch (RemoteException e) {
@ -733,6 +736,10 @@ public class KeyguardUpdateMonitor {
return mKeyguardIsVisible; return mKeyguardIsVisible;
} }
public boolean isSwitchingUser() {
return mSwitchingUser;
}
private static boolean isBatteryUpdateInteresting(BatteryStatus old, BatteryStatus current) { private static boolean isBatteryUpdateInteresting(BatteryStatus old, BatteryStatus current) {
final boolean nowPluggedIn = current.isPluggedIn(); final boolean nowPluggedIn = current.isPluggedIn();
final boolean wasPluggedIn = old.isPluggedIn(); final boolean wasPluggedIn = old.isPluggedIn();

View File

@ -319,8 +319,9 @@ public class KeyguardViewMediator {
mSwitchingUser = true; mSwitchingUser = true;
resetStateLocked(null); resetStateLocked(null);
adjustStatusBarLocked(); adjustStatusBarLocked();
// Disable face unlock when the user switches. // When we switch users we want to bring the new user to the biometric unlock even
KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(false); // if the current user has gone to the backup.
KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true);
} }
} }