OSDN Git Service

Merge commit 'e0df2c4f' into fix-merge-conflict
[android-x86/frameworks-base.git] / services / jni / onload.cpp
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_BatteryService(JNIEnv* env);
25 int register_android_server_display_SurfaceFlingerDisplayAdapter(JNIEnv* env);
26 int register_android_server_InputApplicationHandle(JNIEnv* env);
27 int register_android_server_InputWindowHandle(JNIEnv* env);
28 int register_android_server_InputManager(JNIEnv* env);
29 int register_android_server_LightsService(JNIEnv* env);
30 int register_android_server_PowerManagerService(JNIEnv* env);
31 int register_android_server_SerialService(JNIEnv* env);
32 int register_android_server_UsbDeviceManager(JNIEnv* env);
33 int register_android_server_UsbHostManager(JNIEnv* env);
34 int register_android_server_VibratorService(JNIEnv* env);
35 int register_android_server_SystemServer(JNIEnv* env);
36 int register_android_server_location_GpsLocationProvider(JNIEnv* env);
37 int register_android_server_connectivity_Vpn(JNIEnv* env);
38 };
39
40 using namespace android;
41
42 extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
43 {
44     JNIEnv* env = NULL;
45     jint result = -1;
46
47     if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
48         ALOGE("GetEnv failed!");
49         return result;
50     }
51     ALOG_ASSERT(env, "Could not retrieve the env!");
52
53     register_android_server_PowerManagerService(env);
54     register_android_server_SerialService(env);
55     register_android_server_display_SurfaceFlingerDisplayAdapter(env);
56     register_android_server_InputApplicationHandle(env);
57     register_android_server_InputWindowHandle(env);
58     register_android_server_InputManager(env);
59     register_android_server_LightsService(env);
60     register_android_server_AlarmManagerService(env);
61     register_android_server_BatteryService(env);
62     register_android_server_UsbDeviceManager(env);
63     register_android_server_UsbHostManager(env);
64     register_android_server_VibratorService(env);
65     register_android_server_SystemServer(env);
66     register_android_server_location_GpsLocationProvider(env);
67     register_android_server_connectivity_Vpn(env);
68
69     return JNI_VERSION_1_4;
70 }