com_android_frameworks_coretests_JNITest.cpp revision e64e0971475409533aec201e4f3d23b31f653217
1/*
2 * Copyright (C) 2012 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 "nativehelper/JNIHelp.h"
18
19namespace android {
20
21static jint checkFunction(JNIEnv*, jclass) {
22    return 1;
23}
24
25static JNINativeMethod sMethods[] = {
26    /* name, signature, funcPtr */
27    { "checkFunction", "()I", (void*) checkFunction },
28};
29
30int register_com_android_framework_coretests_JNITests(JNIEnv* env) {
31    return jniRegisterNativeMethods(env, "com/android/framework/coretests/JNITests", sMethods,
32            NELEM(sMethods));
33}
34
35}
36
37/*
38 * JNI Initialization
39 */
40jint JNI_OnLoad(JavaVM *jvm, void *reserved) {
41    JNIEnv *e;
42    int status;
43
44    // Check JNI version
45    if (jvm->GetEnv((void **) &e, JNI_VERSION_1_6)) {
46        return JNI_ERR;
47    }
48
49    if ((status = android::register_com_android_framework_coretests_JNITests(e)) < 0) {
50        return JNI_ERR;
51    }
52
53    return JNI_VERSION_1_6;
54}
55