Define new AudioControl HAL for automotive.
This provides a mechanism for Android to interact with a car's
audio subsystem.
It is a partial replacement for the deprecated AUDIO_* properties in VehicleHal.
It also provides control over fade/balance.
Bug: 31623564
Test: build for bat_land. VTS tests in future CL.
Change-Id: I4344cce3a6aa9a28d1327bf4d16bd080c7fd3f50
diff --git a/automotive/audiocontrol/1.0/IAudioControlCallback.hal b/automotive/audiocontrol/1.0/IAudioControlCallback.hal
new file mode 100644
index 0000000..f5c227e
--- /dev/null
+++ b/automotive/audiocontrol/1.0/IAudioControlCallback.hal
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.automotive.audiocontrol@1.0;
+
+
+/**
+ * Implemented on client (framework) side to receive asynchronous updates from the car.
+ */
+interface IAudioControlCallback {
+
+ /**
+ * When the HAL makes this call, any apps currently playing must be asked to
+ * temporarily suspend playback (via an AudioManager::AUDIOFOCUS_LOSS_TRANSIENT event).
+ *
+ * This is only a suggestion. Apps may be slow to react or even ignore this message
+ * entirely. Enforcement, if necessary, must be done at the AudioHAL level as the
+ * samples are delivered. In most instances, this is the way a car should ask for
+ * quiet if it needs it for some important situation, such as warning alarms or chimes.
+ */
+ oneway suggestPausePlayers();
+
+
+ /**
+ * When the HAL makes this case, any apps currently playing must be asked to stop
+ * playing (via an AudioManager::AUDIOFOCUS_LOSS event). Once stopped, the apps must
+ * not resume their playback.
+ *
+ * It should be noted that not all apps or sound sources honor this request, but this
+ * at least gives an app the chance to do the right thing.
+ * Because it premanently stops media, this call is expected to be used only rarely.
+ * Perhaps in the event of an E-call, where resuming music might be undesirable assuming
+ * the driver is now dealing with whatever the emergency is?
+ */
+ oneway suggestStopPlayers();
+
+
+ /**
+ * Receives calls from the HAL when Android should resume normal operations. If the previous
+ * action was a requestPausePlayers, then things that were paused must be told they may
+ * resume.
+ */
+ oneway resumePlayers();
+};