| 1 |
/** |
| 2 |
* Copyright (c) 2018, 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.ExternalVibration; |
| 20 |
|
| 21 |
/** |
| 22 |
* The communication channel by which an external system that wants to control the system |
| 23 |
* vibrator can notify the vibrator subsystem. |
| 24 |
* |
| 25 |
* Some vibrators can be driven via multiple paths (e.g. as an audio channel) in addition to |
| 26 |
* the usual interface, but we typically only want one vibration at a time playing because they |
| 27 |
* don't mix well. In order to synchronize the two places where vibration might be controlled, |
| 28 |
* we provide this interface so the vibrator subsystem has a chance to: |
| 29 |
* |
| 30 |
* 1) Decide whether the current vibration should play based on the current system policy. |
| 31 |
* 2) Stop any currently on-going vibrations. |
| 32 |
* {@hide} |
| 33 |
*/ |
| 34 |
interface IExternalVibratorService { |
| 35 |
const int SCALE_MUTE = -100; |
| 36 |
const int SCALE_VERY_LOW = -2; |
| 37 |
const int SCALE_LOW = -1; |
| 38 |
const int SCALE_NONE = 0; |
| 39 |
const int SCALE_HIGH = 1; |
| 40 |
const int SCALE_VERY_HIGH = 2; |
| 41 |
|
| 42 |
/** |
| 43 |
* A method called by the external system to start a vibration. |
| 44 |
* |
| 45 |
* If this returns {@code SCALE_MUTE}, then the vibration should <em>not</em> play. If this |
| 46 |
* returns any other scale level, then any currently playing vibration controlled by the |
| 47 |
* requesting system must be muted and this vibration can begin playback. |
| 48 |
* |
| 49 |
* Note that the IExternalVibratorService implementation will not call mute on any currently |
| 50 |
* playing external vibrations in order to avoid re-entrancy with the system on the other side. |
| 51 |
* |
| 52 |
* @param vibration An ExternalVibration |
| 53 |
* |
| 54 |
* @return {@code SCALE_MUTE} if the external vibration should not play, and any other scale |
| 55 |
* level if it should. |
| 56 |
*/ |
| 57 |
int onExternalVibrationStart(in ExternalVibration vib); |
| 58 |
|
| 59 |
/** |
| 60 |
* A method called by the external system when a vibration no longer wants to play. |
| 61 |
*/ |
| 62 |
void onExternalVibrationStop(in ExternalVibration vib); |
| 63 |
} |