Stop expecting WifiConfig extra from CONFIGURED_NETWORKS_CHANGED_ACTION broadcast
WifiConfig is no longer sent in this broadcast
due to privacy concerns, so stop reading this
extra. Instead, query WifiManager to find the
matching WifiConfiguration to update.
Bug: 158874479
Test: compiles
Change-Id: I235f2a2b017317e969c8e5bdf17894e3777de44a
diff --git a/tests/CarDeveloperOptions/src/com/android/car/developeroptions/wifi/details/WifiDetailPreferenceController.java b/tests/CarDeveloperOptions/src/com/android/car/developeroptions/wifi/details/WifiDetailPreferenceController.java
index cb80cb3..cd484a7 100644
--- a/tests/CarDeveloperOptions/src/com/android/car/developeroptions/wifi/details/WifiDetailPreferenceController.java
+++ b/tests/CarDeveloperOptions/src/com/android/car/developeroptions/wifi/details/WifiDetailPreferenceController.java
@@ -197,15 +197,7 @@
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION:
- if (!intent.getBooleanExtra(WifiManager.EXTRA_MULTIPLE_NETWORKS_CHANGED,
- false /* defaultValue */)) {
- // only one network changed
- WifiConfiguration wifiConfiguration = intent
- .getParcelableExtra(WifiManager.EXTRA_WIFI_CONFIGURATION);
- if (mAccessPoint.matches(wifiConfiguration)) {
- mWifiConfig = wifiConfiguration;
- }
- }
+ updateMatchingWifiConfig();
// fall through
case WifiManager.NETWORK_STATE_CHANGED_ACTION:
case WifiManager.RSSI_CHANGED_ACTION:
@@ -213,6 +205,17 @@
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()