Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df8bfe0c authored by Kenny Root's avatar Kenny Root
Browse files

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
parent 8658e1aa
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -256,9 +256,13 @@ public class LockPatternUtils {
     * @return Whether the pattern matches the stored one.
     */
    public boolean checkPattern(List<LockPatternView.Cell> 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;
        }