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

Commit ea35e07e authored by Andre Lago's avatar Andre Lago
Browse files

[Settings] Added setting SYNC_PARENT_SOUNDS

Added a setting that specifies wether a managed profile's ringtones
should be the same as its parent

Change-Id: I90e20cee111640404c3758030f41d5b2b5af1c28
parent c20cfa69
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -6061,6 +6061,17 @@ public final class Settings {
        public static final String VOLUME_CONTROLLER_SERVICE_COMPONENT
                = "volume_controller_service_component";

        /**
         * Defines whether managed profile ringtones should be synced from it's parent profile
         * <p>
         * 0 = ringtones are not synced
         * 1 = ringtones are synced from the profile's parent (default)
         * <p>
         * This value is only used for managed profiles.
         * @hide
         */
        public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds";

        /** @hide */
        public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations";

@@ -6432,7 +6443,8 @@ public final class Settings {
            NIGHT_DISPLAY_CUSTOM_START_TIME,
            NIGHT_DISPLAY_CUSTOM_END_TIME,
            NIGHT_DISPLAY_AUTO_MODE,
            NIGHT_DISPLAY_ACTIVATED
            NIGHT_DISPLAY_ACTIVATED,
            SYNC_PARENT_SOUNDS
        };

        /**
+3 −0
Original line number Diff line number Diff line
@@ -89,6 +89,9 @@
    <!-- Default for Settings.System.VIBRATE_IN_SILENT -->
    <bool name="def_vibrate_in_silent">true</bool>

    <!-- Default for Settings.Secure.SYNC_PARENT_SOUNDS -->
    <bool name="def_sync_parent_sounds">true</bool>

    <!-- Default for Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION -->
    <bool name="def_accessibility_script_injection">false</bool>

+13 −1
Original line number Diff line number Diff line
@@ -2108,7 +2108,7 @@ public class SettingsProvider extends ContentProvider {
        }

        private final class UpgradeController {
            private static final int SETTINGS_VERSION = 131;
            private static final int SETTINGS_VERSION = 132;

            private final int mUserId;

@@ -2432,6 +2432,18 @@ public class SettingsProvider extends ContentProvider {
                    currentVersion = 131;
                }

                if (currentVersion == 131) {
                    // Version 131: Allow managed profile to optionally use the parent's ringtones
                    final SettingsState systemSecureSettings = getSecureSettingsLocked(userId);
                    String defaultSyncParentSounds = (getContext().getResources()
                            .getBoolean(R.bool.def_sync_parent_sounds) ? "1" : "0");
                    systemSecureSettings.insertSettingLocked(
                            Settings.Secure.SYNC_PARENT_SOUNDS,
                            defaultSyncParentSounds,
                            SettingsState.SYSTEM_PACKAGE_NAME);
                    currentVersion = 132;
                }

                if (currentVersion != newVersion) {
                    Slog.w("SettingsProvider", "warning: upgrading settings database to version "
                            + newVersion + " left it at "