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_ConsumerIrService(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_SerialService(JNIEnv* env);
     31 int register_android_server_UsbDeviceManager(JNIEnv* env);
     32 int register_android_server_UsbHostManager(JNIEnv* env);
     33 int register_android_server_VibratorService(JNIEnv* env);
     34 int register_android_server_SystemServer(JNIEnv* env);
     35 int register_android_server_location_GpsLocationProvider(JNIEnv* env);
     36 int register_android_server_location_FlpHardwareProvider(JNIEnv* env);
     37 int register_android_server_connectivity_Vpn(JNIEnv* env);
     38 int register_android_server_AssetAtlasService(JNIEnv* env);
     39 };
     40 
     41 using namespace android;
     42 
     43 extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
     44 {
     45     JNIEnv* env = NULL;
     46     jint result = -1;
     47 
     48     if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
     49         ALOGE("GetEnv failed!");
     50         return result;
     51     }
     52     ALOG_ASSERT(env, "Could not retrieve the env!");
     53 
     54     register_android_server_PowerManagerService(env);
     55     register_android_server_SerialService(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_UsbDeviceManager(env);
     62     register_android_server_UsbHostManager(env);
     63     register_android_server_VibratorService(env);
     64     register_android_server_SystemServer(env);
     65     register_android_server_location_GpsLocationProvider(env);
     66     register_android_server_location_FlpHardwareProvider(env);
     67     register_android_server_connectivity_Vpn(env);
     68     register_android_server_AssetAtlasService(env);
     69     register_android_server_ConsumerIrService(env);
     70 
     71 
     72     return JNI_VERSION_1_4;
     73 }
     74