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 <nativehelper/JNIHelp.h>
18 #include "jni.h"
19 #include "utils/Log.h"
20 #include "utils/misc.h"
21 
22 #include "BroadcastRadio/BroadcastRadioService.h"
23 #include "BroadcastRadio/Tuner.h"
24 
25 namespace android {
26 int register_android_server_AlarmManagerService(JNIEnv* env);
27 int register_android_server_BatteryStatsService(JNIEnv* env);
28 int register_android_server_ConsumerIrService(JNIEnv *env);
29 int register_android_server_InputApplicationHandle(JNIEnv* env);
30 int register_android_server_InputWindowHandle(JNIEnv* env);
31 int register_android_server_InputManager(JNIEnv* env);
32 int register_android_server_LightsService(JNIEnv* env);
33 int register_android_server_PowerManagerService(JNIEnv* env);
34 int register_android_server_storage_AppFuse(JNIEnv* env);
35 int register_android_server_SerialService(JNIEnv* env);
36 int register_android_server_SystemServer(JNIEnv* env);
37 int register_android_server_UsbAlsaJackDetector(JNIEnv* env);
38 int register_android_server_UsbDeviceManager(JNIEnv* env);
39 int register_android_server_UsbMidiDevice(JNIEnv* env);
40 int register_android_server_UsbHostManager(JNIEnv* env);
41 int register_android_server_vr_VrManagerService(JNIEnv* env);
42 int register_android_server_VibratorService(JNIEnv* env);
43 int register_android_server_location_GnssLocationProvider(JNIEnv* env);
44 int register_android_server_connectivity_Vpn(JNIEnv* env);
45 int register_android_server_connectivity_tethering_OffloadHardwareInterface(JNIEnv*);
46 int register_android_server_devicepolicy_CryptoTestHelper(JNIEnv*);
47 int register_android_server_hdmi_HdmiCecController(JNIEnv* env);
48 int register_android_server_tv_TvUinputBridge(JNIEnv* env);
49 int register_android_server_tv_TvInputHal(JNIEnv* env);
50 int register_android_server_PersistentDataBlockService(JNIEnv* env);
51 int register_android_server_Watchdog(JNIEnv* env);
52 int register_android_server_HardwarePropertiesManagerService(JNIEnv* env);
53 int register_android_server_SyntheticPasswordManager(JNIEnv* env);
54 int register_android_server_GraphicsStatsService(JNIEnv* env);
55 int register_android_hardware_display_DisplayViewport(JNIEnv* env);
56 int register_android_server_net_NetworkStatsService(JNIEnv* env);
57 #ifdef USE_ARC
58 int register_android_server_ArcVideoService();
59 #endif
60 };
61 
62 using namespace android;
63 
JNI_OnLoad(JavaVM * vm,void *)64 extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */)
65 {
66     JNIEnv* env = NULL;
67     jint result = -1;
68 
69     if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
70         ALOGE("GetEnv failed!");
71         return result;
72     }
73     ALOG_ASSERT(env, "Could not retrieve the env!");
74 
75     register_android_server_broadcastradio_BroadcastRadioService(env);
76     register_android_server_broadcastradio_Tuner(vm, env);
77     register_android_server_PowerManagerService(env);
78     register_android_server_SerialService(env);
79     register_android_server_InputApplicationHandle(env);
80     register_android_server_InputWindowHandle(env);
81     register_android_server_InputManager(env);
82     register_android_server_LightsService(env);
83     register_android_server_AlarmManagerService(env);
84     register_android_server_UsbDeviceManager(env);
85     register_android_server_UsbMidiDevice(env);
86     register_android_server_UsbAlsaJackDetector(env);
87     register_android_server_UsbHostManager(env);
88     register_android_server_vr_VrManagerService(env);
89     register_android_server_VibratorService(env);
90     register_android_server_SystemServer(env);
91     register_android_server_location_GnssLocationProvider(env);
92     register_android_server_connectivity_Vpn(env);
93     register_android_server_connectivity_tethering_OffloadHardwareInterface(env);
94     register_android_server_devicepolicy_CryptoTestHelper(env);
95     register_android_server_ConsumerIrService(env);
96     register_android_server_BatteryStatsService(env);
97     register_android_server_hdmi_HdmiCecController(env);
98     register_android_server_tv_TvUinputBridge(env);
99     register_android_server_tv_TvInputHal(env);
100     register_android_server_PersistentDataBlockService(env);
101     register_android_server_HardwarePropertiesManagerService(env);
102     register_android_server_storage_AppFuse(env);
103     register_android_server_SyntheticPasswordManager(env);
104     register_android_server_GraphicsStatsService(env);
105     register_android_hardware_display_DisplayViewport(env);
106     register_android_server_net_NetworkStatsService(env);
107 #ifdef USE_ARC
108     register_android_server_ArcVideoService();
109 #endif
110     return JNI_VERSION_1_4;
111 }
112