summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDavid Su <dysu@google.com>2020-06-12 17:03:35 -0700
committerDavid Su <dysu@google.com>2020-06-17 05:13:11 +0000
commitd696694b98f70b7d6ec2c66f0349e557e5c5b6b0 (patch)
treeb2f9273d952a8ab5ab5721fb23ea480adef30eba /service
parentc1e74f5c89a388568d5ab5817356dd39456a8fe5 (diff)
RESTRICT AUTOMERGE WIFI_CREDENTIAL_CHANGED_ACTION: only broadcast SSID if location mode is enabled & receiver has location permissions
Bug: 158874479 Test: atest FrameworksWifiTests Test: forget some networks in Wifi Picker Test: added logs locally and verified broadcast is received Change-Id: I26f43b6a4050cb420b30f9dcaa95e14f96c676a8
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index f09218ab9..82851b238 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -5808,12 +5808,17 @@ public class ClientModeImpl extends StateMachine {
private void broadcastWifiCredentialChanged(int wifiCredentialEventType,
WifiConfiguration config) {
Intent intent = new Intent(WifiManager.WIFI_CREDENTIAL_CHANGED_ACTION);
- if (config != null && config.SSID != null) {
+ if (config != null && config.SSID != null && mWifiPermissionsUtil.isLocationModeEnabled()) {
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);
+ mContext.createContextAsUser(UserHandle.CURRENT, 0)
+ .sendBroadcastWithMultiplePermissions(
+ intent,
+ new String[]{
+ android.Manifest.permission.RECEIVE_WIFI_CREDENTIAL_CHANGE,
+ android.Manifest.permission.ACCESS_FINE_LOCATION,
+ });
}
void handleGsmAuthRequest(SimAuthRequestData requestData) {