Merge "Replace locking JNI array methods" into tm-dev am: 36e07fa1e4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18418955 Change-Id: I95e6bf2791365ce6720002b856f44f1de216a2e0 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -368,14 +368,14 @@ android_media_AudioEffect_native_setup(JNIEnv *env, jobject thiz, jobject weak_t
|
|||||||
goto setup_failure;
|
goto setup_failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
nId = (jint *) env->GetPrimitiveArrayCritical(jId, NULL);
|
nId = env->GetIntArrayElements(jId, nullptr /* isCopy */);
|
||||||
if (nId == NULL) {
|
if (nId == NULL) {
|
||||||
ALOGE("setup: Error retrieving id pointer");
|
ALOGE("setup: Error retrieving id pointer");
|
||||||
lStatus = AUDIOEFFECT_ERROR_BAD_VALUE;
|
lStatus = AUDIOEFFECT_ERROR_BAD_VALUE;
|
||||||
goto setup_failure;
|
goto setup_failure;
|
||||||
}
|
}
|
||||||
nId[0] = lpAudioEffect->id();
|
nId[0] = lpAudioEffect->id();
|
||||||
env->ReleasePrimitiveArrayCritical(jId, nId, 0);
|
env->ReleaseIntArrayElements(jId, nId, 0 /* mode */);
|
||||||
nId = NULL;
|
nId = NULL;
|
||||||
|
|
||||||
if (typeStr) {
|
if (typeStr) {
|
||||||
@@ -418,7 +418,7 @@ android_media_AudioEffect_native_setup(JNIEnv *env, jobject thiz, jobject weak_t
|
|||||||
setup_failure:
|
setup_failure:
|
||||||
|
|
||||||
if (nId != NULL) {
|
if (nId != NULL) {
|
||||||
env->ReleasePrimitiveArrayCritical(jId, nId, 0);
|
env->ReleaseIntArrayElements(jId, nId, 0 /* mode */);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpJniStorage) {
|
if (lpJniStorage) {
|
||||||
@@ -550,14 +550,14 @@ static jint android_media_AudioEffect_native_setParameter(JNIEnv *env,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get the pointer for the param from the java array
|
// get the pointer for the param from the java array
|
||||||
lpParam = (jbyte *) env->GetPrimitiveArrayCritical(pJavaParam, NULL);
|
lpParam = env->GetByteArrayElements(pJavaParam, nullptr /* isCopy */);
|
||||||
if (lpParam == NULL) {
|
if (lpParam == NULL) {
|
||||||
ALOGE("setParameter: Error retrieving param pointer");
|
ALOGE("setParameter: Error retrieving param pointer");
|
||||||
goto setParameter_Exit;
|
goto setParameter_Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the pointer for the value from the java array
|
// get the pointer for the value from the java array
|
||||||
lpValue = (jbyte *) env->GetPrimitiveArrayCritical(pJavaValue, NULL);
|
lpValue = env->GetByteArrayElements(pJavaValue, nullptr /* isCopy */);
|
||||||
if (lpValue == NULL) {
|
if (lpValue == NULL) {
|
||||||
ALOGE("setParameter: Error retrieving value pointer");
|
ALOGE("setParameter: Error retrieving value pointer");
|
||||||
goto setParameter_Exit;
|
goto setParameter_Exit;
|
||||||
@@ -580,10 +580,10 @@ static jint android_media_AudioEffect_native_setParameter(JNIEnv *env,
|
|||||||
setParameter_Exit:
|
setParameter_Exit:
|
||||||
|
|
||||||
if (lpParam != NULL) {
|
if (lpParam != NULL) {
|
||||||
env->ReleasePrimitiveArrayCritical(pJavaParam, lpParam, 0);
|
env->ReleaseByteArrayElements(pJavaParam, lpParam, 0 /* mode */);
|
||||||
}
|
}
|
||||||
if (lpValue != NULL) {
|
if (lpValue != NULL) {
|
||||||
env->ReleasePrimitiveArrayCritical(pJavaValue, lpValue, 0);
|
env->ReleaseByteArrayElements(pJavaValue, lpValue, 0 /* mode */);
|
||||||
}
|
}
|
||||||
return AudioEffectJni::translateNativeErrorToJava(lStatus);
|
return AudioEffectJni::translateNativeErrorToJava(lStatus);
|
||||||
}
|
}
|
||||||
@@ -611,14 +611,14 @@ android_media_AudioEffect_native_getParameter(JNIEnv *env,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get the pointer for the param from the java array
|
// get the pointer for the param from the java array
|
||||||
lpParam = (jbyte *) env->GetPrimitiveArrayCritical(pJavaParam, NULL);
|
lpParam = env->GetByteArrayElements(pJavaParam, nullptr /* isCopy */);
|
||||||
if (lpParam == NULL) {
|
if (lpParam == NULL) {
|
||||||
ALOGE("getParameter: Error retrieving param pointer");
|
ALOGE("getParameter: Error retrieving param pointer");
|
||||||
goto getParameter_Exit;
|
goto getParameter_Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the pointer for the value from the java array
|
// get the pointer for the value from the java array
|
||||||
lpValue = (jbyte *) env->GetPrimitiveArrayCritical(pJavaValue, NULL);
|
lpValue = env->GetByteArrayElements(pJavaValue, nullptr /* isCopy */);
|
||||||
if (lpValue == NULL) {
|
if (lpValue == NULL) {
|
||||||
ALOGE("getParameter: Error retrieving value pointer");
|
ALOGE("getParameter: Error retrieving value pointer");
|
||||||
goto getParameter_Exit;
|
goto getParameter_Exit;
|
||||||
@@ -644,10 +644,10 @@ android_media_AudioEffect_native_getParameter(JNIEnv *env,
|
|||||||
getParameter_Exit:
|
getParameter_Exit:
|
||||||
|
|
||||||
if (lpParam != NULL) {
|
if (lpParam != NULL) {
|
||||||
env->ReleasePrimitiveArrayCritical(pJavaParam, lpParam, 0);
|
env->ReleaseByteArrayElements(pJavaParam, lpParam, 0 /* mode */);
|
||||||
}
|
}
|
||||||
if (lpValue != NULL) {
|
if (lpValue != NULL) {
|
||||||
env->ReleasePrimitiveArrayCritical(pJavaValue, lpValue, 0);
|
env->ReleaseByteArrayElements(pJavaValue, lpValue, 0 /* mode */);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lStatus == NO_ERROR) {
|
if (lStatus == NO_ERROR) {
|
||||||
@@ -676,7 +676,7 @@ static jint android_media_AudioEffect_native_command(JNIEnv *env, jobject thiz,
|
|||||||
|
|
||||||
// get the pointer for the command from the java array
|
// get the pointer for the command from the java array
|
||||||
if (cmdSize != 0) {
|
if (cmdSize != 0) {
|
||||||
pCmdData = (jbyte *) env->GetPrimitiveArrayCritical(jCmdData, NULL);
|
pCmdData = env->GetByteArrayElements(jCmdData, nullptr /* isCopy */);
|
||||||
if (pCmdData == NULL) {
|
if (pCmdData == NULL) {
|
||||||
ALOGE("setParameter: Error retrieving command pointer");
|
ALOGE("setParameter: Error retrieving command pointer");
|
||||||
goto command_Exit;
|
goto command_Exit;
|
||||||
@@ -685,7 +685,7 @@ static jint android_media_AudioEffect_native_command(JNIEnv *env, jobject thiz,
|
|||||||
|
|
||||||
// get the pointer for the reply from the java array
|
// get the pointer for the reply from the java array
|
||||||
if (replySize != 0 && jReplyData != NULL) {
|
if (replySize != 0 && jReplyData != NULL) {
|
||||||
pReplyData = (jbyte *) env->GetPrimitiveArrayCritical(jReplyData, NULL);
|
pReplyData = env->GetByteArrayElements(jReplyData, nullptr /* isCopy */);
|
||||||
if (pReplyData == NULL) {
|
if (pReplyData == NULL) {
|
||||||
ALOGE("setParameter: Error retrieving reply pointer");
|
ALOGE("setParameter: Error retrieving reply pointer");
|
||||||
goto command_Exit;
|
goto command_Exit;
|
||||||
@@ -702,10 +702,10 @@ static jint android_media_AudioEffect_native_command(JNIEnv *env, jobject thiz,
|
|||||||
command_Exit:
|
command_Exit:
|
||||||
|
|
||||||
if (pCmdData != NULL) {
|
if (pCmdData != NULL) {
|
||||||
env->ReleasePrimitiveArrayCritical(jCmdData, pCmdData, 0);
|
env->ReleaseByteArrayElements(jCmdData, pCmdData, 0 /* mode */);
|
||||||
}
|
}
|
||||||
if (pReplyData != NULL) {
|
if (pReplyData != NULL) {
|
||||||
env->ReleasePrimitiveArrayCritical(jReplyData, pReplyData, 0);
|
env->ReleaseByteArrayElements(jReplyData, pReplyData, 0 /* mode */);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lStatus == NO_ERROR) {
|
if (lStatus == NO_ERROR) {
|
||||||
|
|||||||
Reference in New Issue
Block a user