diff options
author | Bryce Lee <brycelee@google.com> | 2014-10-23 07:55:21 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-23 07:55:21 +0000 |
commit | 477fa012865c3c59ebc2dd834c53c7ee33fe3a95 (patch) | |
tree | b3f45fe444db2ebf5fc52ba544de4b5b5cceb4e6 /packages/SettingsProvider | |
parent | dc546ab7c3b53012908ce6b594f34a5d27de78e1 (diff) | |
parent | 49cb52e296c48613c2177bfcb14fc67e21b9ae03 (diff) | |
download | frameworks_base-477fa012865c3c59ebc2dd834c53c7ee33fe3a95.zip frameworks_base-477fa012865c3c59ebc2dd834c53c7ee33fe3a95.tar.gz frameworks_base-477fa012865c3c59ebc2dd834c53c7ee33fe3a95.tar.bz2 |
am 49cb52e2: Merge "resolved conflicts for merge of f03ba4f1 to lmp-mr1-dev" into lmp-mr1-dev
* commit '49cb52e296c48613c2177bfcb14fc67e21b9ae03':
[Theater Mode] framework implementation through global setting
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 | 30 |
2 files changed, 28 insertions, 3 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 f88ea8b..f21bac0 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -71,7 +71,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 = 114; + private static final int DATABASE_VERSION = 116; private Context mContext; private int mUserHandle; @@ -1828,7 +1828,27 @@ public class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 113; } - if (upgradeVersion < 114) { + // We skipped 114 to handle a merge conflict with the introduction of theater mode. + + if (upgradeVersion < 115) { + if (mUserHandle == UserHandle.USER_OWNER) { + 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 = 115; + } + + if (upgradeVersion < 116) { if (mUserHandle == UserHandle.USER_OWNER) { db.beginTransaction(); SQLiteStatement stmt = null; @@ -1842,8 +1862,9 @@ public class DatabaseHelper extends SQLiteOpenHelper { if (stmt != null) stmt.close(); } } - upgradeVersion = 114; + upgradeVersion = 116; } + // *** Remember to update DATABASE_VERSION above! if (upgradeVersion != currentVersion) { @@ -2440,6 +2461,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); |