getCameraIdListNoLazy : remove system cameras from mTorchStatus as well.

Bug: 182530469

Test: Make Emulator back camera system camera; atest FlashlightTest.java

Merged-In: I0a149ba3d93a740cfbfdc2d04c1235e648061156
Change-Id: I0a149ba3d93a740cfbfdc2d04c1235e648061156
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
(cherry picked from commit bedb9950c8)
This commit is contained in:
Jayant Chowdhary
2021-03-31 03:14:04 -07:00
parent 3c8e090455
commit 02622abbe2

View File

@@ -1363,6 +1363,8 @@ public final class CameraManager {
// devices going offline (in real world scenarios, these permissions aren't // devices going offline (in real world scenarios, these permissions aren't
// changeable). Future calls to getCameraIdList() will reflect the changes in // changeable). Future calls to getCameraIdList() will reflect the changes in
// the camera id list after getCameraIdListNoLazy() is called. // the camera id list after getCameraIdListNoLazy() is called.
// We need to remove the torch ids which may have been associated with the
// devices removed as well. This is the same situation.
cameraStatuses = mCameraService.addListener(testListener); cameraStatuses = mCameraService.addListener(testListener);
mCameraService.removeListener(testListener); mCameraService.removeListener(testListener);
for (CameraStatus c : cameraStatuses) { for (CameraStatus c : cameraStatuses) {
@@ -1381,6 +1383,7 @@ public final class CameraManager {
} }
for (String id : deviceIdsToRemove) { for (String id : deviceIdsToRemove) {
onStatusChangedLocked(ICameraServiceListener.STATUS_NOT_PRESENT, id); onStatusChangedLocked(ICameraServiceListener.STATUS_NOT_PRESENT, id);
mTorchStatus.remove(id);
} }
} catch (ServiceSpecificException e) { } catch (ServiceSpecificException e) {
// Unexpected failure // Unexpected failure