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

Commit ad5a748e authored by San Mehat's avatar San Mehat Committed by Android (Google) Code Review
Browse files

Merge "Settings: Add settings for MountService prefs and bump DB version to 46"

parents 923432d5 87734d3b
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -2918,6 +2918,29 @@ public final class Settings {
        public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
                "search_per_source_concurrent_query_limit";

        /**
         * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
         * @hide
         */
        public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";

        /**
         * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
         * @hide
         */
        public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";

        /**
         * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
         * @hide
         */
        public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";

        /**
         * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
         * @hide
         */
        public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";

        
        /**
@@ -2941,6 +2964,10 @@ public final class Settings {
            WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
            WIFI_NUM_ALLOWED_CHANNELS,
            WIFI_NUM_OPEN_NETWORKS_KEPT,
            MOUNT_PLAY_NOTIFICATION_SND,
            MOUNT_UMS_AUTOSTART,
            MOUNT_UMS_PROMPT,
            MOUNT_UMS_NOTIFY_ENABLED
        };

        /**
+6 −0
Original line number Diff line number Diff line
@@ -51,4 +51,10 @@
    <!-- Default value for whether or not to pulse the notification LED when there is a 
         pending notification -->
    <bool name="def_notification_pulse">true</bool>

    <bool name="def_mount_play_notification_snd">true</bool>
    <bool name="def_mount_ums_autostart">false</bool>
    <bool name="def_mount_ums_prompt">true</bool>
    <bool name="def_mount_ums_notify_enabled">true</bool>

</resources>
+37 −4
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
    // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
    // is properly propagated through your change.  Not doing so will result in a loss of user
    // settings.
    private static final int DATABASE_VERSION = 45;
    private static final int DATABASE_VERSION = 46;

    private Context mContext;

@@ -559,6 +559,27 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            upgradeVersion = 45;
        }

        if (upgradeVersion == 45) {
             /*
              * New settings for MountService
              */
            db.beginTransaction();
            try {
                db.execSQL("INSERT INTO secure(name,value) values('" +
                        Settings.Secure.MOUNT_PLAY_NOTIFICATION_SND + "','1');");
                db.execSQL("INSERT INTO secure(name,value) values('" +
                        Settings.Secure.MOUNT_UMS_AUTOSTART + "','0');");
                db.execSQL("INSERT INTO secure(name,value) values('" +
                        Settings.Secure.MOUNT_UMS_PROMPT + "','1');");
                db.execSQL("INSERT INTO secure(name,value) values('" +
                        Settings.Secure.MOUNT_UMS_NOTIFY_ENABLED + "','1');");
                db.setTransactionSuccessful();
            } finally {
                db.endTransaction();
            }
            upgradeVersion = 46;
        }

 
        if (upgradeVersion != currentVersion) {
            Log.w(TAG, "Got stuck trying to upgrade from version " + upgradeVersion
@@ -889,6 +910,18 @@ public class DatabaseHelper extends SQLiteOpenHelper {

        loadSecure35Settings(stmt);

        loadBooleanSetting(stmt, Settings.Secure.MOUNT_PLAY_NOTIFICATION_SND,
                R.bool.def_mount_play_notification_snd);

        loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_AUTOSTART,
                R.bool.def_mount_ums_autostart);

        loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_PROMPT,
                R.bool.def_mount_ums_prompt);

        loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_NOTIFY_ENABLED,
                R.bool.def_mount_ums_notify_enabled);

        stmt.close();
    }