MidiService: synchronize mDeviceConnections
Try to prevent a NullPointerException caused by scanning the array while devices were being removed by another thread. Bug: 193278370 Test: atest CtsMidiTestCases Change-Id: I8560cf6f39654037d5ccdc0f6922fa8bdb719c2f
This commit is contained in:
@@ -350,8 +350,10 @@ public class MidiService extends IMidiManager.Stub {
|
||||
}
|
||||
|
||||
if (mDeviceConnections != null) {
|
||||
for (DeviceConnection connection : mDeviceConnections) {
|
||||
connection.notifyClient(server);
|
||||
synchronized (mDeviceConnections) {
|
||||
for (DeviceConnection connection : mDeviceConnections) {
|
||||
connection.notifyClient(server);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user