Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/VibrationProvider.java

Issue 141533006: [Android] Move the java content/ package to content_public/ to start the split. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small fixes and findbugs line update Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 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.media.AudioManager;
9 import android.os.Vibrator;
10
11 import org.chromium.base.CalledByNative;
12 import org.chromium.base.JNINamespace;
13
14 /**
15 * This is the implementation of the C++ counterpart VibrationProvider.
16 */
17 @JNINamespace("content")
18 class VibrationProvider {
19
20 private final AudioManager mAudioManager;
21 private final Vibrator mVibrator;
22
23 @CalledByNative
24 private static VibrationProvider create(Context context) {
25 return new VibrationProvider(context);
26 }
27
28 @CalledByNative
29 private void vibrate(long milliseconds) {
30 if (mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_SILENT)
31 mVibrator.vibrate(milliseconds);
32 }
33
34 @CalledByNative
35 private void cancelVibration() {
36 mVibrator.cancel();
37 }
38
39 private VibrationProvider(Context context) {
40 mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SE RVICE);
41 mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE );
42 }
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698