Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93df8a71 authored by Steve Kondik's avatar Steve Kondik
Browse files

camera: Add support for sending raw commands

 * 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
parent 26caff32
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -996,6 +996,12 @@ public class Camera {

    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.
     *
+14 −0
Original line number Diff line number Diff line
@@ -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[] = {
@@ -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 {