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:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user