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/IAudioControl.hal b/automotive/audiocontrol/1.0/IAudioControl.hal
new file mode 100644
index 0000000..fe9ea8e
--- /dev/null
+++ b/automotive/audiocontrol/1.0/IAudioControl.hal
@@ -0,0 +1,73 @@
+/*
+ * 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;
+
+import IAudioControlCallback;
+
+
+/**
+ * Interacts with the car's audio subsystem to manage audio sources and volumes
+ */
+interface IAudioControl {
+
+ /**
+ * Registers the required callback object so that we can be notified when the state
+ * of the car's audio system changes. This call must be made when the interface is
+ * initialized.
+ */
+ setCallback(IAudioControlCallback notificationObject)
+ generates (AudioResult result);
+
+
+ /**
+ * Called at startup once per context to get the mapping from ContextNumber to
+ * busAddress. This lets the car tell the framework to which physical output stream
+ * each context should be routed.
+ *
+ * For every context, a valid bus number (0 - num busses-1) must be returned. If an
+ * unrecognized contextNumber is encountered, then -1 shall be returned.
+ *
+ * Any context for which an invalid busNumber is returned must be routed to bus 0.
+ */
+ getBusForContext(uint32_t contextNumber)
+ generates (int32_t busNumber);
+
+
+ /**
+ * Control the right/left balance setting of the car speakers.
+ *
+ * This is intended to shift the speaker volume toward the right (+) or left (-) side of
+ * the car. 0.0 means "centered". +1.0 means fully right. -1.0 means fully left.
+ *
+ * A value outside the range -1 to 1 must be clamped by the implementation to the -1 to 1
+ * range.
+ */
+ oneway setBalanceTowardRight(float value);
+
+
+ /**
+ * Control the fore/aft fade setting of the car speakers.
+ *
+ * This is intended to shift the speaker volume toward the front (+) or back (-) of the car.
+ * 0.0 means "centered". +1.0 means fully forward. -1.0 means fully rearward.
+ *
+ * A value outside the range -1 to 1 must be clamped by the implementation to the -1 to 1
+ * range.
+ */
+ oneway setFadeTowardFront(float value);
+};
+