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

Commit f1cbfff0 authored by Oscar Montemayor's avatar Oscar Montemayor
Browse files

Fix bug when adding SET_INSTALL_LOCATION to SettingsProvider database, upgrade path.

parent 582ae172
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -76,7 +76,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 = 50;
    private static final int DATABASE_VERSION = 51;

    private Context mContext;

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

       if (upgradeVersion == 50) {
           /*
            * New settings for set install location UI.
            */
           db.beginTransaction();
           try {
                SQLiteStatement stmt = db.compileStatement("INSERT INTO system(name,value)"
                        + " VALUES(?,?);");
                loadBooleanSetting(stmt, Settings.System.SET_INSTALL_LOCATION,
                        R.bool.set_install_location);
                stmt.close();
                db.setTransactionSuccessful();
            } finally {
                db.endTransaction();
            }

           upgradeVersion = 51;
       }

       if (upgradeVersion != currentVersion) {
            Log.w(TAG, "Got stuck trying to upgrade from version " + upgradeVersion
                    + ", must wipe the settings provider");