summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Su <dysu@google.com>2020-10-07 01:03:33 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-10-07 01:03:33 +0000
commitf0883bf4635ee9e685d695e28b86b125cfc8001c (patch)
tree0a0a3b93d7c3e486d926577b6e26d6258c6deef4
parent23d89d1f339093889a8ba5017e0d44bf097710dd (diff)
parentcdfc342de4a85b63b39c7aa94ad3150ab949e7be (diff)
WifiConfigManager: protect CONFIGURED_NETWORKS_CHANGED_ACTION with permissions am: cdfc342de4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/net/wifi/+/12724347 Change-Id: Iac7000824087a86a8127aec8c82677b86b5d9089
-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 d8b4237a3..396dca9cb 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -630,7 +630,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 7509c18b3..289c2d558 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -3614,8 +3614,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();