From 43b1b3ff0b92eb4ef97038176a26ea05679b592d Mon Sep 17 00:00:00 2001 From: Dimitry Ivanov Date: Wed, 16 Nov 2016 18:28:04 -0800 Subject: [PATCH] Fix coretests: Remove dependency on libnativehelper This dependency was never needed and it makes test app depend on private platform libraries - which is no longer allowed. This change fixes these problems by removing dependency and renaming JNI method. Test: Install the test and start it. Change-Id: I9878627148917c1b5928b98f3c86f6e6097093d6 --- .../coretests/apks/install_jni_lib/Android.mk | 3 +-- ...m_android_frameworks_coretests_JNITest.cpp | 24 +++---------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/core/tests/coretests/apks/install_jni_lib/Android.mk b/core/tests/coretests/apks/install_jni_lib/Android.mk index 9e45d099b6695..d7b38e844b5e1 100644 --- a/core/tests/coretests/apks/install_jni_lib/Android.mk +++ b/core/tests/coretests/apks/install_jni_lib/Android.mk @@ -19,8 +19,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := \ com_android_frameworks_coretests_JNITest.cpp -LOCAL_SHARED_LIBRARIES := \ - libnativehelper +LOCAL_SDK_VERSION := 16 LOCAL_CFLAGS += -Wall -Werror diff --git a/core/tests/coretests/apks/install_jni_lib/com_android_frameworks_coretests_JNITest.cpp b/core/tests/coretests/apks/install_jni_lib/com_android_frameworks_coretests_JNITest.cpp index 8d9119275bc80..0cf3a84a38596 100644 --- a/core/tests/coretests/apks/install_jni_lib/com_android_frameworks_coretests_JNITest.cpp +++ b/core/tests/coretests/apks/install_jni_lib/com_android_frameworks_coretests_JNITest.cpp @@ -14,41 +14,23 @@ * limitations under the License. */ -#include "nativehelper/JNIHelp.h" +#include -namespace android { - -static jint checkFunction(JNIEnv*, jclass) { +extern "C" JNIEXPORT +jint JNICALL Java_com_android_frameworks_coretests_JNITests_checkFunction(JNIEnv*, jclass) { return 1; } -static const JNINativeMethod sMethods[] = { - /* name, signature, funcPtr */ - { "checkFunction", "()I", (void*) checkFunction }, -}; - -int register_com_android_frameworks_coretests_JNITests(JNIEnv* env) { - return jniRegisterNativeMethods(env, "com/android/frameworks/coretests/JNITests", sMethods, - NELEM(sMethods)); -} - -} - /* * JNI Initialization */ jint JNI_OnLoad(JavaVM *jvm, void */* reserved */) { JNIEnv *e; - int status; // Check JNI version if (jvm->GetEnv((void **) &e, JNI_VERSION_1_6)) { return JNI_ERR; } - if ((status = android::register_com_android_frameworks_coretests_JNITests(e)) < 0) { - return JNI_ERR; - } - return JNI_VERSION_1_6; }