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

Commit 55b02226 authored by Eric Laurent's avatar Eric Laurent
Browse files

fix settings data base upgrade for ringer mode

Ringer mode setting was moved from System to Global group
but a db upgrade cleanup step was missing.

Bug 7128886.

Change-Id: Id20994fe74575afa2b68154a620aa3c8807e8304
parent 5a829cbf
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -68,7 +68,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 = 91;
    private static final int DATABASE_VERSION = 92;

    private Context mContext;
    private int mUserHandle;
@@ -1433,6 +1433,22 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            upgradeVersion = 91;
        }

        if (upgradeVersion == 91) {
            if (mUserHandle == UserHandle.USER_OWNER) {
                db.beginTransaction();
                try {
                    // Move ringer mode from system to global settings
                    String[] settingsToMove = { Settings.System.MODE_RINGER };
                    moveSettingsToNewTable(db, TABLE_SYSTEM, TABLE_GLOBAL, settingsToMove, true);

                    db.setTransactionSuccessful();
                } finally {
                    db.endTransaction();
                }
            }
            upgradeVersion = 92;
        }

        // *** Remember to update DATABASE_VERSION above!

        if (upgradeVersion != currentVersion) {
@@ -1757,9 +1773,6 @@ public class DatabaseHelper extends SQLiteOpenHelper {
                    Settings.System.VOLUME_BLUETOOTH_SCO,
                    AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_BLUETOOTH_SCO]);

            loadSetting(stmt, Settings.System.MODE_RINGER,
                    AudioManager.RINGER_MODE_NORMAL);

            // By default:
            // - ringtones, notification, system and music streams are affected by ringer mode
            // on non voice capable devices (tablets)
@@ -2049,6 +2062,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            loadIntegerSetting(stmt, Settings.Global.WIFI_SLEEP_POLICY,
                    R.integer.def_wifi_sleep_policy);

            loadSetting(stmt, Settings.Global.MODE_RINGER,
                    AudioManager.RINGER_MODE_NORMAL);

            // --- Previously in 'secure'
            loadBooleanSetting(stmt, Settings.Global.PACKAGE_VERIFIER_ENABLE,
                    R.bool.def_package_verifier_enable);