summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Su <dysu@google.com>2020-09-28 19:55:29 -0700
committerDavid Su <dysu@google.com>2020-10-06 19:26:50 +0000
commitcdfc342de4a85b63b39c7aa94ad3150ab949e7be (patch)
treef1e1946f56676dc63de40bef1bc2951ff4138dd0
parentb012d872de4e63f757e5e1637f03de049ab46e87 (diff)
WifiConfigManager: protect CONFIGURED_NETWORKS_CHANGED_ACTION with permissions
Guard with ACCESS_WIFI_STATE & ACCESS_FINE_LOCATION permissions. Bug: 158874479 Bug: 159373687 Test: presubmit unit tests Test: Verify Settings still works correctly. Change-Id: I88d93006ff379105e13e1b339ec51757a56ac863 Merged-In: I88d93006ff379105e13e1b339ec51757a56ac863 Merged-In: I657063f68701d57cfeb3765dfbab25ba50ef7b97
-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 25a5a20ad..fa2a56092 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -625,7 +625,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 9fa67a000..ea6ea117f 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -3511,8 +3511,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();