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

Commit 95f4c7ee authored by Michelle Ho's avatar Michelle Ho
Browse files

Camera: Fix physical camera availability update

We should always update the physical devices availability record once
physical camera status changed, or the applications cannot receive the
status change callbacks correctly.

Bug: 262979670
Test: atest CameraManagerTest
Change-Id: I0b0238612bce593d6722bec79908fe046d6d3e84
parent d601b5a4
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -2364,9 +2364,8 @@ public final class CameraManager {
            }

            //TODO: Do we need to treat this as error?
            if (!mDeviceStatus.containsKey(id) || !isAvailable(mDeviceStatus.get(id))
                    || !mUnavailablePhysicalDevices.containsKey(id)) {
                Log.e(TAG, String.format("Camera %s is not available. Ignore physical camera "
            if (!mDeviceStatus.containsKey(id) || !mUnavailablePhysicalDevices.containsKey(id)) {
                Log.e(TAG, String.format("Camera %s is not present. Ignore physical camera "
                        + "status change", id));
                return;
            }
@@ -2391,6 +2390,12 @@ public final class CameraManager {
                return;
            }

            if (!isAvailable(mDeviceStatus.get(id))) {
                Log.i(TAG, String.format("Camera %s is not available. Ignore physical camera "
                        + "status change callback(s)", id));
                return;
            }

            final int callbackCount = mCallbackMap.size();
            for (int i = 0; i < callbackCount; i++) {
                Executor executor = mCallbackMap.valueAt(i);