1 /*
2  * Copyright (C) 2010 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 <jni.h>
18 #include <stdio.h>
19 
20 extern int register_android_os_cts_CpuFeatures(JNIEnv*);
21 
22 extern int register_android_os_cts_CpuInstructions(JNIEnv*);
23 
24 extern int register_android_os_cts_TaggedPointer(JNIEnv*);
25 
26 extern int register_android_os_cts_HardwareName(JNIEnv*);
27 
28 extern int register_android_os_cts_OSFeatures(JNIEnv*);
29 
30 extern int register_android_os_cts_NoExecutePermissionTest(JNIEnv*);
31 
32 extern int register_android_os_cts_SeccompTest(JNIEnv*);
33 
JNI_OnLoad(JavaVM * vm,void * reserved)34 jint JNI_OnLoad(JavaVM *vm, void *reserved) {
35     JNIEnv *env = NULL;
36 
37     if (vm->GetEnv((void **) &env, JNI_VERSION_1_4) != JNI_OK) {
38         return JNI_ERR;
39     }
40 
41     if (register_android_os_cts_CpuFeatures(env)) {
42         return JNI_ERR;
43     }
44 
45     if (register_android_os_cts_CpuInstructions(env)) {
46         return JNI_ERR;
47     }
48 
49     if (register_android_os_cts_TaggedPointer(env)) {
50         return JNI_ERR;
51     }
52 
53     if (register_android_os_cts_HardwareName(env)) {
54         return JNI_ERR;
55     }
56 
57     if (register_android_os_cts_OSFeatures(env)) {
58         return JNI_ERR;
59     }
60 
61     if (register_android_os_cts_NoExecutePermissionTest(env)) {
62         return JNI_ERR;
63     }
64 
65     if (register_android_os_cts_SeccompTest(env)) {
66         return JNI_ERR;
67     }
68 
69     return JNI_VERSION_1_4;
70 }
71