Merge "LockScreen: only set keystore password for owner" into jb-mr1-dev

This commit is contained in:
Kenny Root
2012-09-25 23:35:56 -07:00
committed by Android (Google) Code Review

View File

@@ -256,9 +256,13 @@ public class LockPatternUtils {
* @return Whether the pattern matches the stored one. * @return Whether the pattern matches the stored one.
*/ */
public boolean checkPattern(List<LockPatternView.Cell> pattern) { public boolean checkPattern(List<LockPatternView.Cell> pattern) {
int userId = getCurrentOrCallingUserId(); final int userId = getCurrentOrCallingUserId();
try { 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) { } catch (RemoteException re) {
return true; return true;
} }
@@ -271,9 +275,14 @@ public class LockPatternUtils {
* @return Whether the password matches the stored one. * @return Whether the password matches the stored one.
*/ */
public boolean checkPassword(String password) { public boolean checkPassword(String password) {
int userId = getCurrentOrCallingUserId(); final int userId = getCurrentOrCallingUserId();
try { 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) { } catch (RemoteException re) {
return true; return true;
} }