summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorJimmy Chen <jimmycmchen@google.com>2020-06-24 07:52:05 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-06-24 07:52:05 +0000
commita653fc6c062f6fa7ae52e49e0f46f64c3c0f3037 (patch)
tree87a1b158129f1ca5f7f4e45ebf55cbd918f3cefd /service
parentdb04b29f0f6a96b19850fc17e23818855f800d61 (diff)
parent6f9d732a12ca5dd84fafcf5fdb510b878bffe237 (diff)
Merge "p2p: when location mode is off, send restricted broadcast to the settings only" into rvc-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
index 56cdba83d..61e6c16bc 100644
--- a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
+++ b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
@@ -158,6 +158,12 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
android.Manifest.permission.ACCESS_WIFI_STATE
};
+ private static final String[] RECEIVER_PERMISSIONS_FOR_BROADCAST_LOCATION_OFF = {
+ android.Manifest.permission.NETWORK_SETTINGS,
+ android.Manifest.permission.ACCESS_FINE_LOCATION,
+ android.Manifest.permission.ACCESS_WIFI_STATE
+ };
+
// Maximum number of bytes allowed for a network name, i.e. SSID.
private static final int MAX_NETWORK_NAME_BYTES = 32;
// Minimum number of bytes for a network name, i.e. DIRECT-xy.
@@ -3085,8 +3091,12 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
private void sendBroadcastMultiplePermissions(Intent intent) {
Context context = mContext.createContextAsUser(UserHandle.ALL, 0);
+ String[] permissions = RECEIVER_PERMISSIONS_FOR_BROADCAST;
+ if (!mWifiPermissionsUtil.isLocationModeEnabled()) {
+ permissions = RECEIVER_PERMISSIONS_FOR_BROADCAST_LOCATION_OFF;
+ }
context.sendBroadcastWithMultiplePermissions(
- intent, RECEIVER_PERMISSIONS_FOR_BROADCAST);
+ intent, permissions);
}
private void sendThisDeviceChangedBroadcast() {