diff options
author | Michael Plass <mplass@google.com> | 2018-06-07 15:35:19 -0700 |
---|---|---|
committer | Michael Plass <mplass@google.com> | 2018-06-07 15:40:27 -0700 |
commit | 4c23cef241b5d93d2bf49d620a924911ae1ce916 (patch) | |
tree | 2cb99e32880e29e14e98c28355d97a8de9d9a850 /service | |
parent | ee38c65d579f5363f2ffd63e850582350233d0e4 (diff) |
Revert "Restrict wifi p2p broadcasts"
This reverts commit 2f2f41dca22a9463af648bd823e4620bff4bb5bd.
Bug: 109782011
Test: Unit tests
Test: Manually verify p2p device name in settings
Change-Id: I9d6597af51127435b5cbeb9558ef9ed406caf8b7
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java index a0409bf79..c089c9c09 100644 --- a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java +++ b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java @@ -127,13 +127,6 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub { private static final Boolean RELOAD = true; private static final Boolean NO_RELOAD = false; - private static final String[] RECEIVER_PERMISSIONS_FOR_BROADCAST = { - android.Manifest.permission.ACCESS_COARSE_LOCATION, - android.Manifest.permission.ACCESS_NETWORK_STATE, - android.Manifest.permission.ACCESS_WIFI_STATE, - android.Manifest.permission.CHANGE_WIFI_STATE - }; - // Two minutes comes from the wpa_supplicant setting private static final int GROUP_CREATING_WAIT_TIME_MS = 120 * 1000; private static int sGroupCreatingTimeoutIndex = 0; @@ -1197,7 +1190,6 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub { mNetworkInfo.setIsAvailable(true); sendP2pConnectionChangedBroadcast(); initializeP2pSettings(); - refreshBroadcasts(); } @Override @@ -1209,7 +1201,7 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub { transitionTo(mP2pDisabledState); break; case ENABLE_P2P: - refreshBroadcasts(); + // Nothing to do break; case DISABLE_P2P: if (mPeers.clear()) { @@ -2545,17 +2537,14 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub { final Intent intent = new Intent(WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); intent.putExtra(WifiP2pManager.EXTRA_WIFI_P2P_DEVICE, new WifiP2pDevice(mThisDevice)); - // Formerly sticky - mContext.sendBroadcastAsUserMultiplePermissions(intent, UserHandle.ALL, - RECEIVER_PERMISSIONS_FOR_BROADCAST); + mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } private void sendPeersChangedBroadcast() { final Intent intent = new Intent(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION); intent.putExtra(WifiP2pManager.EXTRA_P2P_DEVICE_LIST, new WifiP2pDeviceList(mPeers)); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); - mContext.sendBroadcastAsUserMultiplePermissions(intent, UserHandle.ALL, - RECEIVER_PERMISSIONS_FOR_BROADCAST); + mContext.sendBroadcastAsUser(intent, UserHandle.ALL); } private void sendP2pConnectionChangedBroadcast() { @@ -2566,9 +2555,7 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub { intent.putExtra(WifiP2pManager.EXTRA_WIFI_P2P_INFO, new WifiP2pInfo(mWifiP2pInfo)); intent.putExtra(WifiP2pManager.EXTRA_NETWORK_INFO, new NetworkInfo(mNetworkInfo)); intent.putExtra(WifiP2pManager.EXTRA_WIFI_P2P_GROUP, new WifiP2pGroup(mGroup)); - // Formerly sticky - mContext.sendBroadcastAsUserMultiplePermissions(intent, UserHandle.ALL, - RECEIVER_PERMISSIONS_FOR_BROADCAST); + mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); if (mWifiChannel != null) { mWifiChannel.sendMessage(WifiP2pServiceImpl.P2P_CONNECTION_CHANGED, new NetworkInfo(mNetworkInfo)); @@ -2584,15 +2571,6 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub { mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } - /** - * These broadcasts were formerly sticky; send them again after critical changes to ease - * transition. - */ - private void refreshBroadcasts() { - sendThisDeviceChangedBroadcast(); - sendP2pConnectionChangedBroadcast(); - } - private void startDhcpServer(String intf) { InterfaceConfiguration ifcg = null; try { |