Fix concurrency issues
Make true copy of list when passing off on broadcast Bug: 8212369 Change-Id: Iaf4a303513d267f76bd16b845ec68baabfca6b45
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user