Camera: update camera audio restriction API
Add dedicated get API per API review feedback.
Test: updated CTS tests
Bug: 140524714
Change-Id: I83ac09da76cc0868c7e993abd6a8c846912b6199
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index f87163b..bc69735 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -1023,22 +1023,38 @@
}
}
-static int32_t android_hardware_Camera_setAudioRestriction(
+static void android_hardware_Camera_setAudioRestriction(
JNIEnv *env, jobject thiz, jint mode)
{
ALOGV("setAudioRestriction");
sp<Camera> camera = get_native_camera(env, thiz, NULL);
if (camera == 0) {
jniThrowRuntimeException(env, "camera has been disconnected");
- return -1;
+ return;
}
int32_t ret = camera->setAudioRestriction(mode);
if (ret < 0) {
jniThrowRuntimeException(env, "Illegal argument or low-level eror");
+ return;
+ }
+}
+
+static int32_t android_hardware_Camera_getAudioRestriction(
+ JNIEnv *env, jobject thiz)
+{
+ ALOGV("getAudioRestriction");
+ sp<Camera> camera = get_native_camera(env, thiz, NULL);
+ if (camera == 0) {
+ jniThrowRuntimeException(env, "camera has been disconnected");
return -1;
}
+ int32_t ret = camera->getGlobalAudioRestriction();
+ if (ret < 0) {
+ jniThrowRuntimeException(env, "Illegal argument or low-level eror");
+ return -1;
+ }
return ret;
}
@@ -1127,8 +1143,11 @@
"(I)V",
(void *)android_hardware_Camera_enableFocusMoveCallback},
{ "setAudioRestriction",
- "(I)I",
+ "(I)V",
(void *)android_hardware_Camera_setAudioRestriction},
+ { "getAudioRestriction",
+ "()I",
+ (void *)android_hardware_Camera_getAudioRestriction},
};
struct field {