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

Commit fb6bcc35 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Camera: Adds support for meta data callbacks"

parents 8431b554 114826f6
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -701,6 +701,24 @@ static void android_hardware_Camera_setHasPreviewCallback(JNIEnv *env, jobject t
    context->setCallbackMode(env, installed, manualBuffer);
}

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);

@@ -981,6 +999,9 @@ static JNINativeMethod camMethods[] = {
  { "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 },