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

Commit b1c561a6 authored by Ian Roy's avatar Ian Roy
Browse files

Dialer AutoComplete: Bootstrap the onUpgrade for the SettingsProvider

to automagically create this setting and enable it by default.

PS2: Delete evil whitespace
PS3: Forgot to update the DB Version

Change-Id: I58eee488d1dee4941713d5cc4503f2f2861462d5
parent daac8cc0
Loading
Loading
Loading
Loading
+20 −1
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 = 97;
    private static final int DATABASE_VERSION = 98;

    private Context mContext;
    private int mUserHandle;
@@ -1542,6 +1542,25 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            upgradeVersion = 97;
        }

        if (upgradeVersion == 97) {
            // Add Default Dialer AutoComplete setting
            if (mUserHandle == UserHandle.USER_OWNER) {
                db.beginTransaction();
                SQLiteStatement stmt = null;
                try {
                    stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)"
                            + " VALUES(?,?);");
                    loadIntegerSetting(stmt, Settings.Secure.DIALPAD_AUTOCOMPLETE,
                            R.integer.def_dialpad_autocomplete);
                    db.setTransactionSuccessful();
                } finally {
                    db.endTransaction();
                    if (stmt != null) stmt.close();
                }
            }
            upgradeVersion = 98;
        }

        // *** Remember to update DATABASE_VERSION above!

        if (upgradeVersion != currentVersion) {