camera: update CameraModule
1. Add more accessor methods to CameraModule to prevent exposing
raw module pointer
2. Use KeyedVector to replace array
Bug: 19897963
Change-Id: I111cc093f09f5fb3c4b13693d5d0687e1f441058
diff --git a/services/camera/libcameraservice/CameraFlashlight.cpp b/services/camera/libcameraservice/CameraFlashlight.cpp
index 6fda9b2..8613ac6 100644
--- a/services/camera/libcameraservice/CameraFlashlight.cpp
+++ b/services/camera/libcameraservice/CameraFlashlight.cpp
@@ -55,8 +55,7 @@
status_t res = OK;
- if (mCameraModule->getRawModule()->module_api_version >=
- CAMERA_MODULE_API_VERSION_2_4) {
+ if (mCameraModule->getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_4) {
mFlashControl = new ModuleFlashControl(*mCameraModule, *mCallbacks);
if (mFlashControl == NULL) {
ALOGV("%s: cannot create flash control for module api v2.4+",
@@ -66,8 +65,8 @@
} else {
uint32_t deviceVersion = CAMERA_DEVICE_API_VERSION_1_0;
- if (mCameraModule->getRawModule()->module_api_version >=
- CAMERA_MODULE_API_VERSION_2_0) {
+ if (mCameraModule->getModuleApiVersion() >=
+ CAMERA_MODULE_API_VERSION_2_0) {
camera_info info;
res = mCameraModule->getCameraInfo(
atoi(String8(cameraId).string()), &info);
@@ -224,8 +223,7 @@
return NO_INIT;
}
- if (mCameraModule->getRawModule()->module_api_version <
- CAMERA_MODULE_API_VERSION_2_4) {
+ if (mCameraModule->getModuleApiVersion() < CAMERA_MODULE_API_VERSION_2_4) {
// framework is going to open a camera device, all flash light control
// should be closed for backward compatible support.
mFlashControl.clear();
@@ -274,8 +272,7 @@
if (mOpenedCameraIds.size() != 0)
return OK;
- if (mCameraModule->getRawModule()->module_api_version <
- CAMERA_MODULE_API_VERSION_2_4) {
+ if (mCameraModule->getModuleApiVersion() < CAMERA_MODULE_API_VERSION_2_4) {
// notify torch available for all cameras with a flash
int numCameras = mCameraModule->getNumberOfCameras();
for (int i = 0; i < numCameras; i++) {