Skip to content

Commit f05d511

Browse files
krutonAndroid (Google) Code Review
authored andcommitted
Merge "LockScreen: only set keystore password for owner" into jb-mr1-dev
2 parents ca68f4a + df8bfe0 commit f05d511

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

core/java/com/android/internal/widget/LockPatternUtils.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,13 @@ private int getCurrentOrCallingUserId() {
256256
* @return Whether the pattern matches the stored one.
257257
*/
258258
public boolean checkPattern(List<LockPatternView.Cell> pattern) {
259-
int userId = getCurrentOrCallingUserId();
259+
final int userId = getCurrentOrCallingUserId();
260260
try {
261-
return getLockSettings().checkPattern(patternToHash(pattern), userId);
261+
final boolean matched = getLockSettings().checkPattern(patternToHash(pattern), userId);
262+
if (matched && (userId == UserHandle.USER_OWNER)) {
263+
KeyStore.getInstance().password(patternToString(pattern));
264+
}
265+
return matched;
262266
} catch (RemoteException re) {
263267
return true;
264268
}
@@ -271,9 +275,14 @@ public boolean checkPattern(List<LockPatternView.Cell> pattern) {
271275
* @return Whether the password matches the stored one.
272276
*/
273277
public boolean checkPassword(String password) {
274-
int userId = getCurrentOrCallingUserId();
278+
final int userId = getCurrentOrCallingUserId();
275279
try {
276-
return getLockSettings().checkPassword(passwordToHash(password), userId);
280+
final boolean matched = getLockSettings().checkPassword(passwordToHash(password),
281+
userId);
282+
if (matched && (userId == UserHandle.USER_OWNER)) {
283+
KeyStore.getInstance().password(password);
284+
}
285+
return matched;
277286
} catch (RemoteException re) {
278287
return true;
279288
}

0 commit comments

Comments
 (0)