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

Commit c95db91a authored by Steve Kondik's avatar Steve Kondik
Browse files

settings: Fix loading of some initial values

Change-Id: I41658dd8dc3f31b4463ae4d4f3cd6f480a0ccba3
(cherry picked from commit 8f754f51)
parent e3cc2af4
Loading
Loading
Loading
Loading
+6 −34
Original line number Diff line number Diff line
@@ -1618,25 +1618,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            upgradeVersion = 99;
        }

        if (upgradeVersion == 99) {
            if (mUserHandle == UserHandle.USER_OWNER) {
                loadScreenAnimationStyle(db);
            }
            upgradeVersion = 100;
        }

        if (upgradeVersion == 100) {
            // We're setting some new defaults on these for certain devices, and adding
            // a default for animator duration. Load them if the user hasn't set them.
            db.beginTransaction();
            SQLiteStatement stmt = null;
            try {
                stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value) VALUES(?,?);");
                loadDefaultAnimationSettings(stmt);
                    db.setTransactionSuccessful();
            } finally {
                db.endTransaction();
            }
        if (upgradeVersion == 99 || upgradeVersion == 100) {
            upgradeVersion = 101;
        }

@@ -2073,21 +2055,6 @@ public class DatabaseHelper extends SQLiteOpenHelper {
        }
    }

    private void loadScreenAnimationStyle(SQLiteDatabase db) {
        db.beginTransaction();
        SQLiteStatement stmt = null;
        try {
            stmt = db.compileStatement("INSERT OR REPLACE INTO system(name,value)"
                    + " VALUES(?,?);");
            loadIntegerSetting(stmt, Settings.System.SCREEN_ANIMATION_STYLE,
                    R.integer.def_screen_animation_style);
            db.setTransactionSuccessful();
        } finally {
            db.endTransaction();
            if (stmt != null) stmt.close();
        }
    }

    private void loadRibbonSetting(SQLiteStatement stmt) {
        String tiles = mContext.getResources().getString(R.string.def_quick_settings_ribbon_tiles);
        if (!TextUtils.isEmpty(tiles)) {
@@ -2190,6 +2157,11 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            loadIntegerSetting(stmt, Settings.System.DOUBLE_TAP_SLEEP_GESTURE,
                    R.integer.def_double_tap_sleep_gesture);

            loadIntegerSetting(stmt, Settings.System.SCREEN_ANIMATION_STYLE,
                    R.integer.def_screen_animation_style);

            loadDefaultAnimationSettings(stmt);

            loadRibbonSetting(stmt);

            loadHeadsUpSetting(stmt);