summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/CameraHardwareInterface.h
diff options
context:
space:
mode:
authorTyler Luu <tluu@ti.com>2011-10-06 00:00:03 -0500
committerIliyan Malchev <malchev@google.com>2011-10-07 09:24:05 -0700
commit5861a9a98c641261c4807c976c750e4611b3a57d (patch)
treebaba94df5819920a68548a58fd0e9fc28d74d62d /services/camera/libcameraservice/CameraHardwareInterface.h
parent003124e20eb0744aab36ad1bde05e15ac122ad75 (diff)
downloadframeworks_av-5861a9a98c641261c4807c976c750e4611b3a57d.zip
frameworks_av-5861a9a98c641261c4807c976c750e4611b3a57d.tar.gz
frameworks_av-5861a9a98c641261c4807c976c750e4611b3a57d.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/CameraHardwareInterface.h')
-rw-r--r--services/camera/libcameraservice/CameraHardwareInterface.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/services/camera/libcameraservice/CameraHardwareInterface.h b/services/camera/libcameraservice/CameraHardwareInterface.h
index 31544b3..c3ced4c 100644
--- a/services/camera/libcameraservice/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/CameraHardwareInterface.h
@@ -80,24 +80,33 @@ typedef void (*data_callback_timestamp)(nsecs_t timestamp,
class CameraHardwareInterface : public virtual RefBase {
public:
- CameraHardwareInterface(hw_module_t *module, const char *name)
+ CameraHardwareInterface(const char *name)
{
mDevice = 0;
mName = name;
- LOGI("Opening camera %s, this %p", name, this);
- int rc = module->methods->open(module, name,
- (hw_device_t **)&mDevice);
- if (rc != OK)
- LOGE("Could not open camera %s: %d", name, rc);
- initHalPreviewWindow();
}
~CameraHardwareInterface()
{
LOGI("Destroying camera %s", mName.string());
- int rc = mDevice->common.close(&mDevice->common);
- if (rc != OK)
- LOGE("Could not close camera %s: %d", mName.string(), rc);
+ if(mDevice) {
+ int rc = mDevice->common.close(&mDevice->common);
+ if (rc != OK)
+ LOGE("Could not close camera %s: %d", mName.string(), rc);
+ }
+ }
+
+ status_t initialize(hw_module_t *module)
+ {
+ LOGI("Opening camera %s", mName.string());
+ int rc = module->methods->open(module, mName.string(),
+ (hw_device_t **)&mDevice);
+ if (rc != OK) {
+ LOGE("Could not open camera %s: %d", mName.string(), rc);
+ return rc;
+ }
+ initHalPreviewWindow();
+ return rc;
}
/** Set the ANativeWindow to which preview frames are sent */