summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Su <dysu@google.com>2020-10-06 19:23:27 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-10-06 19:23:27 +0000
commitfa33c3a21463d28def990258a886ec6ff78e19b7 (patch)
tree9b4e8426586d837bedb497985a16a45cbee26cc1
parentfffbb7e59b8852e3bdbd107077610f27cbcebb22 (diff)
parentb6935733de5e0207a3899d5b5803b8037ecba0df (diff)
WifiConfigManager: protect CONFIGURED_NETWORKS_CHANGED_ACTION with permissions am: ff831c8e8d am: b6935733de
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/net/wifi/+/12735996 Change-Id: Ifad14b278ce88d11a63d9ff0231095f3dc3b3b29
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java8
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java4
2 files changed, 9 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 9472367fb..8dcd1c19d 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -830,7 +830,13 @@ public class WifiConfigManager {
maskPasswordsInWifiConfiguration(broadcastNetwork);
intent.putExtra(WifiManager.EXTRA_WIFI_CONFIGURATION, broadcastNetwork);
intent.putExtra(WifiManager.EXTRA_CHANGE_REASON, reason);
- mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
+ mContext.sendBroadcastAsUserMultiplePermissions(
+ intent,
+ UserHandle.ALL,
+ new String[]{
+ android.Manifest.permission.ACCESS_WIFI_STATE,
+ android.Manifest.permission.ACCESS_FINE_LOCATION,
+ });
}
/**
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index 6a7785e5e..0f48af9cc 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -4899,8 +4899,8 @@ public class WifiConfigManagerTest {
private int verifyNetworkInBroadcastAndReturnReason(WifiConfiguration configuration) {
ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
ArgumentCaptor<UserHandle> userHandleCaptor = ArgumentCaptor.forClass(UserHandle.class);
- mContextConfigStoreMockOrder.verify(mContext)
- .sendBroadcastAsUser(intentCaptor.capture(), userHandleCaptor.capture());
+ mContextConfigStoreMockOrder.verify(mContext).sendBroadcastAsUserMultiplePermissions(
+ intentCaptor.capture(), userHandleCaptor.capture(), any());
assertEquals(userHandleCaptor.getValue(), UserHandle.ALL);
Intent intent = intentCaptor.getValue();