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

Commit 65340f1c authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Update screen timeout again."

parents cc34eed5 79373f66
Loading
Loading
Loading
Loading
+24 −14
Original line number Diff line number Diff line
@@ -61,7 +61,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 = 61;
    private static final int DATABASE_VERSION = 62;

    private Context mContext;

@@ -793,22 +793,15 @@ public class DatabaseHelper extends SQLiteOpenHelper {
        }

        if (upgradeVersion == 60) {
            // Increase screen timeout for tablet
            db.beginTransaction();
            SQLiteStatement stmt = null;
            try {
                stmt = db.compileStatement("INSERT OR REPLACE INTO system(name,value)"
                        + " VALUES(?,?);");
                loadIntegerSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT,
                        R.integer.def_screen_off_timeout); 
                db.setTransactionSuccessful();
            } finally {
                db.endTransaction();
                if (stmt != null) stmt.close();
            }
            upgradeScreenTimeout(db);
            upgradeVersion = 61;
        }

        if (upgradeVersion == 61) {
            upgradeScreenTimeout(db);
            upgradeVersion = 62;
        }

        // *** Remember to update DATABASE_VERSION above!

        if (upgradeVersion != currentVersion) {
@@ -914,6 +907,23 @@ public class DatabaseHelper extends SQLiteOpenHelper {
        }
    }

    private void upgradeScreenTimeout(SQLiteDatabase db) {
        // Change screen timeout to current default
        db.beginTransaction();
        SQLiteStatement stmt = null;
        try {
            stmt = db.compileStatement("INSERT OR REPLACE INTO system(name,value)"
                    + " VALUES(?,?);");
            loadIntegerSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT,
                    R.integer.def_screen_off_timeout);
            db.setTransactionSuccessful();
        } finally {
            db.endTransaction();
            if (stmt != null)
                stmt.close();
        }
    }

    /**
     * Loads the default set of bookmarked shortcuts from an xml file.
     *