Camera: Do not update state at HAL starts up if state already exists
This is to handle lazy hal, where cameraserver doesn't know HAL goes
away.
Test: Observe that the between QS Torch Tile and Camera App is correct.
Bug: 79374634
Change-Id: I2f802b1c409ba3581f0fcacfc0ac5f6059391139
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 4dacd02..ce35ad9 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -190,7 +190,9 @@
for (auto& cameraId : deviceIds) {
String8 id8 = String8(cameraId.c_str());
- onDeviceStatusChanged(id8, CameraDeviceStatus::PRESENT);
+ if (getCameraState(id8) == nullptr) {
+ onDeviceStatusChanged(id8, CameraDeviceStatus::PRESENT);
+ }
}
return OK;