summaryrefslogtreecommitdiffstats
path: root/packages/SettingsProvider
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2010-03-30 15:27:35 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-03-30 15:27:35 -0700
commit0e19e2b265dd783d82c71e1ac8aa6637ee8c9844 (patch)
treed2f0ea1bef71736c5e68acd1cc7b4ac3883069fc /packages/SettingsProvider
parentbe2059b0a01057764e6ce6b8e0ba225552b81488 (diff)
parente133177980b908d183ed8fe46cf3ea33405b8bd5 (diff)
downloadframeworks_base-0e19e2b265dd783d82c71e1ac8aa6637ee8c9844.zip
frameworks_base-0e19e2b265dd783d82c71e1ac8aa6637ee8c9844.tar.gz
frameworks_base-0e19e2b265dd783d82c71e1ac8aa6637ee8c9844.tar.bz2
am e1331779: am 95a321fc: Merge "Fix for Never not existing in latest timeout values." into froyo
Merge commit 'e133177980b908d183ed8fe46cf3ea33405b8bd5' into kraken * commit 'e133177980b908d183ed8fe46cf3ea33405b8bd5': Fix for Never not existing in latest timeout values.
Diffstat (limited to 'packages/SettingsProvider')
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java40
1 files changed, 39 insertions, 1 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 2ad663d..d0e9dd9 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -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 = 54;
+ private static final int DATABASE_VERSION = 55;
private Context mContext;
@@ -681,6 +681,21 @@ public class DatabaseHelper extends SQLiteOpenHelper {
upgradeVersion = 54;
}
+ if (upgradeVersion == 54) {
+ /*
+ * Update the screen timeout value if set to never
+ */
+ db.beginTransaction();
+ try {
+ upgradeScreenTimeoutFromNever(db);
+ db.setTransactionSuccessful();
+ } finally {
+ db.endTransaction();
+ }
+
+ upgradeVersion = 55;
+ }
+
// *** Remember to update DATABASE_VERSION above!
if (upgradeVersion != currentVersion) {
@@ -762,6 +777,29 @@ public class DatabaseHelper extends SQLiteOpenHelper {
}
}
+ private void upgradeScreenTimeoutFromNever(SQLiteDatabase db) {
+ // See if the timeout is -1 (for "Never").
+ Cursor c = db.query("system", new String[] { "_id", "value" }, "name=? AND value=?",
+ new String[] { Settings.System.SCREEN_OFF_TIMEOUT, "-1" },
+ null, null, null);
+
+ SQLiteStatement stmt = null;
+ if (c.getCount() > 0) {
+ c.close();
+ try {
+ stmt = db.compileStatement("INSERT OR REPLACE INTO system(name,value)"
+ + " VALUES(?,?);");
+
+ // Set the timeout to 30 minutes in milliseconds
+ loadIntegerSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT, 30 * 60 * 1000);
+ } finally {
+ if (stmt != null) stmt.close();
+ }
+ } else {
+ c.close();
+ }
+ }
+
/**
* Loads the default set of bookmarked shortcuts from an xml file.
*