summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Chen <jimmycmchen@google.com>2020-06-23 16:19:55 +0800
committerJimmy Chen <jimmycmchen@google.com>2020-06-24 11:37:26 +0800
commit6f9d732a12ca5dd84fafcf5fdb510b878bffe237 (patch)
tree4dc7a0727c2002c712c40a8c7a7c1bd0274146ce
parentf7f52f8ced193995381e6d3be4cbde85b5021aa5 (diff)
p2p: when location mode is off, send restricted broadcast to the settings only
Bug: 159368772 Test: atest FrameworksWifiTests Change-Id: Iae35daed6ede28a79064d41c499aeb8e02212ee6
-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() {