Unhide Camera lock and unlock API.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
|
||||
jobject mCameraJObjectWeak; // weak reference to java object
|
||||
jclass mCameraJClass; // strong reference to java class
|
||||
sp<Camera> mCamera; // strong reference to native object
|
||||
sp<Camera> mCamera; // strong reference to native object
|
||||
Mutex mLock;
|
||||
};
|
||||
|
||||
@@ -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 },
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user