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_ActivityManagerService(JNIEnv* env);
24 int register_android_server_AlarmManagerService(JNIEnv* env);
25 int register_android_server_AssetAtlasService(JNIEnv* env);
26 int register_android_server_BatteryStatsService(JNIEnv* env);
27 int register_android_server_ConsumerIrService(JNIEnv *env);
28 int register_android_server_InputApplicationHandle(JNIEnv* env);
29 int register_android_server_InputWindowHandle(JNIEnv* env);
30 int register_android_server_InputManager(JNIEnv* env);
31 int register_android_server_LightsService(JNIEnv* env);
32 int register_android_server_PowerManagerService(JNIEnv* env);
33 int register_android_server_SerialService(JNIEnv* env);
34 int register_android_server_SystemServer(JNIEnv* env);
35 int register_android_server_UsbDeviceManager(JNIEnv* env);
36 int register_android_server_UsbMidiDevice(JNIEnv* env);
37 int register_android_server_UsbHostManager(JNIEnv* env);
38 int register_android_server_vr_VrManagerService(JNIEnv* env);
39 int register_android_server_VibratorService(JNIEnv* env);
40 int register_android_server_location_GnssLocationProvider(JNIEnv* env);
41 int register_android_server_location_FlpHardwareProvider(JNIEnv* env);
42 int register_android_server_connectivity_Vpn(JNIEnv* env);
43 int register_android_server_hdmi_HdmiCecController(JNIEnv* env);
44 int register_android_server_tv_TvUinputBridge(JNIEnv* env);
45 int register_android_server_tv_TvInputHal(JNIEnv* env);
46 int register_android_server_PersistentDataBlockService(JNIEnv* env);
47 int register_android_server_Watchdog(JNIEnv* env);
48 int register_android_server_HardwarePropertiesManagerService(JNIEnv* env);
49 };
50 
51 using namespace android;
52 
JNI_OnLoad(JavaVM * vm,void *)53 extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */)
54 {
55     JNIEnv* env = NULL;
56     jint result = -1;
57 
58     if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
59         ALOGE("GetEnv failed!");
60         return result;
61     }
62     ALOG_ASSERT(env, "Could not retrieve the env!");
63 
64     register_android_server_ActivityManagerService(env);
65     register_android_server_PowerManagerService(env);
66     register_android_server_SerialService(env);
67     register_android_server_InputApplicationHandle(env);
68     register_android_server_InputWindowHandle(env);
69     register_android_server_InputManager(env);
70     register_android_server_LightsService(env);
71     register_android_server_AlarmManagerService(env);
72     register_android_server_UsbDeviceManager(env);
73     register_android_server_UsbMidiDevice(env);
74     register_android_server_UsbHostManager(env);
75     register_android_server_vr_VrManagerService(env);
76     register_android_server_VibratorService(env);
77     register_android_server_SystemServer(env);
78     register_android_server_location_GnssLocationProvider(env);
79     register_android_server_location_FlpHardwareProvider(env);
80     register_android_server_connectivity_Vpn(env);
81     register_android_server_AssetAtlasService(env);
82     register_android_server_ConsumerIrService(env);
83     register_android_server_BatteryStatsService(env);
84     register_android_server_hdmi_HdmiCecController(env);
85     register_android_server_tv_TvUinputBridge(env);
86     register_android_server_tv_TvInputHal(env);
87     register_android_server_PersistentDataBlockService(env);
88     register_android_server_Watchdog(env);
89     register_android_server_HardwarePropertiesManagerService(env);
90 
91 
92     return JNI_VERSION_1_4;
93 }
94