Improve responsiveness of toggling wifi and refactor user restriction logic.

Moved logic for handling wifi state changes into correct listener
method. Changed logic for handling isUiRestricted. This should
streamline toggling flow for WiFi both when Wifi Scanning is on and off,
and in guest mode.

Bug: 36724409
Bug: 36711085
Bug: 36398321

Test: make, test cases in tracking bug
Change-Id: I69fe07369db192c94f81dd678087ac4e8c35197b
This commit is contained in:
Stephen Chen
2017-03-31 14:42:20 -07:00
parent 82e2239c54
commit 19b74d9213
2 changed files with 48 additions and 53 deletions

View File

@@ -57,8 +57,7 @@ public class WifiEnabler implements SwitchWidgetController.OnSwitchChangeListene
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(action)) {
handleWifiStateChanged(intent.getIntExtra(
WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_UNKNOWN));
handleWifiStateChanged(mWifiManager.getWifiState());
} else if (WifiManager.SUPPLICANT_STATE_CHANGED_ACTION.equals(action)) {
if (!mConnected.get()) {
handleStateChanged(WifiInfo.getDetailedStateOf((SupplicantState)