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

Commit 1c7fa483 authored by Daniel Sandler's avatar Daniel Sandler
Browse files

Add VIBRATE_IN_SILENT to the settings database & backup.

Change-Id: Id31e24ef0536278ccb66b22bba7ed2b47eb1a371
parent 746f6660
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1708,6 +1708,7 @@ public final class Settings {
            VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
            VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
            VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE,
            VIBRATE_IN_SILENT,
            TEXT_AUTO_REPLACE,
            TEXT_AUTO_CAPS,
            TEXT_AUTO_PUNCTUATE,
+3 −0
Original line number Diff line number Diff line
@@ -70,4 +70,7 @@
    <string name="def_lock_sound" translatable="false">/system/media/audio/ui/Lock.ogg</string>
    <string name="def_unlock_sound" translatable="false">/system/media/audio/ui/Unlock.ogg</string>

    <!-- Default for Settings.System.VIBRATE_IN_SILENT -->
    <bool name="def_vibrate_in_silent">true</bool>

</resources>
+24 −2
Original line number Diff line number Diff line
@@ -61,7 +61,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 = 52;
    private static final int DATABASE_VERSION = 53;

    private Context mContext;

@@ -634,6 +634,25 @@ public class DatabaseHelper extends SQLiteOpenHelper {
           upgradeVersion = 52;
       }

        if (upgradeVersion == 52) {
            // new vibration/silent mode settings
            db.beginTransaction();
            try {
                SQLiteStatement stmt = db.compileStatement("INSERT INTO system(name,value)"
                        + " VALUES(?,?);");
                loadBooleanSetting(stmt, Settings.System.VIBRATE_IN_SILENT,
                        R.bool.def_vibrate_in_silent);
                stmt.close();
                db.setTransactionSuccessful();
            } finally {
                db.endTransaction();
            }

            upgradeVersion = 53;
        }

        // *** Remember to update DATABASE_VERSION above!

        if (upgradeVersion != currentVersion) {
            Log.w(TAG, "Got stuck trying to upgrade from version " + upgradeVersion
                    + ", must wipe the settings provider");
@@ -930,6 +949,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {

        loadUISoundEffectsSettings(stmt);

        loadBooleanSetting(stmt, Settings.System.VIBRATE_IN_SILENT,
                R.bool.def_vibrate_in_silent);

        stmt.close();
    }