diff options
author | xinhe <xinhe@google.com> | 2015-07-14 22:29:17 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-14 22:29:32 +0000 |
commit | d7fb46de591943c402dd13551ca603081ac4e6a7 (patch) | |
tree | c4213691ef0fe0ef41f0ae1c322cb6870b59cd98 | |
parent | e641e7d706095b54ac89f6fcb58c66e2190f46c7 (diff) | |
parent | cbdcca6cf6326af64b13832b797cf28250e0a417 (diff) | |
download | packages_apps_Settings-d7fb46de591943c402dd13551ca603081ac4e6a7.tar.gz packages_apps_Settings-d7fb46de591943c402dd13551ca603081ac4e6a7.tar.bz2 packages_apps_Settings-d7fb46de591943c402dd13551ca603081ac4e6a7.zip |
Merge "Need to disable 5GHz bands for WiFi tethering in Japan" into mnc-dev
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | src/com/android/settings/wifi/WifiApEnabler.java | 19 |
2 files changed, 17 insertions, 4 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 36f19394a..02d92ecaa 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1380,6 +1380,8 @@ <string name="wifi_stopping">Turning off Wi\u2011Fi\u2026</string> <!-- Summary text when Wi-Fi or bluetooth has error --> <string name="wifi_error">Error</string> + <!-- Summary text when wifi SoftAP started failed due to no legal usable channel allowed in this region by regulatory --> + <string name="wifi_sap_no_channel_error">5 GHz band not available in this country</string> <!-- Toast message when Wi-Fi or bluetooth is disallowed in airplane mode --> <string name="wifi_in_airplane_mode">In Airplane mode</string> <!-- Checkbox title for option to notify user when open networks are nearby --> diff --git a/src/com/android/settings/wifi/WifiApEnabler.java b/src/com/android/settings/wifi/WifiApEnabler.java index bf2fa38ef..741c4a7e2 100644 --- a/src/com/android/settings/wifi/WifiApEnabler.java +++ b/src/com/android/settings/wifi/WifiApEnabler.java @@ -47,8 +47,15 @@ public class WifiApEnabler { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (WifiManager.WIFI_AP_STATE_CHANGED_ACTION.equals(action)) { - handleWifiApStateChanged(intent.getIntExtra( - WifiManager.EXTRA_WIFI_AP_STATE, WifiManager.WIFI_AP_STATE_FAILED)); + int state = intent.getIntExtra( + WifiManager.EXTRA_WIFI_AP_STATE, WifiManager.WIFI_AP_STATE_FAILED); + if (state == WifiManager.WIFI_AP_STATE_FAILED) { + int reason = intent.getIntExtra(WifiManager.EXTRA_WIFI_AP_FAILURE_REASON, + WifiManager.SAP_START_FAILURE_GENERAL); + handleWifiApStateChanged(state, reason); + } else { + handleWifiApStateChanged(state, WifiManager.SAP_START_FAILURE_GENERAL); + } } else if (ConnectivityManager.ACTION_TETHER_STATE_CHANGED.equals(action)) { ArrayList<String> available = intent.getStringArrayListExtra( ConnectivityManager.EXTRA_AVAILABLE_TETHER); @@ -142,7 +149,7 @@ public class WifiApEnabler { } } - private void handleWifiApStateChanged(int state) { + private void handleWifiApStateChanged(int state, int reason) { switch (state) { case WifiManager.WIFI_AP_STATE_ENABLING: mSwitch.setSummary(R.string.wifi_tether_starting); @@ -169,7 +176,11 @@ public class WifiApEnabler { break; default: mSwitch.setChecked(false); - mSwitch.setSummary(R.string.wifi_error); + if (reason == WifiManager.SAP_START_FAILURE_NO_CHANNEL) { + mSwitch.setSummary(R.string.wifi_sap_no_channel_error); + } else { + mSwitch.setSummary(R.string.wifi_error); + } enableWifiSwitch(); } } |