diff options
author | Erik Pasternak <roboerik@android.com> | 2014-10-02 00:04:01 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-02 00:04:01 +0000 |
commit | 739bf81dd130957c9bc09abc4e25732af2d675c0 (patch) | |
tree | 0b2a7ff4bdfd4ef7c381850eee12bd7e9201e1ea /packages/SettingsProvider | |
parent | 3a14bc8430dbdafbf8d2484b0b4396034f78ae48 (diff) | |
parent | 4d82c46ef5df06e1b92f3574e41b38a62ec0e607 (diff) | |
download | frameworks_base-739bf81dd130957c9bc09abc4e25732af2d675c0.zip frameworks_base-739bf81dd130957c9bc09abc4e25732af2d675c0.tar.gz frameworks_base-739bf81dd130957c9bc09abc4e25732af2d675c0.tar.bz2 |
am 4d82c46e: Merge "Implement auto-sleep functionality." into lmp-dev
* commit '4d82c46ef5df06e1b92f3574e41b38a62ec0e607':
Implement auto-sleep functionality.
Diffstat (limited to 'packages/SettingsProvider')
-rw-r--r-- | packages/SettingsProvider/res/values/defaults.xml | 1 | ||||
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 20 |
2 files changed, 20 insertions, 1 deletions
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 934ed38..efba03d 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -19,6 +19,7 @@ <resources> <bool name="def_dim_screen">true</bool> <integer name="def_screen_off_timeout">60000</integer> + <integer name="def_sleep_timeout">-1</integer> <bool name="def_airplane_mode_on">false</bool> <!-- Comma-separated list of bluetooth, wifi, and cell. --> <string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi,nfc,wimax</string> diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index 873257c..b17b4cc 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -70,7 +70,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 = 112; + private static final int DATABASE_VERSION = 113; private Context mContext; private int mUserHandle; @@ -1811,6 +1811,22 @@ public class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 112; } + if (upgradeVersion < 113) { + db.beginTransaction(); + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)" + + " VALUES(?,?);"); + loadIntegerSetting(stmt, Settings.Secure.SLEEP_TIMEOUT, + R.integer.def_sleep_timeout); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + if (stmt != null) stmt.close(); + } + upgradeVersion = 113; + } + // *** Remember to update DATABASE_VERSION above! if (upgradeVersion != currentVersion) { @@ -2382,6 +2398,8 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadBooleanSetting(stmt, Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, R.bool.def_lock_screen_allow_private_notifications); + loadIntegerSetting(stmt, Settings.Secure.SLEEP_TIMEOUT, + R.integer.def_sleep_timeout); } finally { if (stmt != null) stmt.close(); } |