summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorJimmy Chen <jimmycmchen@google.com>2020-06-24 08:05:42 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-06-24 08:05:42 +0000
commit77f43d544032477fe5cb6be7fdbc740cdd5c007d (patch)
tree4abfc3b6ce3ed224e951ebd246b474d8d3fa3bd7 /service
parentf4553f267886d724fdd93168fd3363d30a876a83 (diff)
parenta653fc6c062f6fa7ae52e49e0f46f64c3c0f3037 (diff)
Merge "p2p: when location mode is off, send restricted broadcast to the settings only" into rvc-dev am: a653fc6c06
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/net/wifi/+/11981158 Change-Id: I65a886f0ab465d1aa16128410983196ac4f8ed57
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() {