camera: implement flashlight for HAL v1 devices
Implement flashlight for HAL v1 devices and remove
CameraHardwareInterface's dependency on CameraService to avoid
circular dependency.
Bug: 2682206
Change-Id: Id5bbccef085b607a6189763fd7fbe2e3f26868c8
diff --git a/services/camera/libcameraservice/common/CameraModule.cpp b/services/camera/libcameraservice/common/CameraModule.cpp
index 85a4df9..5f767ad 100644
--- a/services/camera/libcameraservice/common/CameraModule.cpp
+++ b/services/camera/libcameraservice/common/CameraModule.cpp
@@ -91,7 +91,7 @@
}
int CameraModule::open(const char* id, struct hw_device_t** device) {
- return mModule->common.methods->open(&mModule->common, id, device);
+ return filterOpenErrorCode(mModule->common.methods->open(&mModule->common, id, device));
}
int CameraModule::openLegacy(
@@ -125,5 +125,20 @@
return mModule->set_torch_mode(camera_id, enable);
}
+
+status_t CameraModule::filterOpenErrorCode(status_t err) {
+ switch(err) {
+ case NO_ERROR:
+ case -EBUSY:
+ case -EINVAL:
+ case -EUSERS:
+ return err;
+ default:
+ break;
+ }
+ return -ENODEV;
+}
+
+
}; // namespace android