diff options
| author | 2023-01-13 13:04:22 +0000 | |
|---|---|---|
| committer | 2023-01-18 06:52:57 +0000 | |
| commit | 95f4c7ee4a44e7c1d399f8321406895842950a6a (patch) | |
| tree | e3585a42c819926aef758c477d9c184270c216ab | |
| parent | d601b5a44552f919d2cbf39b2d7c9d3d14bff655 (diff) | |
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
| -rw-r--r-- | core/java/android/hardware/camera2/CameraManager.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java index 5e2b40cbaf75..d59382c4c3dd 100644 --- a/core/java/android/hardware/camera2/CameraManager.java +++ b/core/java/android/hardware/camera2/CameraManager.java @@ -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); |