CTS: Ensure CONFIGURED_NETWORKS_CHANGED_ACTION broadcast doesn't include WifiConfiguration

WifiConfiguration contains privileged information.

Bug: 159373687
Test: atest CtsWifiTestCases
Change-Id: I4669a6ff79b3d2e99795015e42bfa611cffb9070
diff --git a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
index 51ea5197..1825dc3 100644
--- a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
+++ b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
@@ -1954,6 +1954,19 @@
 
             assertEquals(savedNetworks.size() + 1, mWifiManager.getConfiguredNetworks().size());
 
+            // Need an effectively-final holder because we need to modify inner Intent in callback.
+            class IntentHolder {
+                Intent intent;
+            }
+            IntentHolder intentHolder = new IntentHolder();
+            mContext.registerReceiver(new BroadcastReceiver() {
+                @Override
+                public void onReceive(Context context, Intent intent) {
+                    Log.i(TAG, "Received CONFIGURED_NETWORKS_CHANGED_ACTION broadcast: " + intent);
+                    intentHolder.intent = intent;
+                }
+            }, new IntentFilter(WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION));
+
             // Now remove the network
             synchronized (mLock) {
                 try {
@@ -1966,6 +1979,17 @@
             // check if we got the success callback
             assertTrue(actionListener.onSuccessCalled);
 
+            PollingCheck.check(
+                    "Didn't receive CONFIGURED_NETWORKS_CHANGED_ACTION broadcast!",
+                    TEST_WAIT_DURATION_MS,
+                    () -> intentHolder.intent != null);
+            Intent intent = intentHolder.intent;
+            assertEquals(WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION, intent.getAction());
+            assertTrue(intent.getBooleanExtra(WifiManager.EXTRA_MULTIPLE_NETWORKS_CHANGED, false));
+            assertEquals(WifiManager.CHANGE_REASON_REMOVED,
+                    intent.getIntExtra(WifiManager.EXTRA_CHANGE_REASON, -1));
+            assertNull(intent.getParcelableExtra(WifiManager.EXTRA_WIFI_CONFIGURATION));
+
             // Ensure that the new network has been successfully removed.
             assertEquals(savedNetworks.size(), mWifiManager.getConfiguredNetworks().size());
         } finally {