From fc132e8df75297ece1f83a0bfa64a5d0141c359b Mon Sep 17 00:00:00 2001 From: David Su Date: Fri, 12 Jun 2020 15:48:35 -0700 Subject: RESTRICT AUTOMERGE Send out WIFI_CREDENTIAL_CHANGED_ACTION on WifiManager#forget() success Will be fixed separately in master. Bug: 158874479 Test: atest FrameworksWifiTests Test: connect to and forget some networks Change-Id: I8487bab0e2b9ff7188438ccdb60f2f3dfd74f387 --- service/java/com/android/server/wifi/ClientModeImpl.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index e10d5367e..8036a0dcc 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -5794,14 +5794,13 @@ public class ClientModeImpl extends StateMachine { */ private void broadcastWifiCredentialChanged(int wifiCredentialEventType, WifiConfiguration config) { - if (config != null && config.preSharedKey != null) { - Intent intent = new Intent(WifiManager.WIFI_CREDENTIAL_CHANGED_ACTION); + Intent intent = new Intent(WifiManager.WIFI_CREDENTIAL_CHANGED_ACTION); + if (config != null && config.SSID != null) { intent.putExtra(WifiManager.EXTRA_WIFI_CREDENTIAL_SSID, config.SSID); - intent.putExtra(WifiManager.EXTRA_WIFI_CREDENTIAL_EVENT_TYPE, - wifiCredentialEventType); - mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT, - android.Manifest.permission.RECEIVE_WIFI_CREDENTIAL_CHANGE); } + intent.putExtra(WifiManager.EXTRA_WIFI_CREDENTIAL_EVENT_TYPE, wifiCredentialEventType); + mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT, + android.Manifest.permission.RECEIVE_WIFI_CREDENTIAL_CHANGE); } void handleGsmAuthRequest(SimAuthRequestData requestData) { @@ -6220,13 +6219,14 @@ public class ClientModeImpl extends StateMachine { if (callback != null && binder != null) { mProcessingActionListeners.add(binder, callback, callbackIdentifier); } + WifiConfiguration config = mWifiConfigManager.getConfiguredNetwork(netId); boolean success = mWifiConfigManager.removeNetwork(netId, callingUid, null); if (!success) { loge("Failed to remove network"); sendActionListenerFailure(callbackIdentifier, WifiManager.ERROR); } sendActionListenerSuccess(callbackIdentifier); - broadcastWifiCredentialChanged(WifiManager.WIFI_CREDENTIAL_FORGOT, null); + broadcastWifiCredentialChanged(WifiManager.WIFI_CREDENTIAL_FORGOT, config); }); } -- cgit v1.2.3