am b99fe5e6: cherry-pick 288b4ac945 into froyo

Merge commit 'b99fe5e622aa5419d80c02e3fab614372f44bc2a' into froyo-plus-aosp

* commit 'b99fe5e622aa5419d80c02e3fab614372f44bc2a':
  cherry-pick 288b4ac945 into froyo
This commit is contained in:
Irfan Sheriff
2010-03-29 12:07:37 -07:00
committed by Android Git Automerger
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;

View File

@@ -251,7 +251,6 @@ public class WifiWatchdogService {
private void registerForWifiBroadcasts() {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
intentFilter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
mContext.registerReceiver(mReceiver, intentFilter);
}
@@ -276,7 +275,7 @@ public class WifiWatchdogService {
/**
* Unregister broadcasts and quit the watchdog thread
*/
public void quit() {
private void quit() {
unregisterForWifiBroadcasts();
mContext.getContentResolver().unregisterContentObserver(mContentObserver);
mHandler.removeAllActions();
@@ -1117,9 +1116,6 @@ public class WifiWatchdogService {
if (action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
handleNetworkStateChanged(
(NetworkInfo) intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO));
} else if (action.equals(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION)) {
handleSupplicantConnectionChanged(
intent.getBooleanExtra(WifiManager.EXTRA_SUPPLICANT_CONNECTED, false));
} else if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
handleWifiStateChanged(intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
WifiManager.WIFI_STATE_UNKNOWN));
@@ -1153,15 +1149,9 @@ public class WifiWatchdogService {
}
}
private void handleSupplicantConnectionChanged(boolean connected) {
if (!connected) {
onDisconnected();
}
}
private void handleWifiStateChanged(int wifiState) {
if (wifiState == WifiManager.WIFI_STATE_DISABLED) {
onDisconnected();
quit();
} else if (wifiState == WifiManager.WIFI_STATE_ENABLED) {
onEnabled();
}