• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2020, 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 package android.os;
18 
19 import android.os.CombinedVibration;
20 import android.os.ICancellationSignal;
21 import android.os.IVibratorStateListener;
22 import android.os.VibrationAttributes;
23 import android.os.VibratorInfo;
24 import android.os.vibrator.IVibrationSession;
25 import android.os.vibrator.IVibrationSessionCallback;
26 
27 /** {@hide} */
28 interface IVibratorManagerService {
getVibratorIds()29     int[] getVibratorIds();
getCapabilities()30     int getCapabilities();
getVibratorInfo(int vibratorId)31     VibratorInfo getVibratorInfo(int vibratorId);
32     @EnforcePermission("ACCESS_VIBRATOR_STATE")
isVibrating(int vibratorId)33     boolean isVibrating(int vibratorId);
34     @EnforcePermission("ACCESS_VIBRATOR_STATE")
registerVibratorStateListener(int vibratorId, in IVibratorStateListener listener)35     boolean registerVibratorStateListener(int vibratorId, in IVibratorStateListener listener);
36     @EnforcePermission("ACCESS_VIBRATOR_STATE")
unregisterVibratorStateListener(int vibratorId, in IVibratorStateListener listener)37     boolean unregisterVibratorStateListener(int vibratorId, in IVibratorStateListener listener);
setAlwaysOnEffect(int uid, String opPkg, int alwaysOnId, in CombinedVibration vibration, in VibrationAttributes attributes)38     boolean setAlwaysOnEffect(int uid, String opPkg, int alwaysOnId,
39             in CombinedVibration vibration, in VibrationAttributes attributes);
vibrate(int uid, int deviceId, String opPkg, in CombinedVibration vibration, in VibrationAttributes attributes, String reason, IBinder token)40     void vibrate(int uid, int deviceId, String opPkg, in CombinedVibration vibration,
41             in VibrationAttributes attributes, String reason, IBinder token);
cancelVibrate(int usageFilter, IBinder token)42     void cancelVibrate(int usageFilter, IBinder token);
43 
44     // Async oneway APIs.
45     // There is no order guarantee with respect to the two-way APIs above like
46     // vibrate/isVibrating/cancel.
performHapticFeedback(int uid, int deviceId, String opPkg, int constant, String reason, int flags, int privFlags)47     oneway void performHapticFeedback(int uid, int deviceId, String opPkg, int constant,
48             String reason, int flags, int privFlags);
49 
50     // Similar to performHapticFeedback but the effect is customized to the input device. The
51     // customization for each constant is defined on a device basis, and the behavior will be the
52     // same as performHapticFeedback when no customization is provided for a given constant and
53     // device.
performHapticFeedbackForInputDevice(int uid, int deviceId, String opPkg, int constant, int inputDeviceId, int inputSource, String reason, int flags, int privFlags)54     oneway void performHapticFeedbackForInputDevice(int uid, int deviceId, String opPkg,
55             int constant, int inputDeviceId, int inputSource, String reason, int flags,
56             int privFlags);
57 
58     @EnforcePermission(allOf={"VIBRATE", "VIBRATE_VENDOR_EFFECTS", "START_VIBRATION_SESSIONS"})
startVendorVibrationSession(int uid, int deviceId, String opPkg, in int[] vibratorIds, in VibrationAttributes attributes, String reason, in IVibrationSessionCallback callback)59     ICancellationSignal startVendorVibrationSession(int uid, int deviceId, String opPkg,
60             in int[] vibratorIds, in VibrationAttributes attributes, String reason,
61             in IVibrationSessionCallback callback);
62 }
63