diff options
author | Nate Jiang <qiangjiang@google.com> | 2020-07-23 09:55:23 -0700 |
---|---|---|
committer | Nate Jiang <qiangjiang@google.com> | 2020-07-28 00:11:40 +0000 |
commit | 5564f3900cb37d76d769cd9e185a53c26e0cea82 (patch) | |
tree | af6d71ad24b8fc467ffa2d951b7a8d844606c13f /service | |
parent | 6eea218042c68bce1ec6568247744a33d988b308 (diff) |
Remove all ephemeral networks when user switch
Every time switch user, remove all ephemeral nerworks to avoil uid
mismatch
Bug: 161841383
Test: atest com.android.server.wifi
Merged-In: I0caf8e08215055154a1f45714731d3a25ddac012
Change-Id: I0caf8e08215055154a1f45714731d3a25ddac012
(cherry picked from commit 9d4b4f2697baef0f927e6912e36882a8ee7f0038)
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiConfigManager.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index 6d04b7a68..5b5c968c1 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -2927,14 +2927,22 @@ public class WifiConfigManager { Set<Integer> removedNetworkIds = new HashSet<>(); // Remove any private networks of the old user before switching the userId. for (WifiConfiguration config : getConfiguredNetworks()) { - if (!config.shared && doesUidBelongToCurrentUser(config.creatorUid)) { + if ((!config.shared && doesUidBelongToCurrentUser(config.creatorUid)) + || config.ephemeral) { removedNetworkIds.add(config.networkId); localLog("clearInternalUserData: removed config." + " netId=" + config.networkId + " configKey=" + config.getKey()); mConfiguredNetworks.remove(config.networkId); + for (OnNetworkUpdateListener listener : mListeners) { + listener.onNetworkRemoved( + createExternalWifiConfiguration(config, true, Process.WIFI_UID)); + } } } + if (!removedNetworkIds.isEmpty()) { + sendConfiguredNetworkChangedBroadcast(WifiManager.CHANGE_REASON_REMOVED); + } mUserTemporarilyDisabledList.clear(); mScanDetailCaches.clear(); clearLastSelectedNetwork(); |