Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit b654c1f9 authored by David Su's avatar David Su Committed by Kevin F. Haggerty
Browse files

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: make RunSettingsRoboTests -j40 ROBOTEST_FILTER="com.android.settings.wifi.details.WifiDetailPreferenceControllerTest"
Change-Id: Ie52339220acbbe111a6aa5f785fbfa409c405b5b
parent b92b34ca
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -196,15 +196,7 @@ 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:
@@ -212,6 +204,17 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
                    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()