summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/widget
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings/widget')
-rw-r--r--src/com/android/settings/widget/SettingsAppWidgetProvider.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/com/android/settings/widget/SettingsAppWidgetProvider.java b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
index 2fd618c..872d303 100644
--- a/src/com/android/settings/widget/SettingsAppWidgetProvider.java
+++ b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
@@ -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);
}