From 1f21f5453016e4a7164326c8d863d06edca14380 Mon Sep 17 00:00:00 2001 From: Rajaram Gudivada Date: Wed, 23 Mar 2016 20:07:03 +0530 Subject: [PATCH] kitakami-common: QCamera2: HAL: FlashLight widget fix for HAL1 Issue: Flashlight in system tray is not working with HAL1 on devices with module version >= 2.4. Its due to framework looks for ANDROID_FLASH_INFO_AVAILABLE property which is not set in the HAL1 camera info. Fix: Populate the required camera static characteristics regardless of HAL version. CRs-Fixed: 993695 Change-Id: I5d3b95b3b3f4ab72ae3b67c87a8a2d257260a5de --- camera/QCamera2/QCamera2Factory.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/camera/QCamera2/QCamera2Factory.cpp b/camera/QCamera2/QCamera2Factory.cpp index ac244b8..f4e6913 100644 --- a/camera/QCamera2/QCamera2Factory.cpp +++ b/camera/QCamera2/QCamera2Factory.cpp @@ -250,19 +250,18 @@ int QCamera2Factory::getCameraInfo(int camera_id, struct camera_info *info) return NO_INIT; } - if ( mHalDescriptors[camera_id].device_version == CAMERA_DEVICE_API_VERSION_3_0 ) { - rc = QCamera3HardwareInterface::getCamInfo(mHalDescriptors[camera_id].cameraId, info); - } else if (mHalDescriptors[camera_id].device_version == CAMERA_DEVICE_API_VERSION_1_0) { - rc = QCamera2HardwareInterface::getCapabilities(mHalDescriptors[camera_id].cameraId, info); - } else { - ALOGE("%s: Device version for camera id %d invalid %d", - __func__, - camera_id, - mHalDescriptors[camera_id].device_version); - return BAD_VALUE; + ALOGI("Camera id %d API version %d", + camera_id, mHalDescriptors[camera_id].device_version); + + // Need ANDROID_FLASH_INFO_AVAILABLE property for flashlight widget to + // work and so get the static data regardless of HAL version + rc = QCamera3HardwareInterface::getCamInfo( + mHalDescriptors[camera_id].cameraId, info); + if (mHalDescriptors[camera_id].device_version == + CAMERA_DEVICE_API_VERSION_1_0) { + info->device_version = CAMERA_DEVICE_API_VERSION_1_0; } - ALOGV("%s: X", __func__); return rc; }