From 676b21b30edbd74d7b9aae247961a1ffde1b8993 Mon Sep 17 00:00:00 2001 From: Chien-Yu Chen Date: Tue, 24 Feb 2015 10:28:19 -0800 Subject: 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 --- services/camera/libcameraservice/CameraFlashlight.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'services/camera/libcameraservice/CameraFlashlight.cpp') 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 CameraFlashlight::createFlashlightControl(const String8& cameraId) { 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 @@ status_t CameraFlashlight::createFlashlightControl(const String8& cameraId) { } 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 @@ status_t CameraFlashlight::prepareDeviceOpen(const String8& cameraId) { 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 @@ status_t CameraFlashlight::deviceClosed(const String8& cameraId) { 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++) { -- cgit v1.1