Skip to content

Commit 6f6facc

Browse files
Brian ColonnaAndroid (Google) Code Review
authored andcommitted
Merge "Ignoring FUL unlock signal if user changed fixes b/7572354" into jb-mr1.1-dev
2 parents e3f7c45 + 5eb83aa commit 6f6facc

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import android.os.Message;
3232
import android.os.PowerManager;
3333
import android.os.RemoteException;
34+
import android.os.UserHandle;
3435
import android.util.Log;
3536
import android.view.View;
3637

@@ -214,7 +215,7 @@ public boolean handleMessage(Message msg) {
214215
handleServiceDisconnected();
215216
break;
216217
case MSG_UNLOCK:
217-
handleUnlock();
218+
handleUnlock(msg.arg1);
218219
break;
219220
case MSG_CANCEL:
220221
handleCancel();
@@ -297,11 +298,18 @@ void handleServiceDisconnected() {
297298
/**
298299
* Stops the Face Unlock service and tells the device to grant access to the user.
299300
*/
300-
void handleUnlock() {
301+
void handleUnlock(int authenticatedUserId) {
301302
if (DEBUG) Log.d(TAG, "handleUnlock()");
302303
stop();
303-
mKeyguardScreenCallback.reportSuccessfulUnlockAttempt();
304-
mKeyguardScreenCallback.dismiss(true);
304+
int currentUserId = mLockPatternUtils.getCurrentUser();
305+
if (authenticatedUserId == currentUserId) {
306+
if (DEBUG) Log.d(TAG, "Unlocking for user " + authenticatedUserId);
307+
mKeyguardScreenCallback.reportSuccessfulUnlockAttempt();
308+
mKeyguardScreenCallback.dismiss(true);
309+
} else {
310+
Log.d(TAG, "Ignoring unlock for authenticated user (" + authenticatedUserId +
311+
") because the current user is " + currentUserId);
312+
}
305313
}
306314

307315
/**
@@ -420,7 +428,8 @@ private void stopUi() {
420428
*/
421429
public void unlock() {
422430
if (DEBUG) Log.d(TAG, "unlock()");
423-
mHandler.sendEmptyMessage(MSG_UNLOCK);
431+
Message message = mHandler.obtainMessage(MSG_UNLOCK, UserHandle.getCallingUserId(), -1);
432+
mHandler.sendMessage(message);
424433
}
425434

426435
/**

0 commit comments

Comments
 (0)