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; }