diff options
-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 { |