From df8bfe0cf65b4f864eb3eb60c1371f987c79ca20 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Fri, 21 Sep 2012 15:00:25 -0700 Subject: [PATCH] LockScreen: only set keystore password for owner Since KeyStore doesn't support multi-user, only unlock or set the password on the keystore when the "owner" enters a password. Bug: 7169463 Change-Id: I97b4ba714dc6e400a6e45825c71f81c4629392d8 --- .../internal/widget/LockPatternUtils.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 09457ccfbf1b4..84e1d95a9385d 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -256,9 +256,13 @@ public class LockPatternUtils { * @return Whether the pattern matches the stored one. */ public boolean checkPattern(List pattern) { - int userId = getCurrentOrCallingUserId(); + final int userId = getCurrentOrCallingUserId(); try { - return getLockSettings().checkPattern(patternToHash(pattern), userId); + final boolean matched = getLockSettings().checkPattern(patternToHash(pattern), userId); + if (matched && (userId == UserHandle.USER_OWNER)) { + KeyStore.getInstance().password(patternToString(pattern)); + } + return matched; } catch (RemoteException re) { return true; } @@ -271,9 +275,14 @@ public class LockPatternUtils { * @return Whether the password matches the stored one. */ public boolean checkPassword(String password) { - int userId = getCurrentOrCallingUserId(); + final int userId = getCurrentOrCallingUserId(); try { - return getLockSettings().checkPassword(passwordToHash(password), userId); + final boolean matched = getLockSettings().checkPassword(passwordToHash(password), + userId); + if (matched && (userId == UserHandle.USER_OWNER)) { + KeyStore.getInstance().password(password); + } + return matched; } catch (RemoteException re) { return true; }