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

Commit 71ca7dff authored by Shuzhen Wang's avatar Shuzhen Wang Committed by Automerger Merge Worker
Browse files

Merge "Camera: Fix a removal-while-iterate bug" am: 171249e8 am: f1f50404 am: 7b8379f5

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1643703

Change-Id: I16a4e5430872102f2650845d29f4a7ee7a4c7580
parents 452d2916 7b8379f5
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -2030,7 +2030,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);
                }
                }