Merge "NEW_API: Add android.hardware.Camera.CameraInfo#canDisableShutterSound" into jb-mr1-dev

This commit is contained in:
Eino-Ville Talvala
2012-09-21 16:05:58 -07:00
committed by Android (Google) Code Review
3 changed files with 26 additions and 0 deletions

View File

@@ -9746,6 +9746,7 @@ package android.hardware {
ctor public Camera.CameraInfo();
field public static final int CAMERA_FACING_BACK = 0; // 0x0
field public static final int CAMERA_FACING_FRONT = 1; // 0x1
field public boolean canDisableShutterSound;
field public int facing;
field public int orientation;
}

View File

@@ -233,6 +233,21 @@ public class Camera {
* @see Parameters#setJpegThumbnailSize(int, int)
*/
public int orientation;
/**
* <p>Whether the shutter sound can be disabled.</p>
*
* <p>On some devices, the camera shutter sound cannot be turned off
* through {@link #enableShutterSound enableShutterSound}. This field
* can be used to determine whether a call to disable the shutter sound
* will succeed.</p>
*
* <p>If this field is set to true, then a call of
* {@code enableShutterSound(false)} will be successful. If set to
* false, then that call will fail, and the shutter sound will be played
* when {@link Camera#takePicture takePicture} is called.</p>
*/
public boolean canDisableShutterSound;
};
/**

View File

@@ -23,6 +23,7 @@
#include "JNIHelp.h"
#include "android_runtime/AndroidRuntime.h"
#include <cutils/properties.h>
#include <utils/Vector.h>
#include <gui/SurfaceTexture.h>
@@ -38,6 +39,7 @@ struct fields_t {
jfieldID surfaceTexture;
jfieldID facing;
jfieldID orientation;
jfieldID canDisableShutterSound;
jfieldID face_rect;
jfieldID face_score;
jfieldID rect_left;
@@ -453,6 +455,12 @@ static void android_hardware_Camera_getCameraInfo(JNIEnv *env, jobject thiz,
}
env->SetIntField(info_obj, fields.facing, cameraInfo.facing);
env->SetIntField(info_obj, fields.orientation, cameraInfo.orientation);
char value[PROPERTY_VALUE_MAX];
property_get("ro.camera.sound.forced", value, "0");
jboolean canDisableShutterSound = (strncmp(value, "0", 2) == 0);
env->SetBooleanField(info_obj, fields.canDisableShutterSound,
canDisableShutterSound);
}
// connect to camera service
@@ -962,6 +970,8 @@ int register_android_hardware_Camera(JNIEnv *env)
ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID, "I", &fields.surfaceTexture },
{ "android/hardware/Camera$CameraInfo", "facing", "I", &fields.facing },
{ "android/hardware/Camera$CameraInfo", "orientation", "I", &fields.orientation },
{ "android/hardware/Camera$CameraInfo", "canDisableShutterSound", "Z",
&fields.canDisableShutterSound },
{ "android/hardware/Camera$Face", "rect", "Landroid/graphics/Rect;", &fields.face_rect },
{ "android/hardware/Camera$Face", "score", "I", &fields.face_score },
{ "android/graphics/Rect", "left", "I", &fields.rect_left },