CameraService: Add support for module init, some logging updates
- Add support for camera HAL module init() method on v2.4
- Add logging for service errors such as failure to init
- Minor cleanup to dumping of event log
Bug: 20016050
Change-Id: I94e18b52c186f16fb096457015f7ae761e867fd8
diff --git a/services/camera/libcameraservice/common/CameraModule.cpp b/services/camera/libcameraservice/common/CameraModule.cpp
index e5b12ae..5e0ac9f 100644
--- a/services/camera/libcameraservice/common/CameraModule.cpp
+++ b/services/camera/libcameraservice/common/CameraModule.cpp
@@ -57,6 +57,14 @@
mCameraInfoMap.setCapacity(getNumberOfCameras());
}
+int CameraModule::init() {
+ if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_4 &&
+ mModule->init != NULL) {
+ return mModule->init();
+ }
+ return OK;
+}
+
int CameraModule::getCameraInfo(int cameraId, struct camera_info *info) {
Mutex::Autolock lock(mCameraInfoLock);
if (cameraId < 0) {
@@ -92,7 +100,7 @@
assert(index != NAME_NOT_FOUND);
// return the cached camera info
*info = mCameraInfoMap[index];
- return 0;
+ return OK;
}
int CameraModule::open(const char* id, struct hw_device_t** device) {
@@ -160,4 +168,3 @@
}
}; // namespace android
-
diff --git a/services/camera/libcameraservice/common/CameraModule.h b/services/camera/libcameraservice/common/CameraModule.h
index e285b21..c21092e 100644
--- a/services/camera/libcameraservice/common/CameraModule.h
+++ b/services/camera/libcameraservice/common/CameraModule.h
@@ -34,6 +34,10 @@
public:
CameraModule(camera_module_t *module);
+ // Must be called after construction
+ // Returns OK on success, NO_INIT on failure
+ int init();
+
int getCameraInfo(int cameraId, struct camera_info *info);
int getNumberOfCameras(void);
int open(const char* id, struct hw_device_t** device);
@@ -63,4 +67,3 @@
} // namespace android
#endif
-