summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2011-11-16 00:28:27 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-11-16 00:28:27 -0800
commit98834fa05dcd1ea225c22c126ec9f4cd9b8fb156 (patch)
tree6143168af1057cb4ac0fda400deab54fc8e27ca2
parent04879ef96d595873a69f2a80d51d6bde4b3215c7 (diff)
parent5ca81587a0aeced4296d34f198bf6a50b2cc2429 (diff)
downloadhardware_ti_omap4-98834fa05dcd1ea225c22c126ec9f4cd9b8fb156.zip
hardware_ti_omap4-98834fa05dcd1ea225c22c126ec9f4cd9b8fb156.tar.gz
hardware_ti_omap4-98834fa05dcd1ea225c22c126ec9f4cd9b8fb156.tar.bz2
am 499aad98: am 53613f8e: am 6014a8f2: When camera.flash_off is 1, disable camera flash. This is for testing purpose only
* commit '499aad98956ba1ab16c6bc6540cd19ee1bad189e': When camera.flash_off is 1, disable camera flash. This is for testing purpose only
-rw-r--r--camera/OMXCameraAdapter/OMX3A.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/camera/OMXCameraAdapter/OMX3A.cpp b/camera/OMXCameraAdapter/OMX3A.cpp
index 6b4aa63..be4c0e7 100644
--- a/camera/OMXCameraAdapter/OMX3A.cpp
+++ b/camera/OMXCameraAdapter/OMX3A.cpp
@@ -29,6 +29,8 @@
#include "OMXCameraAdapter.h"
#include "ErrorUtils.h"
+#include <cutils/properties.h>
+
#undef TRUE
#undef FALSE
#define TRUE "true"
@@ -475,6 +477,22 @@ status_t OMXCameraAdapter::setExposureMode(Gen3A_settings& Gen3A)
return ErrorUtils::omxToAndroidError(eError);
}
+static bool isFlashDisabled() {
+#if (PROPERTY_VALUE_MAX < 5)
+#error "PROPERTY_VALUE_MAX must be at least 5"
+#endif
+
+ char value[PROPERTY_VALUE_MAX];
+ if (property_get("camera.flash_off", value, NULL) &&
+ (!strcasecmp(value, "true") || !strcasecmp(value, "1"))) {
+ LOGW("flash is turned off");
+ return true;
+ }
+
+ LOGI("flash is turned on");
+ return false;
+}
+
status_t OMXCameraAdapter::setFlashMode(Gen3A_settings& Gen3A)
{
status_t ret = NO_ERROR;
@@ -492,7 +510,12 @@ status_t OMXCameraAdapter::setFlashMode(Gen3A_settings& Gen3A)
OMX_INIT_STRUCT_PTR (&flash, OMX_IMAGE_PARAM_FLASHCONTROLTYPE);
flash.nPortIndex = OMX_ALL;
- flash.eFlashControl = ( OMX_IMAGE_FLASHCONTROLTYPE ) Gen3A.FlashMode;
+
+ if (isFlashDisabled()) {
+ flash.eFlashControl = ( OMX_IMAGE_FLASHCONTROLTYPE ) OMX_IMAGE_FlashControlOff;
+ } else {
+ flash.eFlashControl = ( OMX_IMAGE_FLASHCONTROLTYPE ) Gen3A.FlashMode;
+ }
CAMHAL_LOGDB("Configuring flash mode 0x%x", flash.eFlashControl);
eError = OMX_SetConfig(mCameraAdapterParameters.mHandleComp,