diff options
author | Brian Colonna <bcolonna@google.com> | 2012-11-19 16:05:48 -0500 |
---|---|---|
committer | Brian Colonna <bcolonna@google.com> | 2012-11-19 17:45:44 -0500 |
commit | 5eb83aa8965835f75b13a535eafe7f6311e4f790 (patch) | |
tree | 4090c6a9d8e59e69844bf858eb9debc5f44b4fb3 /policy | |
parent | 2656abe09895088eca25caafc3e92869217d1447 (diff) | |
download | frameworks_base-5eb83aa8965835f75b13a535eafe7f6311e4f790.zip frameworks_base-5eb83aa8965835f75b13a535eafe7f6311e4f790.tar.gz frameworks_base-5eb83aa8965835f75b13a535eafe7f6311e4f790.tar.bz2 |
Ignoring FUL unlock signal if user changed fixes b/7572354
Prior to this fix, one user could log into another user's account by
waiting for FUL to recognize them on their account, and then
switching to another account at a very precise time - after FUL has
recognized the user but before the device has unlocked.
This was caused by the FUL unlock() callback telling the device to
unlock even though the user had changed. The fix is to only unlock
the device if the current user ID matches the user ID used to run
FUL.
Change-Id: I516b52d99ab7609b836939e4aae6e7df77a9e047
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java b/policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java index 259f1e4..830471a 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java @@ -31,6 +31,7 @@ import android.os.Looper; import android.os.Message; import android.os.PowerManager; import android.os.RemoteException; +import android.os.UserHandle; import android.util.Log; import android.view.View; @@ -214,7 +215,7 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback { handleServiceDisconnected(); break; case MSG_UNLOCK: - handleUnlock(); + handleUnlock(msg.arg1); break; case MSG_CANCEL: handleCancel(); @@ -297,11 +298,18 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback { /** * Stops the Face Unlock service and tells the device to grant access to the user. */ - void handleUnlock() { + void handleUnlock(int authenticatedUserId) { if (DEBUG) Log.d(TAG, "handleUnlock()"); stop(); - mKeyguardScreenCallback.reportSuccessfulUnlockAttempt(); - mKeyguardScreenCallback.dismiss(true); + int currentUserId = mLockPatternUtils.getCurrentUser(); + if (authenticatedUserId == currentUserId) { + if (DEBUG) Log.d(TAG, "Unlocking for user " + authenticatedUserId); + mKeyguardScreenCallback.reportSuccessfulUnlockAttempt(); + mKeyguardScreenCallback.dismiss(true); + } else { + Log.d(TAG, "Ignoring unlock for authenticated user (" + authenticatedUserId + + ") because the current user is " + currentUserId); + } } /** @@ -420,7 +428,8 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback { */ public void unlock() { if (DEBUG) Log.d(TAG, "unlock()"); - mHandler.sendEmptyMessage(MSG_UNLOCK); + Message message = mHandler.obtainMessage(MSG_UNLOCK, UserHandle.getCallingUserId(), -1); + mHandler.sendMessage(message); } /** |