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

Unverified Commit 3c2a5dcb authored by LuK1337's avatar LuK1337 Committed by Michael Bestas
Browse files

core: Fix uninitialized settings in NotificationAttentionHelper

Similar code exists in NotificationManagerService and without it, the
notification LED doesn't work until settings are changed in runtime.

Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/7423
Change-Id: I590501f69ea6eac2263a590f9cef636c3bdb35d3
parent cefd5bab
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -336,6 +336,7 @@ public final class NotificationAttentionHelper {
                    SettingsObserver.NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED_URI, false,
                    mSettingsObserver, UserHandle.USER_ALL);
        }
        mSettingsObserver.onChange(false, null);
    }

    private void loadUserSettings() {
@@ -1742,7 +1743,7 @@ public final class NotificationAttentionHelper {

        @Override
        public void onChange(boolean selfChange, Uri uri) {
            if (NOTIFICATION_LIGHT_PULSE_URI.equals(uri)) {
            if (uri == null || NOTIFICATION_LIGHT_PULSE_URI.equals(uri)) {
                boolean pulseEnabled = Settings.System.getIntForUser(
                        mContext.getContentResolver(),
                        Settings.System.NOTIFICATION_LIGHT_PULSE, 0,
@@ -1754,7 +1755,7 @@ public final class NotificationAttentionHelper {
                }
            }
            if (Flags.politeNotifications()) {
                if (NOTIFICATION_COOLDOWN_ENABLED_URI.equals(uri)) {
                if (uri == null || NOTIFICATION_COOLDOWN_ENABLED_URI.equals(uri)) {
                    mNotificationCooldownEnabled = Settings.System.getIntForUser(
                            mContext.getContentResolver(),
                            Settings.System.NOTIFICATION_COOLDOWN_ENABLED,
@@ -1772,7 +1773,7 @@ public final class NotificationAttentionHelper {
                        mNotificationCooldownForWorkEnabled = false;
                    }
                }
                if (NOTIFICATION_COOLDOWN_ALL_URI.equals(uri)) {
                if (uri == null || NOTIFICATION_COOLDOWN_ALL_URI.equals(uri)) {
                    mNotificationCooldownApplyToAll = Settings.System.getIntForUser(
                            mContext.getContentResolver(),
                            Settings.System.NOTIFICATION_COOLDOWN_ALL,
@@ -1781,7 +1782,7 @@ public final class NotificationAttentionHelper {
                    mStrategy.setApplyCooldownPerPackage(mNotificationCooldownApplyToAll);
                }
                if (Flags.vibrateWhileUnlocked()) {
                    if (NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED_URI.equals(uri)) {
                    if (uri == null || NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED_URI.equals(uri)) {
                        mNotificationCooldownVibrateUnlocked = Settings.System.getIntForUser(
                            mContext.getContentResolver(),
                            Settings.System.NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED,