Wait a bit longer for wifi to shut down before rewriting the config

We've seen case of it taking longer than 1500ms for the wifi system to
actually shut down after the triggering settings element is written,
so extend the wait time a bit.  We've seen it take more than 1500ms
but not more than 2500ms, so that's the new heuristic.

This will of course all become happily obsolete once we start
applying restored AP definitions programmatically rather than by
filesystem-level operations.

Bug 22979342

Change-Id: I6acf1baac23d4100124093128b82abf242b11a0e
This commit is contained in:
Christopher Tate
2015-08-07 10:57:01 -07:00
parent bb55aa1a93
commit 907e01eb70

View File

@@ -447,8 +447,10 @@ public class SettingsBackupAgent extends BackupAgentHelper {
Settings.Global.putInt(cr,
Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0);
}
// !!! Give the wifi stack a moment to quiesce
try { Thread.sleep(1500); } catch (InterruptedException e) {}
// !!! Give the wifi stack a moment to quiesce. We've observed the
// response to disabling WIFI_SCAN_ALWAYS_AVAILABLE taking more
// than 1500ms, so we wait a generous 2500 here before proceeding.
try { Thread.sleep(2500); } catch (InterruptedException e) {}
if (restoredSupplicantData != null) {
restoreWifiSupplicant(FILE_WIFI_SUPPLICANT,
restoredSupplicantData, restoredSupplicantData.length);