summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/widget
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2010-03-24 12:14:28 -0700
committerIrfan Sheriff <isheriff@google.com>2010-03-25 11:39:11 -0700
commita6a74e222a994e29a1daa7178943a1fc9dd06c47 (patch)
tree7ff67bf75e4294a32c017bd541a14f7ad98773d3 /src/com/android/settings/widget
parent305b0fb47c16f5ded987a9fcd7a9aa22fc70c2eb (diff)
downloadpackages_apps_Settings-a6a74e222a994e29a1daa7178943a1fc9dd06c47.zip
packages_apps_Settings-a6a74e222a994e29a1daa7178943a1fc9dd06c47.tar.gz
packages_apps_Settings-a6a74e222a994e29a1daa7178943a1fc9dd06c47.tar.bz2
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
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);
}