diff options
author | Zhijun He <zhijunhe@google.com> | 2014-06-16 16:38:35 -0700 |
---|---|---|
committer | Zhijun He <zhijunhe@google.com> | 2014-06-19 15:41:09 -0700 |
commit | b10cdadf0fb945e23ca77008d4af76584bd0e39a (patch) | |
tree | d1fd0cc1c42aec025e8f6fc52f890b96e7203653 /services/camera/libcameraservice/device1 | |
parent | ab5cdbaf65ca509681d2726aacdf3ac8bfb6b3fa (diff) | |
download | frameworks_av-b10cdadf0fb945e23ca77008d4af76584bd0e39a.zip frameworks_av-b10cdadf0fb945e23ca77008d4af76584bd0e39a.tar.gz frameworks_av-b10cdadf0fb945e23ca77008d4af76584bd0e39a.tar.bz2 |
cameraservice: Implement HAL1 and higher HAL API coexistence
A higher hal version device like HAL3.2 can be opened as HAL1.0 device
if HAL supports it. This only applies to camera API1.
Change-Id: I4ae9f59f4317158cc1bd7ed7726e4032cdd1fa07
Diffstat (limited to 'services/camera/libcameraservice/device1')
-rw-r--r-- | services/camera/libcameraservice/device1/CameraHardwareInterface.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/services/camera/libcameraservice/device1/CameraHardwareInterface.h b/services/camera/libcameraservice/device1/CameraHardwareInterface.h index 87b2807..925b645 100644 --- a/services/camera/libcameraservice/device1/CameraHardwareInterface.h +++ b/services/camera/libcameraservice/device1/CameraHardwareInterface.h @@ -92,8 +92,22 @@ public: status_t initialize(hw_module_t *module) { ALOGI("Opening camera %s", mName.string()); - int rc = module->methods->open(module, mName.string(), - (hw_device_t **)&mDevice); + camera_module_t *cameraModule = reinterpret_cast<camera_module_t *>(module); + camera_info info; + status_t res = cameraModule->get_camera_info(atoi(mName.string()), &info); + if (res != OK) return res; + + int rc = OK; + if (module->module_api_version >= CAMERA_MODULE_API_VERSION_2_3 && + info.device_version > CAMERA_DEVICE_API_VERSION_1_0) { + // Open higher version camera device as HAL1.0 device. + rc = cameraModule->open_legacy(module, mName.string(), + CAMERA_DEVICE_API_VERSION_1_0, + (hw_device_t **)&mDevice); + } else { + rc = module->methods->open(module, mName.string(), + (hw_device_t **)&mDevice); + } if (rc != OK) { ALOGE("Could not open camera %s: %d", mName.string(), rc); return rc; |