Merge "Adds unified car audio configuration"
diff --git a/service/res/values/attrs.xml b/service/res/values/attrs.xml
index 89c4258..be20c0f 100644
--- a/service/res/values/attrs.xml
+++ b/service/res/values/attrs.xml
@@ -18,11 +18,11 @@
-->
<resources>
- <!-- Defines the attributes and values used in res/xml/car_volume_group.xml -->
- <declare-styleable name="volumeGroups" />
-
+ <!-- Defines the attributes and values used in res/xml/car_volume_groups.xml -->
+ <declare-styleable name="volumeGroups">
+ <attr name="isDeprecated" format="boolean"/>
+ </declare-styleable>
<declare-styleable name="volumeGroups_group"/>
-
<declare-styleable name="volumeGroups_context">
<!-- Align with hardware/interfaces/automotive/audiocontrol/1.0/types.hal:ContextNumber -->
<attr name="context">
@@ -37,6 +37,18 @@
</attr>
</declare-styleable>
+ <!--
+ Defines the attributes and values used in car_audio_configuration.xml
+ This is a superset of car_volume_groups.xml
+ -->
+ <declare-styleable name="carAudioConfiguration">
+ <attr name="version" format="integer"/>
+ <attr name="isPrimary" format="boolean"/>
+ <attr name="name" format="string"/>
+ <attr name="address" format="string"/>
+ <attr name="display" format="string"/>
+ </declare-styleable>
+
<!-- Defines the UX restrictions to be imposed for different driving states of a vehicle -->
<declare-styleable name="UxRestrictions"/>
<!-- 1. UX restriction Mapping from a driving state of the vehicle-->
diff --git a/service/res/xml/car_audio_configuration.xml b/service/res/xml/car_audio_configuration.xml
new file mode 100644
index 0000000..2f82233
--- /dev/null
+++ b/service/res/xml/car_audio_configuration.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 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.
+-->
+
+<!--
+ Defines the audio configuration in a car, including
+ - Audio zones
+ - Display to audio zone mappings
+ - Context to audio bus mappings
+ - Volume groups
+ in the car environment.
+-->
+<carAudioConfiguration
+ xmlns:car="http://schemas.android.com/apk/res-auto"
+ car:version="1">
+ <zones>
+ <zone car:name="primary zone" car:isPrimary="true">
+ <volumeGroups>
+ <group>
+ <device car:address="bus0_media_out">
+ <context car:context="music"/>
+ </device>
+ <device car:address="bus3_call_ring_out">
+ <context car:context="call_ring"/>
+ </device>
+ <device car:address="bus6_notification_out">
+ <context car:context="notification"/>
+ </device>
+ <device car:address="bus7_system_sound_out">
+ <context car:context="system_sound"/>
+ </device>
+ </group>
+ <group>
+ <device car:address="bus1_navigation_out">
+ <context car:context="notification"/>
+ </device>
+ <device car:address="bus2_voice_command_out">
+ <context car:context="voice_command"/>
+ </device>
+ </group>
+ <group>
+ <device car:address="bus4_call_out">
+ <context car:context="call"/>
+ </device>
+ </group>
+ <group>
+ <device car:address="bus5_alarm_out">
+ <context car:context="alarm"/>
+ </device>
+ </group>
+ </volumeGroups>
+ <displays>
+ <display car:display="primary_display"/>
+ </displays>
+ </zone>
+ <zone car:name="rear seat zone">
+ <volumeGroups>
+ <group>
+ <device car:address="bus100_rear_seat">
+ <context car:context="music"/>
+ <context car:context="notification"/>
+ <context car:context="voice_command"/>
+ <context car:context="call_ring"/>
+ <context car:context="call"/>
+ <context car:context="alarm"/>
+ <context car:context="notification"/>
+ <context car:context="system_sound"/>
+ </device>
+ </group>
+ </volumeGroups>
+ <displays>
+ <display car:display="rear_seat_display"/>
+ </displays>
+ </zone>
+ </zones>
+</carAudioConfiguration>
diff --git a/service/res/xml/car_volume_groups.xml b/service/res/xml/car_volume_groups.xml
index 9bfc305..e2fa6b2 100644
--- a/service/res/xml/car_volume_groups.xml
+++ b/service/res/xml/car_volume_groups.xml
@@ -15,6 +15,19 @@
-->
<!--
+ This configuration is replaced by car_audio_configuration.xml
+
+ Notes on backward compatibility
+ - A new isDeprecated=true attr is added to the stock car_volume_groups.xml
+ - Existing car_volume_groups.xml overlays from OEM, without isDeprecated
+ attr being set, should default to isDeprecated=false
+ - If isDeprecated=true, CarAudioService loads the new
+ car_audio_configuration.xml
+ - Otherwise, CarAudioService loads car_volume_groups.xml queries
+ IAudioControl HAL (getBusForContext)
+
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
Defines the all available volume groups for volume control in a car.
One can overlay this configuration to customize the groups.
@@ -33,7 +46,8 @@
Important note: when overlaying this configuration,
make sure the resources are in the same package as CarAudioService.
-->
-<volumeGroups xmlns:car="http://schemas.android.com/apk/res-auto">
+<volumeGroups xmlns:car="http://schemas.android.com/apk/res-auto"
+ car:isDeprecated="true">
<group>
<context car:context="music"/>
<context car:context="call_ring"/>