diff options
author | Bryce Lee <brycelee@google.com> | 2014-10-22 20:33:07 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-10-22 20:33:08 +0000 |
commit | f03ba4f13ba835c670d7c471f91a3083846ab082 (patch) | |
tree | 463885e229c0ac0bd264098d296542cc89f1a1ce /packages/SettingsProvider | |
parent | 265e3da00668a0769be331349541050dd6603c2b (diff) | |
parent | 584a44517950204a04ef01345be70b33d8ba43f9 (diff) | |
download | frameworks_base-f03ba4f13ba835c670d7c471f91a3083846ab082.zip frameworks_base-f03ba4f13ba835c670d7c471f91a3083846ab082.tar.gz frameworks_base-f03ba4f13ba835c670d7c471f91a3083846ab082.tar.bz2 |
Merge "[Theater Mode] framework implementation through global setting" into lmp-sprout-dev
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 | 21 |
2 files changed, 21 insertions, 1 deletions
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index efba03d..16c6075 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -21,6 +21,7 @@ <integer name="def_screen_off_timeout">60000</integer> <integer name="def_sleep_timeout">-1</integer> <bool name="def_airplane_mode_on">false</bool> + <bool name="def_theater_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> <string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi,nfc</string> diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index b17b4cc..8ac1c96 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 = 113; + private static final int DATABASE_VERSION = 114; private Context mContext; private int mUserHandle; @@ -1827,6 +1827,22 @@ public class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 113; } + if (upgradeVersion < 114) { + db.beginTransaction(); + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT OR IGNORE INTO global(name,value)" + + " VALUES(?,?);"); + loadBooleanSetting(stmt, Global.THEATER_MODE_ON, + R.bool.def_theater_mode_on); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + if (stmt != null) stmt.close(); + } + upgradeVersion = 114; + } + // *** Remember to update DATABASE_VERSION above! if (upgradeVersion != currentVersion) { @@ -2423,6 +2439,9 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadBooleanSetting(stmt, Settings.Global.AIRPLANE_MODE_ON, R.bool.def_airplane_mode_on); + loadBooleanSetting(stmt, Settings.Global.THEATER_MODE_ON, + R.bool.def_theater_mode_on); + loadStringSetting(stmt, Settings.Global.AIRPLANE_MODE_RADIOS, R.string.def_airplane_mode_radios); |