Loading core/java/android/hardware/Camera.java +25 −0 Original line number Diff line number Diff line Loading @@ -1145,6 +1145,31 @@ public class Camera { */ public native final void setDisplayOrientation(int degrees); /** * Enable or disable the default shutter sound when taking a picture. * * By default, the camera plays the system-defined camera shutter sound when * {@link #takePicture} is called. Using this method, the shutter sound can * be disabled. It is strongly recommended that an alternative shutter sound * is played in the {@link ShutterCallback} when the system shutter sound is * disabled. * * Note that devices may not always allow control of the camera shutter * sound. If the shutter sound cannot be controlled, this method will return * false. * * @param enabled whether the camera should play the system shutter sound * when {@link #takePicture takePicture} is called. * @return true if the shutter sound state was successfully changed. False * if the shutter sound cannot be controlled; in this case, the * application should not play its own shutter sound since the * system shutter sound will play when a picture is taken. * @see #takePicture * @see ShutterCallback * @hide */ public native final boolean enableShutterSound(boolean enabled); /** * Callback interface for zoom changes during a smooth zoom operation. * Loading core/jni/android_hardware_Camera.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -781,6 +781,25 @@ static void android_hardware_Camera_setDisplayOrientation(JNIEnv *env, jobject t } } static jboolean android_hardware_Camera_enableShutterSound(JNIEnv *env, jobject thiz, jboolean enabled) { ALOGV("enableShutterSound"); sp<Camera> camera = get_native_camera(env, thiz, NULL); if (camera == 0) return JNI_FALSE; int32_t value = (enabled == JNI_TRUE) ? 1 : 0; status_t rc = camera->sendCommand(CAMERA_CMD_ENABLE_SHUTTER_SOUND, value, 0); if (rc == NO_ERROR) { return JNI_TRUE; } else if (rc == PERMISSION_DENIED) { return JNI_FALSE; } else { jniThrowRuntimeException(env, "enable shutter sound failed"); return JNI_FALSE; } } static void android_hardware_Camera_startFaceDetection(JNIEnv *env, jobject thiz, jint type) { Loading Loading @@ -890,6 +909,9 @@ static JNINativeMethod camMethods[] = { { "setDisplayOrientation", "(I)V", (void *)android_hardware_Camera_setDisplayOrientation }, { "enableShutterSound", "(Z)Z", (void *)android_hardware_Camera_enableShutterSound }, { "_startFaceDetection", "(I)V", (void *)android_hardware_Camera_startFaceDetection }, Loading Loading
core/java/android/hardware/Camera.java +25 −0 Original line number Diff line number Diff line Loading @@ -1145,6 +1145,31 @@ public class Camera { */ public native final void setDisplayOrientation(int degrees); /** * Enable or disable the default shutter sound when taking a picture. * * By default, the camera plays the system-defined camera shutter sound when * {@link #takePicture} is called. Using this method, the shutter sound can * be disabled. It is strongly recommended that an alternative shutter sound * is played in the {@link ShutterCallback} when the system shutter sound is * disabled. * * Note that devices may not always allow control of the camera shutter * sound. If the shutter sound cannot be controlled, this method will return * false. * * @param enabled whether the camera should play the system shutter sound * when {@link #takePicture takePicture} is called. * @return true if the shutter sound state was successfully changed. False * if the shutter sound cannot be controlled; in this case, the * application should not play its own shutter sound since the * system shutter sound will play when a picture is taken. * @see #takePicture * @see ShutterCallback * @hide */ public native final boolean enableShutterSound(boolean enabled); /** * Callback interface for zoom changes during a smooth zoom operation. * Loading
core/jni/android_hardware_Camera.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -781,6 +781,25 @@ static void android_hardware_Camera_setDisplayOrientation(JNIEnv *env, jobject t } } static jboolean android_hardware_Camera_enableShutterSound(JNIEnv *env, jobject thiz, jboolean enabled) { ALOGV("enableShutterSound"); sp<Camera> camera = get_native_camera(env, thiz, NULL); if (camera == 0) return JNI_FALSE; int32_t value = (enabled == JNI_TRUE) ? 1 : 0; status_t rc = camera->sendCommand(CAMERA_CMD_ENABLE_SHUTTER_SOUND, value, 0); if (rc == NO_ERROR) { return JNI_TRUE; } else if (rc == PERMISSION_DENIED) { return JNI_FALSE; } else { jniThrowRuntimeException(env, "enable shutter sound failed"); return JNI_FALSE; } } static void android_hardware_Camera_startFaceDetection(JNIEnv *env, jobject thiz, jint type) { Loading Loading @@ -890,6 +909,9 @@ static JNINativeMethod camMethods[] = { { "setDisplayOrientation", "(I)V", (void *)android_hardware_Camera_setDisplayOrientation }, { "enableShutterSound", "(Z)Z", (void *)android_hardware_Camera_enableShutterSound }, { "_startFaceDetection", "(I)V", (void *)android_hardware_Camera_startFaceDetection }, Loading