Do a clean WifiWatchdog shutdown

Killing the WifiWatchdogService thread from
WifiService can cause messages to be handled on
a dead thread. Quit the thread on the broadcast
instead.

A couple of more fixes:
- Do an asynchronous bring up of Wifi. This will
allow WifiWatchdogServiceThread to be immediately
brought up, instead of relying on an update.

- There is no need to listen on supplicant connection
in wifiwatchdog anymore. We kill the thread when
supplicant connection is no more.

Bug: 2546756
Change-Id: I9beae3eebee9cf0446d1dc031ce8fc1c27943521
This commit is contained in:
Irfan Sheriff
2010-03-26 14:56:07 -07:00
parent a3bd409a0a
commit 288b4ac945
2 changed files with 5 additions and 18 deletions

View File

@@ -268,7 +268,7 @@ public class WifiService extends IWifiManager.Stub {
boolean wifiEnabled = getPersistedWifiEnabled() || testAndClearWifiSavedState();
Slog.i(TAG, "WifiService starting up with Wi-Fi " +
(wifiEnabled ? "enabled" : "disabled"));
setWifiEnabledBlocking(wifiEnabled, true, Process.myUid());
setWifiEnabled(wifiEnabled);
}
private void updateTetherState(ArrayList<String> available, ArrayList<String> tethered) {
@@ -1857,10 +1857,10 @@ public class WifiService extends IWifiManager.Stub {
switch (msg.what) {
case MESSAGE_ENABLE_WIFI:
setWifiEnabledBlocking(true, msg.arg1 == 1, msg.arg2);
if (mWifiWatchdogService == null) {
mWifiWatchdogService = new WifiWatchdogService(mContext, mWifiStateTracker);
}
setWifiEnabledBlocking(true, msg.arg1 == 1, msg.arg2);
sWakeLock.release();
break;
@@ -1878,10 +1878,7 @@ public class WifiService extends IWifiManager.Stub {
// a non-zero msg.arg1 value means the "enabled" setting
// should be persisted
setWifiEnabledBlocking(false, msg.arg1 == 1, msg.arg2);
if (mWifiWatchdogService != null) {
mWifiWatchdogService.quit();
mWifiWatchdogService = null;
}
mWifiWatchdogService = null;
sWakeLock.release();
break;