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

Commit 91071013 authored by Chandru S's avatar Chandru S Committed by Android Build Coastguard Worker
Browse files

Use Settings.System.getIntForUser instead of getInt to make sure user specific settings are used

Bug: 265431505
Test: atest KeyguardViewMediatorTest
(cherry picked from commit 625e009f)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ce6510deba06bcb72a0e468294b483fc4ac4be17)
Merged-In: I66a660c091c90a957a0fd1e144c013840db3f47e
Change-Id: I66a660c091c90a957a0fd1e144c013840db3f47e
parent 40f64e3c
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -978,9 +978,9 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
        final ContentResolver cr = mContext.getContentResolver();

        // From SecuritySettings
        final long lockAfterTimeout = Settings.Secure.getInt(cr,
        final long lockAfterTimeout = Settings.Secure.getIntForUser(cr,
                Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT,
                KEYGUARD_LOCK_AFTER_DELAY_DEFAULT);
                KEYGUARD_LOCK_AFTER_DELAY_DEFAULT, userId);

        // From DevicePolicyAdmin
        final long policyTimeout = mLockPatternUtils.getDevicePolicyManager()
@@ -992,8 +992,8 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
            timeout = lockAfterTimeout;
        } else {
            // From DisplaySettings
            long displayTimeout = Settings.System.getInt(cr, SCREEN_OFF_TIMEOUT,
                    KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT);
            long displayTimeout = Settings.System.getIntForUser(cr, SCREEN_OFF_TIMEOUT,
                    KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT, userId);

            // policy in effect. Make sure we don't go beyond policy limit.
            displayTimeout = Math.max(displayTimeout, 0); // ignore negative values
@@ -1813,7 +1813,10 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
    private void playSound(int soundId) {
        if (soundId == 0) return;
        final ContentResolver cr = mContext.getContentResolver();
        if (Settings.System.getInt(cr, Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1) == 1) {
        int lockscreenSoundsEnabled = Settings.System.getIntForUser(cr,
                Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1,
                KeyguardUpdateMonitor.getCurrentUser());
        if (lockscreenSoundsEnabled == 1) {

            mLockSounds.stop(mLockSoundStreamId);
            // Init mAudioManager