Merge "Camera: Fix a removal-while-iterate bug" am: 171249e857
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1643703 Change-Id: I537e8fab411b8134cf43d71790ebe62d238a71b6
This commit is contained in:
@@ -2024,7 +2024,9 @@ public final class CameraManager {
|
|||||||
// Tell listeners that the cameras and torch modes are unavailable and schedule a
|
// Tell listeners that the cameras and torch modes are unavailable and schedule a
|
||||||
// reconnection to camera service. When camera service is reconnected, the camera
|
// reconnection to camera service. When camera service is reconnected, the camera
|
||||||
// and torch statuses will be updated.
|
// and torch statuses will be updated.
|
||||||
for (int i = 0; i < mDeviceStatus.size(); i++) {
|
// Iterate from the end to the beginning befcause onStatusChangedLocked removes
|
||||||
|
// entries from the ArrayMap.
|
||||||
|
for (int i = mDeviceStatus.size() - 1; i >= 0; i--) {
|
||||||
String cameraId = mDeviceStatus.keyAt(i);
|
String cameraId = mDeviceStatus.keyAt(i);
|
||||||
onStatusChangedLocked(ICameraServiceListener.STATUS_NOT_PRESENT, cameraId);
|
onStatusChangedLocked(ICameraServiceListener.STATUS_NOT_PRESENT, cameraId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user