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

Commit ba6fef55 authored by Rubin Xu's avatar Rubin Xu
Browse files

Fix permission issue during LockSettingsService.dump()

Bug: 62410009
Test: adb shell su 2000 dumpsys lock_settings
Change-Id: Ibe245a80b80fd7745bc44c54db008724bd25db13
parent f16720fa
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -1012,8 +1012,12 @@ public class LockSettingsService extends ILockSettings.Stub {
    @Override
    public boolean getSeparateProfileChallengeEnabled(int userId) {
        checkReadPermission(SEPARATE_PROFILE_CHALLENGE_KEY, userId);
        return getSeparateProfileChallengeEnabledInternal(userId);
    }

    private boolean getSeparateProfileChallengeEnabledInternal(int userId) {
        synchronized (mSeparateChallengeLock) {
            return getBoolean(SEPARATE_PROFILE_CHALLENGE_KEY, false, userId);
            return getBooleanUnchecked(SEPARATE_PROFILE_CHALLENGE_KEY, false, userId);
        }
    }

@@ -1097,6 +1101,10 @@ public class LockSettingsService extends ILockSettings.Stub {
    @Override
    public boolean getBoolean(String key, boolean defaultValue, int userId) {
        checkReadPermission(key, userId);
        return getBooleanUnchecked(key, defaultValue, userId);
    }

    private boolean getBooleanUnchecked(String key, boolean defaultValue, int userId) {
        String value = getStringUnchecked(key, null, userId);
        return TextUtils.isEmpty(value) ?
                defaultValue : (value.equals("1") || value.equals("true"));
@@ -3160,7 +3168,7 @@ public class LockSettingsService extends ILockSettings.Stub {
            // observe it from the keyguard directly.
            pw.println("Quality: " + getKeyguardStoredQuality(userId));
            pw.println("CredentialType: " + getCredentialTypeInternal(userId));
            pw.println("SeparateChallenge: " + getSeparateProfileChallengeEnabled(userId));
            pw.println("SeparateChallenge: " + getSeparateProfileChallengeEnabledInternal(userId));
            pw.println(String.format("Metrics: %s",
                    getUserPasswordMetrics(userId) != null ? "known" : "unknown"));
            pw.decreaseIndent();