1 /* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include <android/log.h> 18 #include <jni.h> 19 #include <stdlib.h> 20 21 #define LOG_TAG "Cts-JniTest" 22 23 /* 24 * This function is called automatically by the system when this 25 * library is loaded. We use it to register all our native functions, 26 * which is the recommended practice for Android. 27 */ 28 jint JNI_OnLoad(JavaVM *vm, void *reserved) { 29 JNIEnv *env = NULL; 30 31 if ((*vm)->GetEnv(vm, (void **) &env, JNI_VERSION_1_4) != JNI_OK) { 32 return JNI_ERR; 33 } 34 35 extern int register_InstanceNonce(JNIEnv *); 36 if (register_InstanceNonce(env)) { 37 __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "failed to register InstanceNonce"); 38 return JNI_ERR; 39 } 40 41 extern int register_StaticNonce(JNIEnv *); 42 if (register_StaticNonce(env)) { 43 __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "failed to register StaticNonce"); 44 return JNI_ERR; 45 } 46 47 extern int register_JniCTest(JNIEnv *); 48 if (register_JniCTest(env)) { 49 __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "failed to register JniCTest"); 50 return JNI_ERR; 51 } 52 53 extern int register_JniCppTest(JNIEnv *); 54 if (register_JniCppTest(env)) { 55 __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "failed to register JniCppTest"); 56 return JNI_ERR; 57 } 58 59 return JNI_VERSION_1_4; 60 } 61