Disable tethering to enable Wifi

We need to explicitly disable wifi while enabling
tethering and disable tethering while enabling wifi

Bug: 2539071
Change-Id: I7fda6e4d9d1bb804e81561d52b5f3a982a674b0e
This commit is contained in:
Irfan Sheriff
2010-03-24 12:14:28 -07:00
parent 305b0fb47c
commit a6a74e222a
3 changed files with 26 additions and 0 deletions

View File

@@ -248,6 +248,15 @@ public class SettingsAppWidgetProvider extends AppWidgetProvider {
if (withToast) {
Toast.makeText(context, R.string.gadget_toggle_wifi, Toast.LENGTH_SHORT).show();
}
/**
* Disable tethering if enabling Wifi
*/
int wifiApState = wifiManager.getWifiApState();
if (desiredState && ((wifiApState == WifiManager.WIFI_AP_STATE_ENABLING) ||
(wifiApState == WifiManager.WIFI_AP_STATE_ENABLED))) {
wifiManager.setWifiApEnabled(null, false);
}
wifiManager.setWifiEnabled(desiredState);
}