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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user