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#define LOG_TAG "VibratorService"
18
19#include "jni.h"
20#include "JNIHelp.h"
21#include "android_runtime/AndroidRuntime.h"
22
23#include <utils/misc.h>
24#include <utils/Log.h>
25#include <hardware_legacy/vibrator.h>
26
27#include <stdio.h>
28
29namespace android
30{
31
32static void vibratorOn(JNIEnv *env, jobject clazz, jlong timeout_ms)
33{
34    // LOGI("vibratorOn\n");
35    vibrator_on(timeout_ms);
36}
37
38static void vibratorOff(JNIEnv *env, jobject clazz)
39{
40    // LOGI("vibratorOff\n");
41    vibrator_off();
42}
43
44static JNINativeMethod method_table[] = {
45    { "vibratorOn", "(J)V", (void*)vibratorOn },
46    { "vibratorOff", "()V", (void*)vibratorOff }
47};
48
49int register_android_server_VibratorService(JNIEnv *env)
50{
51    return jniRegisterNativeMethods(env, "com/android/server/VibratorService",
52            method_table, NELEM(method_table));
53}
54
55};
56