diff options
author | Tyler Luu <tluu@ti.com> | 2011-10-06 00:00:03 -0500 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2011-10-07 09:24:05 -0700 |
commit | 7b6da3c7a2cdc44a35f3af3b4110eabda6f6a4b7 (patch) | |
tree | ca2c9d289f57e1b4d1de52dd50db96b11f20ccfb /services/camera/libcameraservice/CameraService.cpp | |
parent | 59797e6bece0ac2d649d8d93d02ed81979950145 (diff) | |
download | frameworks_base-7b6da3c7a2cdc44a35f3af3b4110eabda6f6a4b7.zip frameworks_base-7b6da3c7a2cdc44a35f3af3b4110eabda6f6a4b7.tar.gz frameworks_base-7b6da3c7a2cdc44a35f3af3b4110eabda6f6a4b7.tar.bz2 |
Add initialize method to CameraHardwareInterface
Add intialize() method to CameraHardwareInterface so we can
return a proper error value to CameraService if open of camera
hardware module fails.
b/5405235
Change-Id: I09c627034ddd22a5753c5163392c4fcff301e0b9
Signed-off-by: Tyler Luu <tluu@ti.com>
Signed-off-by: Iliyan Malchev <malchev@google.com>
Diffstat (limited to 'services/camera/libcameraservice/CameraService.cpp')
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index 05e7bcf..f306e4a 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -133,6 +133,8 @@ status_t CameraService::getCameraInfo(int cameraId, sp<ICamera> CameraService::connect( const sp<ICameraClient>& cameraClient, int cameraId) { int callingPid = getCallingPid(); + sp<CameraHardwareInterface> hardware = NULL; + LOG1("CameraService::connect E (pid %d, id %d)", callingPid, cameraId); if (!mModule) { @@ -187,10 +189,13 @@ sp<ICamera> CameraService::connect( char camera_device_name[10]; snprintf(camera_device_name, sizeof(camera_device_name), "%d", cameraId); - client = new Client(this, cameraClient, - new CameraHardwareInterface(&mModule->common, - camera_device_name), - cameraId, info.facing, callingPid); + hardware = new CameraHardwareInterface(camera_device_name); + if (hardware->initialize(&mModule->common) != OK) { + hardware.clear(); + return NULL; + } + + client = new Client(this, cameraClient, hardware, cameraId, info.facing, callingPid); mClient[cameraId] = client; LOG1("CameraService::connect X"); return client; |