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

Commit ffe1cf25 authored by Wu-cheng Li's avatar Wu-cheng Li
Browse files

Unhide Camera lock and unlock API.

parent 2092361d
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -67328,6 +67328,17 @@
 visibility="public"
>
</method>
<method name="lock"
 return="void"
 abstract="false"
 native="true"
 synchronized="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="open"
 return="android.hardware.Camera"
 abstract="false"
@@ -67488,6 +67499,17 @@
<parameter name="jpeg" type="android.hardware.Camera.PictureCallback">
</parameter>
</method>
<method name="unlock"
 return="void"
 abstract="false"
 native="true"
 synchronized="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<field name="CAMERA_ERROR_SERVER_DIED"
 type="int"
 transient="false"
+4 −10
Original line number Diff line number Diff line
@@ -137,7 +137,6 @@ public class Camera {
     *
     * @throws IOException if the method fails.
     *
     * FIXME: Unhide after approval
     * @hide
     */
    public native final void reconnect() throws IOException;
@@ -150,25 +149,20 @@ public class Camera {
     * Camera object is locked. Locking it again from the same process will
     * have no effect. Attempting to lock it from another process if it has
     * not been unlocked will fail.
     * Returns 0 if lock was successful.
     *
     * FIXME: Unhide after approval
     * @hide
     * @throws RuntimeException if the method fails.
     */
    public native final int lock();
    public native final void lock();

    /**
     * Unlock the camera to allow another process to access it. To save
     * setup/teardown time, a client of Camera can pass an initialized Camera
     * object to another process. This method is used to unlock the Camera
     * object before handing off the Camera object to the other process.

     * Returns 0 if unlock was successful.
     *
     * FIXME: Unhide after approval
     * @hide
     * @throws RuntimeException if the method fails.
     */
    public native final int unlock();
    public native final void unlock();

    /**
     * Sets the SurfaceHolder to be used for a picture preview. If the surface
+15 −9
Original line number Diff line number Diff line
@@ -391,20 +391,26 @@ static void android_hardware_Camera_reconnect(JNIEnv *env, jobject thiz)
    }
}

static jint android_hardware_Camera_lock(JNIEnv *env, jobject thiz)
static void android_hardware_Camera_lock(JNIEnv *env, jobject thiz)
{
    LOGV("lock");
    sp<Camera> camera = get_native_camera(env, thiz, NULL);
    if (camera == 0) return INVALID_OPERATION;
    return (jint) camera->lock();
    if (camera == 0) return;

    if (camera->lock() != NO_ERROR) {
        jniThrowException(env, "java/lang/RuntimeException", "lock failed");
    }
}

static jint android_hardware_Camera_unlock(JNIEnv *env, jobject thiz)
static void android_hardware_Camera_unlock(JNIEnv *env, jobject thiz)
{
    LOGV("unlock");
    sp<Camera> camera = get_native_camera(env, thiz, NULL);
    if (camera == 0) return INVALID_OPERATION;
    return (jint) camera->unlock();
    if (camera == 0) return;

    if (camera->unlock() != NO_ERROR) {
        jniThrowException(env, "java/lang/RuntimeException", "unlock failed");
    }
}

//-------------------------------------------------
@@ -450,10 +456,10 @@ static JNINativeMethod camMethods[] = {
    "()V",
    (void*)android_hardware_Camera_reconnect },
  { "lock",
    "()I",
    "()V",
    (void*)android_hardware_Camera_lock },
  { "unlock",
    "()I",
    "()V",
    (void*)android_hardware_Camera_unlock },
};