diff options
author | Christopher Tate <ctate@google.com> | 2013-06-10 16:55:02 -0700 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2013-06-10 16:55:02 -0700 |
commit | 87bc7e7082ed2093ac7b5ee241439c54cf71b8f6 (patch) | |
tree | 589fc60e5d962feec533d3ec551d66bce938c564 /packages/SettingsProvider/src/com/android | |
parent | 58100fb813f4a68386757fc80244dbb756ea35d5 (diff) | |
download | frameworks_base-87bc7e7082ed2093ac7b5ee241439c54cf71b8f6.zip frameworks_base-87bc7e7082ed2093ac7b5ee241439c54cf71b8f6.tar.gz frameworks_base-87bc7e7082ed2093ac7b5ee241439c54cf71b8f6.tar.bz2 |
Need to explicitly disable scan-always when turning off wifi
... when you want wifi to be really most sincerely off, because
settings restore is about to rewrite the conf file.
Bug 9032154
Change-Id: I6a3a34ac3f14ec43aa9d9cc0159fca6168ccd0a2
Diffstat (limited to 'packages/SettingsProvider/src/com/android')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java index 0b85e70..3f04470 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java @@ -20,6 +20,7 @@ import android.app.backup.BackupAgentHelper; import android.app.backup.BackupDataInput; import android.app.backup.BackupDataOutput; import android.app.backup.FullBackupDataOutput; +import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; @@ -330,7 +331,16 @@ public class SettingsBackupAgent extends BackupAgentHelper { if (DEBUG_BACKUP) { Log.v(TAG, "Starting deferred restore of wifi data"); } + final ContentResolver cr = getContentResolver(); + final int scanAlways = Settings.Global.getInt(cr, + Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0); final int retainedWifiState = enableWifi(false); + if (scanAlways != 0) { + Settings.Global.putInt(cr, + Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0); + // !!! Give the wifi stack a moment to quiesce + try { Thread.sleep(1000); } catch (InterruptedException e) {} + } if (restoredSupplicantData != null) { restoreWifiSupplicant(FILE_WIFI_SUPPLICANT, restoredSupplicantData, restoredSupplicantData.length); @@ -344,6 +354,10 @@ public class SettingsBackupAgent extends BackupAgentHelper { restoredWifiConfigFile, restoredWifiConfigFile.length); } // restore the previous WIFI state. + if (scanAlways != 0) { + Settings.Global.putInt(cr, + Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, scanAlways); + } enableWifi(retainedWifiState == WifiManager.WIFI_STATE_ENABLED || retainedWifiState == WifiManager.WIFI_STATE_ENABLING); } |