Skip to content

Commit

Permalink
Stop expecting WifiConfig extra from CONFIGURED_NETWORKS_CHANGED_ACTI…
Browse files Browse the repository at this point in the history
…ON 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: make RunSettingsRoboTests -j40 ROBOTEST_FILTER="com.android.settings.wifi.details.WifiDetailPreferenceControllerTest"
Change-Id: Ie52339220acbbe111a6aa5f785fbfa409c405b5b
  • Loading branch information
David Su authored and rahul9999xda committed Dec 15, 2020
1 parent 2a674d8 commit e71051e
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,22 +196,25 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
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:
refreshPage();
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()
Expand Down

0 comments on commit e71051e

Please sign in to comment.