diff options
author | Chien-Yu Chen <cychen@google.com> | 2015-02-25 16:04:22 -0800 |
---|---|---|
committer | Chien-Yu Chen <cychen@google.com> | 2015-03-03 14:07:57 -0800 |
commit | d231fd61ca94441183abda9766ce6906a5b4c3cf (patch) | |
tree | 67dd34bd33fd1fcddb9182b34d5ddc754a259d16 /services/camera/libcameraservice/common | |
parent | 88da526d97442c80731e01bfc94c6b47c4b0c3c7 (diff) | |
download | frameworks_av-d231fd61ca94441183abda9766ce6906a5b4c3cf.zip frameworks_av-d231fd61ca94441183abda9766ce6906a5b4c3cf.tar.gz frameworks_av-d231fd61ca94441183abda9766ce6906a5b4c3cf.tar.bz2 |
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
Diffstat (limited to 'services/camera/libcameraservice/common')
-rw-r--r-- | services/camera/libcameraservice/common/CameraModule.cpp | 17 | ||||
-rw-r--r-- | services/camera/libcameraservice/common/CameraModule.h | 2 |
2 files changed, 18 insertions, 1 deletions
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::getCameraInfo(int cameraId, struct camera_info *info) { } 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 @@ int CameraModule::setTorchMode(const char* camera_id, bool enable) { 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 diff --git a/services/camera/libcameraservice/common/CameraModule.h b/services/camera/libcameraservice/common/CameraModule.h index 31b9ae2..16207aa 100644 --- a/services/camera/libcameraservice/common/CameraModule.h +++ b/services/camera/libcameraservice/common/CameraModule.h @@ -50,6 +50,8 @@ public: private: // Derive camera characteristics keys defined after HAL device version static void deriveCameraCharacteristicsKeys(uint32_t deviceVersion, CameraMetadata &chars); + status_t filterOpenErrorCode(status_t err); + camera_module_t *mModule; CameraMetadata mCameraCharacteristics[MAX_CAMERAS_PER_MODULE]; camera_info mCameraInfo[MAX_CAMERAS_PER_MODULE]; |