summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camera/CameraHal_Module.cpp3
-rw-r--r--camera/CameraProperties.cpp12
2 files changed, 12 insertions, 3 deletions
diff --git a/camera/CameraHal_Module.cpp b/camera/CameraHal_Module.cpp
index 69a47f3..b107bc7 100644
--- a/camera/CameraHal_Module.cpp
+++ b/camera/CameraHal_Module.cpp
@@ -644,7 +644,8 @@ int camera_get_camera_info(int camera_id, struct camera_info *info)
if(gCameraProperties.initialize() != android::NO_ERROR)
{
CAMHAL_LOGEA("Unable to create or initialize CameraProperties");
- return NULL;
+ rv = -EINVAL;
+ goto end;
}
//Get camera properties for camera index
diff --git a/camera/CameraProperties.cpp b/camera/CameraProperties.cpp
index 0664083..7d4034d 100644
--- a/camera/CameraProperties.cpp
+++ b/camera/CameraProperties.cpp
@@ -78,7 +78,9 @@ status_t CameraProperties::initialize()
ret = loadProperties();
- mInitialized = 1;
+ if (ret == NO_ERROR) {
+ mInitialized = 1;
+ }
LOG_FUNCTION_NAME_EXIT;
@@ -95,6 +97,9 @@ status_t CameraProperties::loadProperties()
status_t ret = NO_ERROR;
+ //Must be re-initialized here, since loadProperties() could potentially be called more than once.
+ mCamerasSupported = 0;
+
// adapter updates capabilities and we update camera count
const status_t err = CameraAdapter_Capabilities(mCameraProps, mCamerasSupported,
MAX_CAMERAS_SUPPORTED, mCamerasSupported);
@@ -102,11 +107,14 @@ status_t CameraProperties::loadProperties()
if(err != NO_ERROR) {
LOGE("error while getting capabilities");
ret = UNKNOWN_ERROR;
+ } else if (mCamerasSupported == 0) {
+ LOGE("camera busy. properties not loaded. num_cameras = %d", mCamerasSupported);
+ ret = UNKNOWN_ERROR;
} else if (mCamerasSupported > MAX_CAMERAS_SUPPORTED) {
LOGE("returned too many adapaters");
ret = UNKNOWN_ERROR;
} else {
- LOGE("num_cameras = %d", mCamerasSupported);
+ LOGI("num_cameras = %d", mCamerasSupported);
for (int i = 0; i < mCamerasSupported; i++) {
mCameraProps[i].set(CAMERA_SENSOR_INDEX, i);