diff options
author | Bryce Lee <brycelee@google.com> | 2014-10-21 15:55:55 -0700 |
---|---|---|
committer | Bryce Lee <brycelee@google.com> | 2014-10-21 15:55:55 -0700 |
commit | 584a44517950204a04ef01345be70b33d8ba43f9 (patch) | |
tree | 064810ffab925197bac2fb8aae2f1df03df0b5d5 /packages/SettingsProvider | |
parent | e463bc388e7f5d83f864b320dde400e390ef5817 (diff) | |
download | frameworks_base-584a44517950204a04ef01345be70b33d8ba43f9.zip frameworks_base-584a44517950204a04ef01345be70b33d8ba43f9.tar.gz frameworks_base-584a44517950204a04ef01345be70b33d8ba43f9.tar.bz2 |
[Theater Mode] framework implementation through global setting
Bug: 17684570
Change-Id: I64a9c9c0620049cdfcca0150648fa201281f7178
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); |