Skip to content

Commit

Permalink
camera: Add support for sending raw commands
Browse files Browse the repository at this point in the history
 * Certain camera drivers need magic commands to select special modes
   such as ZSL or HDR. Add support for sending raw commands from
   applications.

Change-Id: I512a765c7a67ffd2877e465cf6493ffc2b3b54ac
  • Loading branch information
hyperb1iss authored and Whitehawkx committed May 5, 2013
1 parent 8ecc478 commit b12e4e1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/java/android/hardware/Camera.java
Expand Up @@ -996,6 +996,12 @@ public void setAutoFocusMoveCallback(AutoFocusMoveCallback cb) {

private native void enableFocusMoveCallback(int enable);

/**
* Send a raw command to the camera driver
* @hide
*/
public native void sendRawCommand(int arg1, int arg2, int arg3);

/**
* Callback interface used to signal the moment of actual image capture.
*
Expand Down
14 changes: 14 additions & 0 deletions core/jni/android_hardware_Camera.cpp
Expand Up @@ -852,6 +852,17 @@ static void android_hardware_Camera_enableFocusMoveCallback(JNIEnv *env, jobject
#endif
}

static void android_hardware_Camera_sendRawCommand(JNIEnv *env, jobject thiz, jint arg1, jint arg2, jint arg3)
{
ALOGV("sendRawCommand %d, %d, %d", arg1, arg2, arg3);
sp<Camera> camera = get_native_camera(env, thiz, NULL);
if (camera == 0) return;

if (camera->sendCommand(arg1, arg2, arg3) != NO_ERROR) {
jniThrowRuntimeException(env, "send raw command failed");
}
}

//-------------------------------------------------

static JNINativeMethod camMethods[] = {
Expand Down Expand Up @@ -933,6 +944,9 @@ static JNINativeMethod camMethods[] = {
{ "enableFocusMoveCallback",
"(I)V",
(void *)android_hardware_Camera_enableFocusMoveCallback},
{ "sendRawCommand",
"(III)V",
(void *)android_hardware_Camera_sendRawCommand},
};

struct field {
Expand Down

0 comments on commit b12e4e1

Please sign in to comment.