diff options
author | Li Wei <liwei@codeaurora.org> | 2015-10-22 13:31:36 +0800 |
---|---|---|
committer | Li Wei <liwei@codeaurora.org> | 2015-10-22 13:31:36 +0800 |
commit | 4350408f51fa65d7bfd9bd7de1f490f8ba381941 (patch) | |
tree | f3bf951ca2979044ee9ad65df3f612ab150b85c5 /packages | |
parent | caaba96fcb34849406e362759931ffa4340a89c5 (diff) | |
download | frameworks_base-4350408f51fa65d7bfd9bd7de1f490f8ba381941.zip frameworks_base-4350408f51fa65d7bfd9bd7de1f490f8ba381941.tar.gz frameworks_base-4350408f51fa65d7bfd9bd7de1f490f8ba381941.tar.bz2 |
Support for configuring captive portal detection enabled by user
1. Add an item into default configuration so that user can overlay it
2. Enable captive portal detection by default
CRs-Fixed: 822072
Change-Id: I10c58a58c5b79dd2d7ea081a71f3752dd9928868
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SettingsProvider/res/values/defaults.xml | 3 | ||||
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 12 |
2 files changed, 13 insertions, 2 deletions
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 1cd2908..bbf176b 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -212,4 +212,7 @@ <!-- Default for Settings.Secure.NFC_PAYMENT_COMPONENT --> <string name="def_nfc_payment_component"></string> + + <!-- Default for Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED --> + <integer name="def_captive_portal_detection_enabled" translatable="false">1</integer> </resources> diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index 5a14967..0a4ce0e 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -1388,6 +1388,7 @@ class DatabaseHelper extends SQLiteOpenHelper { if (upgradeVersion == 88) { if (mUserHandle == UserHandle.USER_OWNER) { db.beginTransaction(); + SQLiteStatement stmt = null; try { String[] settingsToMove = { Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD, @@ -1407,7 +1408,6 @@ class DatabaseHelper extends SQLiteOpenHelper { Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES, Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS, Settings.Global.CONNECTIVITY_CHANGE_DELAY, - Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED, Settings.Global.CAPTIVE_PORTAL_SERVER, Settings.Global.NSD_ON, Settings.Global.SET_INSTALL_LOCATION, @@ -1423,9 +1423,16 @@ class DatabaseHelper extends SQLiteOpenHelper { Settings.Global.DEFAULT_DNS_SERVER, }; moveSettingsToNewTable(db, TABLE_SECURE, TABLE_GLOBAL, settingsToMove, true); + + stmt = db.compileStatement("INSERT OR REPLACE INTO global(name,value)" + + " VALUES(?,?);"); + loadIntegerSetting(stmt, Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED, + R.integer.def_captive_portal_detection_enabled); + stmt.close(); db.setTransactionSuccessful(); } finally { db.endTransaction(); + if (stmt != null) stmt.close(); } } upgradeVersion = 89; @@ -2709,7 +2716,6 @@ class DatabaseHelper extends SQLiteOpenHelper { R.bool.def_guest_user_enabled); loadSetting(stmt, Settings.Global.ENHANCED_4G_MODE_ENABLED, ImsConfig.FeatureValueConstants.ON); - /* * IMPORTANT: Do not add any more upgrade steps here as the global, * secure, and system settings are no longer stored in a database @@ -2717,6 +2723,8 @@ class DatabaseHelper extends SQLiteOpenHelper { * * See: SettingsProvider.UpgradeController#onUpgradeLocked */ + loadIntegerSetting(stmt, Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED, + R.integer.def_captive_portal_detection_enabled); } finally { if (stmt != null) stmt.close(); } |