1e64e0971475409533aec201e4f3d23b31f653217Kenny Root/*
2e64e0971475409533aec201e4f3d23b31f653217Kenny Root * Copyright (C) 2012 The Android Open Source Project
3e64e0971475409533aec201e4f3d23b31f653217Kenny Root *
4e64e0971475409533aec201e4f3d23b31f653217Kenny Root * Licensed under the Apache License, Version 2.0 (the "License");
5e64e0971475409533aec201e4f3d23b31f653217Kenny Root * you may not use this file except in compliance with the License.
6e64e0971475409533aec201e4f3d23b31f653217Kenny Root * You may obtain a copy of the License at
7e64e0971475409533aec201e4f3d23b31f653217Kenny Root *
8e64e0971475409533aec201e4f3d23b31f653217Kenny Root *      http://www.apache.org/licenses/LICENSE-2.0
9e64e0971475409533aec201e4f3d23b31f653217Kenny Root *
10e64e0971475409533aec201e4f3d23b31f653217Kenny Root * Unless required by applicable law or agreed to in writing, software
11e64e0971475409533aec201e4f3d23b31f653217Kenny Root * distributed under the License is distributed on an "AS IS" BASIS,
12e64e0971475409533aec201e4f3d23b31f653217Kenny Root * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e64e0971475409533aec201e4f3d23b31f653217Kenny Root * See the License for the specific language governing permissions and
14e64e0971475409533aec201e4f3d23b31f653217Kenny Root * limitations under the License.
15e64e0971475409533aec201e4f3d23b31f653217Kenny Root */
16e64e0971475409533aec201e4f3d23b31f653217Kenny Root
17e64e0971475409533aec201e4f3d23b31f653217Kenny Root#include "nativehelper/JNIHelp.h"
18e64e0971475409533aec201e4f3d23b31f653217Kenny Root
19e64e0971475409533aec201e4f3d23b31f653217Kenny Rootnamespace android {
20e64e0971475409533aec201e4f3d23b31f653217Kenny Root
21e64e0971475409533aec201e4f3d23b31f653217Kenny Rootstatic jint checkFunction(JNIEnv*, jclass) {
22e64e0971475409533aec201e4f3d23b31f653217Kenny Root    return 1;
23e64e0971475409533aec201e4f3d23b31f653217Kenny Root}
24e64e0971475409533aec201e4f3d23b31f653217Kenny Root
2576f6a86de25e1bf74717e047e55fd44b089673f3Daniel Micaystatic const JNINativeMethod sMethods[] = {
26e64e0971475409533aec201e4f3d23b31f653217Kenny Root    /* name, signature, funcPtr */
27e64e0971475409533aec201e4f3d23b31f653217Kenny Root    { "checkFunction", "()I", (void*) checkFunction },
28e64e0971475409533aec201e4f3d23b31f653217Kenny Root};
29e64e0971475409533aec201e4f3d23b31f653217Kenny Root
30dec4688f40b0018fbd1f00db05581966f531d88fDmitriy Ivanovint register_com_android_frameworks_coretests_JNITests(JNIEnv* env) {
31dec4688f40b0018fbd1f00db05581966f531d88fDmitriy Ivanov    return jniRegisterNativeMethods(env, "com/android/frameworks/coretests/JNITests", sMethods,
32e64e0971475409533aec201e4f3d23b31f653217Kenny Root            NELEM(sMethods));
33e64e0971475409533aec201e4f3d23b31f653217Kenny Root}
34e64e0971475409533aec201e4f3d23b31f653217Kenny Root
35e64e0971475409533aec201e4f3d23b31f653217Kenny Root}
36e64e0971475409533aec201e4f3d23b31f653217Kenny Root
37e64e0971475409533aec201e4f3d23b31f653217Kenny Root/*
38e64e0971475409533aec201e4f3d23b31f653217Kenny Root * JNI Initialization
39e64e0971475409533aec201e4f3d23b31f653217Kenny Root */
401c8cbb54407b9c1d56626de80a796a395012a92cAurimas Liutikasjint JNI_OnLoad(JavaVM *jvm, void */* reserved */) {
41e64e0971475409533aec201e4f3d23b31f653217Kenny Root    JNIEnv *e;
42e64e0971475409533aec201e4f3d23b31f653217Kenny Root    int status;
43e64e0971475409533aec201e4f3d23b31f653217Kenny Root
44e64e0971475409533aec201e4f3d23b31f653217Kenny Root    // Check JNI version
45e64e0971475409533aec201e4f3d23b31f653217Kenny Root    if (jvm->GetEnv((void **) &e, JNI_VERSION_1_6)) {
46e64e0971475409533aec201e4f3d23b31f653217Kenny Root        return JNI_ERR;
47e64e0971475409533aec201e4f3d23b31f653217Kenny Root    }
48e64e0971475409533aec201e4f3d23b31f653217Kenny Root
49dec4688f40b0018fbd1f00db05581966f531d88fDmitriy Ivanov    if ((status = android::register_com_android_frameworks_coretests_JNITests(e)) < 0) {
50e64e0971475409533aec201e4f3d23b31f653217Kenny Root        return JNI_ERR;
51e64e0971475409533aec201e4f3d23b31f653217Kenny Root    }
52e64e0971475409533aec201e4f3d23b31f653217Kenny Root
53e64e0971475409533aec201e4f3d23b31f653217Kenny Root    return JNI_VERSION_1_6;
54e64e0971475409533aec201e4f3d23b31f653217Kenny Root}
55