From 8ec2813f803f7a0b9260872cfa27ac2395478814 Mon Sep 17 00:00:00 2001 From: Anu Sundararajan Date: Tue, 20 Mar 2012 13:09:20 -0500 Subject: CameraHal: Fixed minor bugs that were exposed while testing multiple instances of camera CameraHal_Module: When there is an error, camera_get_camera_info should return a negative value. If it returns NULL, the caller would interpret it as 0 which implies OK. CameraProperties: - The flag mInitialized must be set to true only if the properties were loaded successfully. Previously, the flag was being set without checking the return value from loadProperties. - Since loadProperties could be called more than once, it is important to initialize mCamerasSupported here. - Added additional error handling. If for some reason, CameraAdapter_Capabilities returns that 0 cameras are available, then it must be flagged as an error. This is possible when one tries to query the properties while a camera is in use. Change-Id: I15e9935735f8d2c548fb2f378a310650771c54e2 Signed-off-by: Anu Sundararajan --- camera/CameraHal_Module.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'camera/CameraHal_Module.cpp') 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 -- cgit v1.1