diff options
| author | Mike Lockwood <lockwood@android.com> | 2009-11-24 00:30:52 -0500 |
|---|---|---|
| committer | Mike Lockwood <lockwood@android.com> | 2009-11-25 12:54:58 -0500 |
| commit | 3a32213c4029a03fe39486f3d6ebd0ea18928ee1 (patch) | |
| tree | 261ab976911438a818b190771e49cd649d72de2f /services/jni | |
| parent | f90b1261a53bc0bfc772337551eb4c540022cd22 (diff) | |
| download | frameworks_base-3a32213c4029a03fe39486f3d6ebd0ea18928ee1.zip frameworks_base-3a32213c4029a03fe39486f3d6ebd0ea18928ee1.tar.gz frameworks_base-3a32213c4029a03fe39486f3d6ebd0ea18928ee1.tar.bz2 | |
Remove HardwareService and move vibrator support to VibratorService.
The lights support is only needed by PowerManagerService and NotificationManagerService, so we do not need a Binder API for it.
Move backlight and notification light support to new LightsService class.
The camera flash is now handled directly by the camera HAL, so the flash Hardware service flash support is obsolete.
Change-Id: I086d681f54668e7f7de3e8b90df3de19d59833c5
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'services/jni')
| -rw-r--r-- | services/jni/Android.mk | 3 | ||||
| -rw-r--r-- | services/jni/com_android_server_LightsService.cpp (renamed from services/jni/com_android_server_HardwareService.cpp) | 57 | ||||
| -rw-r--r-- | services/jni/com_android_server_VibratorService.cpp | 55 | ||||
| -rw-r--r-- | services/jni/onload.cpp | 6 |
4 files changed, 81 insertions, 40 deletions
diff --git a/services/jni/Android.mk b/services/jni/Android.mk index 2f48edf..9d2760e 100644 --- a/services/jni/Android.mk +++ b/services/jni/Android.mk @@ -4,10 +4,11 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ com_android_server_AlarmManagerService.cpp \ com_android_server_BatteryService.cpp \ - com_android_server_HardwareService.cpp \ com_android_server_KeyInputQueue.cpp \ + com_android_server_LightsService.cpp \ com_android_server_SensorService.cpp \ com_android_server_SystemServer.cpp \ + com_android_server_VibratorService.cpp \ onload.cpp LOCAL_C_INCLUDES += \ diff --git a/services/jni/com_android_server_HardwareService.cpp b/services/jni/com_android_server_LightsService.cpp index 253e655..1df9c81 100644 --- a/services/jni/com_android_server_HardwareService.cpp +++ b/services/jni/com_android_server_LightsService.cpp @@ -1,21 +1,20 @@ -/* //device/libs/android_runtime/android_os_Vibrator.cpp -** -** Copyright 2006, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -#define LOG_TAG "HardwareService" +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "LightsService" #include "jni.h" #include "JNIHelp.h" @@ -23,18 +22,16 @@ #include <utils/misc.h> #include <utils/Log.h> -#include <hardware_legacy/vibrator.h> #include <hardware/hardware.h> #include <hardware/lights.h> #include <stdio.h> -//#include <string.h> namespace android { // These values must correspond with the LIGHT_ID constants in -// HardwareService.java +// LightsService.java enum { LIGHT_INDEX_BACKLIGHT = 0, LIGHT_INDEX_KEYBOARD = 1, @@ -120,29 +117,15 @@ static void setLight_native(JNIEnv *env, jobject clazz, int ptr, devices->lights[light]->set_light(devices->lights[light], &state); } -static void vibratorOn(JNIEnv *env, jobject clazz, jlong timeout_ms) -{ - // LOGI("vibratorOn\n"); - vibrator_on(timeout_ms); -} - -static void vibratorOff(JNIEnv *env, jobject clazz) -{ - // LOGI("vibratorOff\n"); - vibrator_off(); -} - static JNINativeMethod method_table[] = { { "init_native", "()I", (void*)init_native }, { "finalize_native", "(I)V", (void*)finalize_native }, { "setLight_native", "(IIIIIII)V", (void*)setLight_native }, - { "vibratorOn", "(J)V", (void*)vibratorOn }, - { "vibratorOff", "()V", (void*)vibratorOff } }; -int register_android_server_HardwareService(JNIEnv *env) +int register_android_server_LightsService(JNIEnv *env) { - return jniRegisterNativeMethods(env, "com/android/server/HardwareService", + return jniRegisterNativeMethods(env, "com/android/server/LightsService", method_table, NELEM(method_table)); } diff --git a/services/jni/com_android_server_VibratorService.cpp b/services/jni/com_android_server_VibratorService.cpp new file mode 100644 index 0000000..6ec5c07 --- /dev/null +++ b/services/jni/com_android_server_VibratorService.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "VibratorService" + +#include "jni.h" +#include "JNIHelp.h" +#include "android_runtime/AndroidRuntime.h" + +#include <utils/misc.h> +#include <utils/Log.h> +#include <hardware_legacy/vibrator.h> + +#include <stdio.h> + +namespace android +{ + +static void vibratorOn(JNIEnv *env, jobject clazz, jlong timeout_ms) +{ + // LOGI("vibratorOn\n"); + vibrator_on(timeout_ms); +} + +static void vibratorOff(JNIEnv *env, jobject clazz) +{ + // LOGI("vibratorOff\n"); + vibrator_off(); +} + +static JNINativeMethod method_table[] = { + { "vibratorOn", "(J)V", (void*)vibratorOn }, + { "vibratorOff", "()V", (void*)vibratorOff } +}; + +int register_android_server_VibratorService(JNIEnv *env) +{ + return jniRegisterNativeMethods(env, "com/android/server/VibratorService", + method_table, NELEM(method_table)); +} + +}; diff --git a/services/jni/onload.cpp b/services/jni/onload.cpp index 26200d3..c16fdb8 100644 --- a/services/jni/onload.cpp +++ b/services/jni/onload.cpp @@ -7,8 +7,9 @@ namespace android { int register_android_server_AlarmManagerService(JNIEnv* env); int register_android_server_BatteryService(JNIEnv* env); int register_android_server_KeyInputQueue(JNIEnv* env); -int register_android_server_HardwareService(JNIEnv* env); +int register_android_server_LightsService(JNIEnv* env); int register_android_server_SensorService(JNIEnv* env); +int register_android_server_VibratorService(JNIEnv* env); int register_android_server_SystemServer(JNIEnv* env); }; @@ -26,10 +27,11 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) LOG_ASSERT(env, "Could not retrieve the env!"); register_android_server_KeyInputQueue(env); - register_android_server_HardwareService(env); + register_android_server_LightsService(env); register_android_server_AlarmManagerService(env); register_android_server_BatteryService(env); register_android_server_SensorService(env); + register_android_server_VibratorService(env); register_android_server_SystemServer(env); return JNI_VERSION_1_4; |
