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

Commit b4df8bc5 authored by Ben Lin's avatar Ben Lin
Browse files

Use value from XML for Secure.NOTIFICATION_BADGING.

Config config_notificationBadging was created, and it was used for
showing/hiding the toggle in Settings app. However, since there's no
default value for Settings.Secure.NOTIFICATION_BADGING, it is possible
to be in a state where there's no toggle, and the user is stuck having
it turned on. This change pulls in config_notificationBadging for also
the default value of Secure.NOTIFICATION_BADGING.

Bug: 36021111
Test: Build, flashed and confirmed proper config value. Also don't see
the toggle anymore in Settings app.

Change-Id: Idbf162040d29cf2456356e7c628a29b26fef6363
parent a43f7fde
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -3015,7 +3015,7 @@ public class SettingsProvider extends ContentProvider {
        }

        private final class UpgradeController {
            private static final int SETTINGS_VERSION = 153;
            private static final int SETTINGS_VERSION = 154;

            private final int mUserId;

@@ -3620,6 +3620,23 @@ public class SettingsProvider extends ContentProvider {
                    currentVersion = 153;
                }

                if (currentVersion == 153) {
                    // Version 154: Read notification badge configuration from config.
                    // If user has already set the value, don't do anything.
                    final SettingsState systemSecureSettings = getSecureSettingsLocked(userId);
                    final Setting showNotificationBadges = systemSecureSettings.getSettingLocked(
                            Settings.Secure.NOTIFICATION_BADGING);
                    if (showNotificationBadges.isNull()) {
                        final boolean defaultValue = getContext().getResources().getBoolean(
                                com.android.internal.R.bool.config_notificationBadging);
                        systemSecureSettings.insertSettingLocked(
                                Secure.NOTIFICATION_BADGING,
                                defaultValue ? "1" : "0",
                                null, true, SettingsState.SYSTEM_PACKAGE_NAME);
                    }
                    currentVersion = 154;
                }

                // vXXX: Add new settings above this point.

                if (currentVersion != newVersion) {