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

Commit 1572ee37 authored by Adrian Roos's avatar Adrian Roos
Browse files

Trust: Look at the security unlock method of the right user

Follow up to Ic9e93862c722ebc529f5b2010b9cea941f569ce7.

Bug: 17107213
Change-Id: I8f3c19aedeaca3f265c98a4fb60ab74b115fca47
parent ef56dad5
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -862,14 +862,23 @@ public class LockPatternUtils {
     * @return stored password quality
     */
    public int getKeyguardStoredPasswordQuality() {
        int quality =
                (int) getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
        return getKeyguardStoredPasswordQuality(getCurrentOrCallingUserId());
    }

    /**
     * Retrieves the quality mode for {@param userHandle}.
     * {@see DevicePolicyManager#getPasswordQuality(android.content.ComponentName)}
     *
     * @return stored password quality
     */
    public int getKeyguardStoredPasswordQuality(int userHandle) {
        int quality = (int) getLong(PASSWORD_TYPE_KEY,
                DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userHandle);
        // If the user has chosen to use weak biometric sensor, then return the backup locking
        // method and treat biometric as a special case.
        if (quality == DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK) {
            quality =
                (int) getLong(PASSWORD_TYPE_ALTERNATE_KEY,
                        DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
            quality = (int) getLong(PASSWORD_TYPE_ALTERNATE_KEY,
                        DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userHandle);
        }
        return quality;
    }
+1 −1
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ public class TrustManagerService extends SystemService {
        obsoleteAgents.addAll(mActiveAgents);

        for (UserInfo userInfo : userInfos) {
            if (lockPatternUtils.getKeyguardStoredPasswordQuality()
            if (lockPatternUtils.getKeyguardStoredPasswordQuality(userInfo.id)
                    == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) continue;
            DevicePolicyManager dpm = lockPatternUtils.getDevicePolicyManager();
            int disabledFeatures = dpm.getKeyguardDisabledFeatures(null, userInfo.id);