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 "JNIHelp.h"
18 #include "jni.h"
19 #include "utils/Log.h"
20 #include "utils/misc.h"
21 
22 namespace android {
23 int register_android_server_AlarmManagerService(JNIEnv* env);
24 int register_android_server_AssetAtlasService(JNIEnv* env);
25 int register_android_server_BatteryStatsService(JNIEnv* env);
26 int register_android_server_ConsumerIrService(JNIEnv *env);
27 int register_android_server_InputApplicationHandle(JNIEnv* env);
28 int register_android_server_InputWindowHandle(JNIEnv* env);
29 int register_android_server_InputManager(JNIEnv* env);
30 int register_android_server_LightsService(JNIEnv* env);
31 int register_android_server_PowerManagerService(JNIEnv* env);
32 int register_android_server_SerialService(JNIEnv* env);
33 int register_android_server_SystemServer(JNIEnv* env);
34 int register_android_server_UsbDeviceManager(JNIEnv* env);
35 int register_android_server_UsbHostManager(JNIEnv* env);
36 int register_android_server_VibratorService(JNIEnv* env);
37 int register_android_server_location_GpsLocationProvider(JNIEnv* env);
38 int register_android_server_location_FlpHardwareProvider(JNIEnv* env);
39 int register_android_server_connectivity_Vpn(JNIEnv* env);
40 int register_android_server_hdmi_HdmiCecController(JNIEnv* env);
41 int register_android_server_tv_TvInputHal(JNIEnv* env);
42 int register_android_server_PersistentDataBlockService(JNIEnv* env);
43 int register_android_server_fingerprint_FingerprintService(JNIEnv* env);
44 int register_android_server_Watchdog(JNIEnv* env);
45 };
46 
47 using namespace android;
48 
JNI_OnLoad(JavaVM * vm,void * reserved)49 extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
50 {
51     JNIEnv* env = NULL;
52     jint result = -1;
53 
54     if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
55         ALOGE("GetEnv failed!");
56         return result;
57     }
58     ALOG_ASSERT(env, "Could not retrieve the env!");
59 
60     register_android_server_PowerManagerService(env);
61     register_android_server_SerialService(env);
62     register_android_server_InputApplicationHandle(env);
63     register_android_server_InputWindowHandle(env);
64     register_android_server_InputManager(env);
65     register_android_server_LightsService(env);
66     register_android_server_AlarmManagerService(env);
67     register_android_server_UsbDeviceManager(env);
68     register_android_server_UsbHostManager(env);
69     register_android_server_VibratorService(env);
70     register_android_server_SystemServer(env);
71     register_android_server_location_GpsLocationProvider(env);
72     register_android_server_location_FlpHardwareProvider(env);
73     register_android_server_connectivity_Vpn(env);
74     register_android_server_AssetAtlasService(env);
75     register_android_server_ConsumerIrService(env);
76     register_android_server_BatteryStatsService(env);
77     register_android_server_hdmi_HdmiCecController(env);
78     register_android_server_tv_TvInputHal(env);
79     register_android_server_PersistentDataBlockService(env);
80     register_android_server_fingerprint_FingerprintService(env);
81     register_android_server_Watchdog(env);
82 
83     return JNI_VERSION_1_4;
84 }
85