Loading res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -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 --> Loading src/com/android/settings/wifi/WifiApEnabler.java +15 −4 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); Loading @@ -169,7 +176,11 @@ public class WifiApEnabler { break; default: mSwitch.setChecked(false); 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(); } } Loading Loading
res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -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 --> Loading
src/com/android/settings/wifi/WifiApEnabler.java +15 −4 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); Loading @@ -169,7 +176,11 @@ public class WifiApEnabler { break; default: mSwitch.setChecked(false); 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(); } } Loading