Scott Randolph | 46bc128 | 2017-07-27 18:26:27 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2017 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.hardware.automotive.audiocontrol@1.0; |
| 18 | |
| 19 | |
| 20 | /** |
| 21 | * Implemented on client (framework) side to receive asynchronous updates from the car. |
| 22 | */ |
| 23 | interface IAudioControlCallback { |
| 24 | |
| 25 | /** |
| 26 | * When the HAL makes this call, any apps currently playing must be asked to |
| 27 | * temporarily suspend playback (via an AudioManager::AUDIOFOCUS_LOSS_TRANSIENT event). |
| 28 | * |
| 29 | * This is only a suggestion. Apps may be slow to react or even ignore this message |
| 30 | * entirely. Enforcement, if necessary, must be done at the AudioHAL level as the |
| 31 | * samples are delivered. In most instances, this is the way a car should ask for |
| 32 | * quiet if it needs it for some important situation, such as warning alarms or chimes. |
| 33 | */ |
| 34 | oneway suggestPausePlayers(); |
| 35 | |
| 36 | |
| 37 | /** |
| 38 | * When the HAL makes this case, any apps currently playing must be asked to stop |
| 39 | * playing (via an AudioManager::AUDIOFOCUS_LOSS event). Once stopped, the apps must |
| 40 | * not resume their playback. |
| 41 | * |
| 42 | * It should be noted that not all apps or sound sources honor this request, but this |
| 43 | * at least gives an app the chance to do the right thing. |
| 44 | * Because it premanently stops media, this call is expected to be used only rarely. |
| 45 | * Perhaps in the event of an E-call, where resuming music might be undesirable assuming |
| 46 | * the driver is now dealing with whatever the emergency is? |
| 47 | */ |
| 48 | oneway suggestStopPlayers(); |
| 49 | |
| 50 | |
| 51 | /** |
| 52 | * Receives calls from the HAL when Android should resume normal operations. If the previous |
| 53 | * action was a requestPausePlayers, then things that were paused must be told they may |
| 54 | * resume. |
| 55 | */ |
| 56 | oneway resumePlayers(); |
| 57 | }; |