Merge "Stop expecting WifiConfig extra from CONFIGURED_NETWORKS_CHANGED_ACTION broadcast" into rvc-dev

This commit is contained in:
David Su
2020-06-23 03:06:39 +00:00
committed by Android (Google) Code Review

View File

@@ -214,15 +214,7 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) { switch (intent.getAction()) {
case WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION: case WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION:
if (!intent.getBooleanExtra(WifiManager.EXTRA_MULTIPLE_NETWORKS_CHANGED, updateMatchingWifiConfig();
false /* defaultValue */)) {
// only one network changed
WifiConfiguration wifiConfiguration = intent
.getParcelableExtra(WifiManager.EXTRA_WIFI_CONFIGURATION);
if (mAccessPoint.matches(wifiConfiguration)) {
mWifiConfig = wifiConfiguration;
}
}
// fall through // fall through
case WifiManager.NETWORK_STATE_CHANGED_ACTION: case WifiManager.NETWORK_STATE_CHANGED_ACTION:
case WifiManager.RSSI_CHANGED_ACTION: case WifiManager.RSSI_CHANGED_ACTION:
@@ -230,6 +222,17 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
break; break;
} }
} }
private void updateMatchingWifiConfig() {
// use getPrivilegedConfiguredNetworks() to get Passpoint & other ephemeral networks
for (WifiConfiguration wifiConfiguration :
mWifiManager.getPrivilegedConfiguredNetworks()) {
if (mAccessPoint.matches(wifiConfiguration)) {
mWifiConfig = wifiConfiguration;
break;
}
}
}
}; };
private final NetworkRequest mNetworkRequest = new NetworkRequest.Builder() private final NetworkRequest mNetworkRequest = new NetworkRequest.Builder()