diff options
author | Shuzhen Wang <shuzhenw@codeaurora.org> | 2015-07-09 14:47:34 -0700 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:26:09 -0600 |
commit | 74e4a37ba2d9bd4908dd1e8c694c746c8da0ee8e (patch) | |
tree | d4d1a347e590ba59d8a59d118795bf2d92c9e25d /core/jni/android_hardware_Camera.cpp | |
parent | 70134eacb72c3450c9fd4ed2aa8b8d9db835ca7a (diff) | |
download | frameworks_base-74e4a37ba2d9bd4908dd1e8c694c746c8da0ee8e.zip frameworks_base-74e4a37ba2d9bd4908dd1e8c694c746c8da0ee8e.tar.gz frameworks_base-74e4a37ba2d9bd4908dd1e8c694c746c8da0ee8e.tar.bz2 |
Camera: Add feature extensions
This change includes below gerrits:
# This is a combination of 7 commits.
# The first commit's message is:
Camera: Add support for QC camera features.
Added APIs and keys for all QC features. This
will enable application to get/set paramters.
(cherrypicked from commit d0c5a0ee7e9af41320fed00ff324c6d0f22eb697)
Change-Id: I68c23aaf7267645efeb4d4743b390a048292b7fd
# This is the 2nd commit message:
Camera: Adds support for meta data callbacks
- This change adds a new type of callback
that will be called when there are pending
meta data notifications.
Change-Id: I84f5cbafe4f023c7b0efa9ec8620756b0eaa428d
# This is the 3rd commit message:
Camera: Adds support for longshot configuration
- The Camera API is extended with one additional
call for longshot mode configuration.
(cherrypicked from commit 867c4865b2a61a8e844e2784c41b7aafc392aec0 )
Change-Id: Idb91a21dc0d9fa9d22b4a6bbcc0b2eebfc2cb6db
# This is the 4th commit message:
Camera: Add support for manual 3A
Add API for manual 3A (awb/af/aec).
Change-Id: Ia5240207ce7a6628e8fdfef79f56db01add14aef
# This is the 5th commit message:
Camera: use single KEY for set/get manual 3A parameters.
Instead of using different KEYs, we can share one same key,
for set/get 3A parameters from APK.
Change-Id: Ie3216ee4e1b8f62fcdd57a0be119d4b8dcdd81b3
# This is the 6th commit message:
Framework: Adding support for Auto HDR
Adding support for Auto HDR for camera
CRs-fixed: 629556
Change-Id: Ie5e4718524d2ed799f1f9af1f76e89c01d743ac8
# This is the 7th commit message:
Camera: Add support for video rotation
Adding apis to support video rotation.
CRs-Fixed: 672804
Change-Id: Ic67e82058824a6dc7cc803ef0efe61475350bafc
Change-Id: Ideb191d666e7de8db132811f66a7796d87e75971
Diffstat (limited to 'core/jni/android_hardware_Camera.cpp')
-rw-r--r-- | core/jni/android_hardware_Camera.cpp | 82 |
1 files changed, 81 insertions, 1 deletions
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp index 4f44c26..5f1c6bf 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -434,6 +434,56 @@ void JNICameraContext::setCallbackMode(JNIEnv *env, bool installed, bool manualM } } +static void android_hardware_Camera_setLongshot(JNIEnv *env, jobject thiz, jboolean enable) +{ + ALOGV("setLongshot"); + JNICameraContext* context; + status_t rc; + sp<Camera> camera = get_native_camera(env, thiz, &context); + if (camera == 0) return; + + if ( enable ) { + rc = camera->sendCommand(CAMERA_CMD_LONGSHOT_ON, 0, 0); + } else { + rc = camera->sendCommand(CAMERA_CMD_LONGSHOT_OFF, 0, 0); + } + + if (rc != NO_ERROR) { + jniThrowException(env, "java/lang/RuntimeException", "enabling longshot mode failed"); + } +} + +static void android_hardware_Camera_sendHistogramData(JNIEnv *env, jobject thiz) + { + ALOGV("sendHistogramData" ); + JNICameraContext* context; + status_t rc; + sp<Camera> camera = get_native_camera(env, thiz, &context); + if (camera == 0) return; + + rc = camera->sendCommand(CAMERA_CMD_HISTOGRAM_SEND_DATA, 0, 0); + + if (rc != NO_ERROR) { + jniThrowException(env, "java/lang/RuntimeException", "send histogram data failed"); + } + } + static void android_hardware_Camera_setHistogramMode(JNIEnv *env, jobject thiz, jboolean mode) + { + ALOGV("setHistogramMode: mode:%d", (int)mode); + JNICameraContext* context; + status_t rc; + sp<Camera> camera = get_native_camera(env, thiz, &context); + if (camera == 0) return; + + if(mode == true) + rc = camera->sendCommand(CAMERA_CMD_HISTOGRAM_ON, 0, 0); + else + rc = camera->sendCommand(CAMERA_CMD_HISTOGRAM_OFF, 0, 0); + + if (rc != NO_ERROR) { + jniThrowException(env, "java/lang/RuntimeException", "set histogram mode failed"); + } + } void JNICameraContext::addCallbackBuffer( JNIEnv *env, jbyteArray cbb, int msgType) { @@ -717,7 +767,25 @@ static void android_hardware_Camera_setHasPreviewCallback(JNIEnv *env, jobject t context->setCallbackMode(env, installed, manualBuffer); } -static void android_hardware_Camera_addCallbackBuffer(JNIEnv *env, jobject thiz, jbyteArray bytes, jint msgType) { +static void android_hardware_Camera_setMetadataCb(JNIEnv *env, jobject thiz, jboolean mode) +{ + ALOGV("setMetadataCb: mode:%d", (int)mode); + JNICameraContext* context; + status_t rc; + sp<Camera> camera = get_native_camera(env, thiz, &context); + if (camera == 0) return; + + if(mode == true) + rc = camera->sendCommand(CAMERA_CMD_METADATA_ON, 0, 0); + else + rc = camera->sendCommand(CAMERA_CMD_METADATA_OFF, 0, 0); + + if (rc != NO_ERROR) { + jniThrowException(env, "java/lang/RuntimeException", "set metadata mode failed"); + } +} + +static void android_hardware_Camera_addCallbackBuffer(JNIEnv *env, jobject thiz, jbyteArray bytes, int msgType) { ALOGV("addCallbackBuffer: 0x%x", msgType); JNICameraContext* context = reinterpret_cast<JNICameraContext*>(env->GetLongField(thiz, fields.context)); @@ -995,6 +1063,18 @@ static JNINativeMethod camMethods[] = { { "native_takePicture", "(I)V", (void *)android_hardware_Camera_takePicture }, + { "native_setHistogramMode", + "(Z)V", + (void *)android_hardware_Camera_setHistogramMode }, + { "native_setMetadataCb", + "(Z)V", + (void *)android_hardware_Camera_setMetadataCb }, + { "native_sendHistogramData", + "()V", + (void *)android_hardware_Camera_sendHistogramData }, + { "native_setLongshot", + "(Z)V", + (void *)android_hardware_Camera_setLongshot }, { "native_setParameters", "(Ljava/lang/String;)V", (void *)android_hardware_Camera_setParameters }, |