Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab3b9fbf authored by Irfan Sheriff's avatar Irfan Sheriff
Browse files

Fix concurrency issues

Make true copy of list when passing off on broadcast

Bug: 8212369
Change-Id: Iaf4a303513d267f76bd16b845ec68baabfca6b45
parent 0493d799
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -335,7 +335,7 @@ public class WifiP2pDevice implements Parcelable {
            deviceCapability = source.deviceCapability;
            groupCapability = source.groupCapability;
            status = source.status;
            wfdInfo = source.wfdInfo;
            wfdInfo = new WifiP2pWfdInfo(source.wfdInfo);
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ public class WifiP2pDeviceList implements Parcelable {
    public WifiP2pDeviceList(WifiP2pDeviceList source) {
        if (source != null) {
            for (WifiP2pDevice d : source.getDeviceList()) {
                mDevices.put(d.deviceAddress, d);
                mDevices.put(d.deviceAddress, new WifiP2pDevice(d));
            }
        }
    }
@@ -53,7 +53,7 @@ public class WifiP2pDeviceList implements Parcelable {
    public WifiP2pDeviceList(ArrayList<WifiP2pDevice> devices) {
        for (WifiP2pDevice device : devices) {
            if (device.deviceAddress != null) {
                mDevices.put(device.deviceAddress, device);
                mDevices.put(device.deviceAddress, new WifiP2pDevice(device));
            }
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -1839,7 +1839,7 @@ public class WifiP2pService extends IWifiP2pManager.Stub {

    private void sendPeersChangedBroadcast() {
        final Intent intent = new Intent(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION);
        intent.putExtra(WifiP2pManager.EXTRA_P2P_DEVICE_LIST, mPeers);
        intent.putExtra(WifiP2pManager.EXTRA_P2P_DEVICE_LIST, new WifiP2pDeviceList(mPeers));
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
        mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
    }