Home | History | Annotate | Download | only in jni
      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_InputApplicationHandle(JNIEnv* env);
     26 int register_android_server_InputWindowHandle(JNIEnv* env);
     27 int register_android_server_InputManager(JNIEnv* env);
     28 int register_android_server_LightsService(JNIEnv* env);
     29 int register_android_server_PowerManagerService(JNIEnv* env);
     30 int register_android_server_UsbDeviceManager(JNIEnv* env);
     31 int register_android_server_UsbHostManager(JNIEnv* env);
     32 int register_android_server_VibratorService(JNIEnv* env);
     33 int register_android_server_SystemServer(JNIEnv* env);
     34 int register_android_server_location_GpsLocationProvider(JNIEnv* env);
     35 int register_android_server_connectivity_Vpn(JNIEnv* env);
     36 };
     37 
     38 using namespace android;
     39 
     40 extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
     41 {
     42     JNIEnv* env = NULL;
     43     jint result = -1;
     44 
     45     if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
     46         LOGE("GetEnv failed!");
     47         return result;
     48     }
     49     LOG_ASSERT(env, "Could not retrieve the env!");
     50 
     51     register_android_server_PowerManagerService(env);
     52     register_android_server_InputApplicationHandle(env);
     53     register_android_server_InputWindowHandle(env);
     54     register_android_server_InputManager(env);
     55     register_android_server_LightsService(env);
     56     register_android_server_AlarmManagerService(env);
     57     register_android_server_BatteryService(env);
     58     register_android_server_UsbDeviceManager(env);
     59     register_android_server_UsbHostManager(env);
     60     register_android_server_VibratorService(env);
     61     register_android_server_SystemServer(env);
     62     register_android_server_location_GpsLocationProvider(env);
     63     register_android_server_connectivity_Vpn(env);
     64 
     65     return JNI_VERSION_1_4;
     66 }
     67