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

Commit 4d25afe5 authored by Steve Kondik's avatar Steve Kondik
Browse files

Allow configuration of the default screen-off animation style

Change-Id: Ib59f8fce45c11193104682b975ff6467df8cfc15
parent 526bff98
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -207,4 +207,7 @@

    <!-- Default value of Settings.System.NOISE_SUPPRESSION -->
    <bool name="def_noise_suppression">false</bool>

    <!-- Default value of Settings.System.SCREEN_ANIMATION_STYLE -->
    <integer name="def_screen_animation_style">0</integer>
</resources>
+24 −1
Original line number Diff line number Diff line
@@ -79,7 +79,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 = 99;
    private static final int DATABASE_VERSION = 100;

    private Context mContext;
    private int mUserHandle;
@@ -1617,6 +1617,14 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            upgradeVersion = 99;
        }


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

        // *** Remember to update DATABASE_VERSION above!

        if (upgradeVersion != currentVersion) {
@@ -2036,6 +2044,21 @@ 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 loadSettings(SQLiteDatabase db) {
        loadSystemSettings(db);
        loadSecureSettings(db);