OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package org.chromium.content.browser; | |
6 | |
7 import android.content.Context; | |
8 import android.os.Vibrator; | |
9 | |
10 import org.chromium.base.CalledByNative; | |
11 import org.chromium.base.JNINamespace; | |
12 | |
13 /** | |
14 * This is the implementation of the C++ counterpart VibrationService. | |
15 */ | |
16 @JNINamespace("content") | |
17 class VibrationService { | |
18 | |
19 private final Vibrator mVibrator; | |
20 | |
21 @CalledByNative | |
22 private static VibrationService create(Context context) { | |
23 return new VibrationService(context); | |
24 } | |
25 | |
26 @CalledByNative | |
27 private void vibrate(long milliseconds) { | |
palmer
2013/06/21 18:17:40
The IPC sends unsigned int, but Java long is defin
Michael van Ouwerkerk
2013/06/24 13:46:57
So, I chose an int :-)
On 2013/06/21 18:17:40, Ch
| |
28 mVibrator.vibrate(milliseconds); | |
29 } | |
30 | |
31 @CalledByNative | |
32 private void cancelVibration() { | |
33 mVibrator.cancel(); | |
34 } | |
35 | |
36 private VibrationService(Context context) { | |
37 mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE ); | |
38 } | |
39 } | |
OLD | NEW |