1/*
2 * Copyright (C) 2023 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
17syntax = "proto2";
18
19package com.android.car.audio;
20
21option java_multiple_files = true;
22
23message CarAudioDumpProto {
24  message CarAudioConfiguration {
25    optional bool use_dynamic_routing = 1;
26    optional bool use_core_audio_volume = 2;
27    optional bool use_core_audio_routing = 3;
28    optional bool patch_api_enabled = 4;
29    optional bool persist_master_mute_state = 5;
30    optional bool use_hal_ducking_signals = 6;
31    optional int32 key_event_timeout_ms = 7;
32    optional string car_audio_configuration_path = 8;
33    optional bool use_car_volume_group_muting = 9;
34    optional bool use_car_volume_group_events = 10;
35    optional bool use_fade_manager_configuration = 11;
36    optional bool use_min_max_activation_volume = 12;
37    optional bool use_isolated_focus_for_dynamic_devices = 13;
38  }
39
40  message CarAudioState {
41    optional bool master_muted = 1;
42    optional bool audio_enabled = 2;
43  }
44
45  optional CarAudioConfiguration configuration = 1;
46  optional CarAudioState current_state = 2;
47
48  message CarAudioAttributesProto {
49    optional int32 usage = 1;
50    optional int32 content_type = 2;
51  }
52  message CarAudioContextInfoProto {
53    optional string name = 1;
54    optional int32 id = 2;
55    repeated CarAudioAttributesProto attributes = 3;
56  }
57  message CarVolumeProto {
58    message CarAudioContextPriority {
59      repeated CarAudioContextInfoProto contexts = 1;
60      optional int32 priority = 2;
61    }
62    optional int32 audio_volume_adjustment_contexts_version = 1;
63    optional int32 volume_key_event_timeout_ms = 2;
64    repeated CarAudioContextPriority audio_context_priorities = 3;
65  }
66
67  optional CarVolumeProto car_volume = 3;
68
69  message CarAudioContextProto {
70    repeated CarAudioContextInfoProto car_audio_context_infos = 1;
71  }
72
73  optional CarAudioContextProto car_audio_context = 4;
74
75  message CarVolumeGain {
76    optional int32 min_gain_index = 1;
77    optional int32 max_gain_index = 2;
78    optional int32 default_gain_index = 3;
79    optional int32 current_gain_index = 4;
80    optional int32 min_activation_gain_index = 5;
81    optional int32 max_activation_gain_index = 6;
82    optional int32 activation_invocation_type = 7;
83  }
84  message CarAudioDeviceInfoProto {
85    optional string address = 1;
86    optional bool can_be_routed_with_dynamic_policy_mix_rule = 2;
87    optional int32 sample_rate = 3;
88    optional int32 encoding_format = 4;
89    optional int32 channel_count = 5;
90    optional CarVolumeGain volume_gain = 6;
91    optional bool is_active = 7;
92  }
93
94  message CarVolumeGroupProto {
95    message GainInfo {
96      optional bool blocked = 1;
97      optional bool blocked_gain_index = 2;
98      optional bool limited = 3;
99      optional bool limited_gain_index = 4;
100      optional bool attenuated = 5;
101      optional bool attenuated_gain_index = 6;
102      optional bool hal_muted = 7;
103      optional bool is_active = 8;
104    }
105    message ContextToAddress {
106      optional string context = 1;
107      optional string address = 2;
108    }
109    optional int32 id = 1;
110    optional string name = 2;
111    optional int32 zone_id = 3;
112    optional int32 config_id = 4;
113    optional bool muted = 5;
114    optional int32 user_id = 6;
115    optional bool persist_volume_group_mute_enabled = 7;
116    optional CarVolumeGain volume_gain = 8;
117    repeated ContextToAddress context_to_address_mappings = 9;
118    repeated CarAudioDeviceInfoProto car_audio_device_infos = 10;
119    repeated string reported_reasons = 11;
120    optional GainInfo gain_infos = 12;
121  }
122
123  message CarAudioZoneConfigProto {
124    optional string name = 1;
125    optional int32 id = 2;
126    optional int32 zone_id = 3;
127    optional bool default = 4;
128    repeated CarVolumeGroupProto volume_groups = 5;
129    optional bool is_active = 6;
130    optional bool is_selected = 7;
131    optional bool is_fade_manager_config_enabled = 8;
132    optional CarAudioFadeConfigurationProto default_car_audio_fade_configuration = 9;
133    repeated AttrToCarAudioFadeConfiguration attr_to_car_audio_fade_configuration = 10;
134    message AttrToCarAudioFadeConfiguration {
135      optional CarAudioAttributesProto attributes = 1;
136      optional CarAudioFadeConfigurationProto car_audio_fade_configuration = 2;
137    }
138  }
139
140  message CarAudioZoneProto {
141    optional string name = 1;
142    optional int32 id = 2;
143    optional bool primary_zone = 3;
144    optional int32 current_zone_config_id = 4;
145    repeated string input_audio_device_addresses = 5;
146    repeated CarAudioZoneConfigProto zone_configs = 6;
147  }
148
149  repeated CarAudioZoneProto car_audio_zones = 5;
150
151  message UserIdToAudioZone {
152    optional int32 user_id = 1;
153    optional int32 audio_zone_id = 2;
154  }
155
156  repeated UserIdToAudioZone user_id_to_audio_zone_mappings = 6;
157
158  message AudioZoneToOccupantZone {
159    optional int32 audio_zone_id = 1;
160    optional int32 occupant_zone_id = 2;
161  }
162  repeated AudioZoneToOccupantZone audio_zone_to_occupant_zone_mappings = 7;
163
164  message UidToAudioZone {
165    optional int32 uid = 1;
166    optional int32 audio_zone_id = 2;
167  }
168
169  repeated UidToAudioZone uid_to_audio_zone_mappings = 8;
170
171  message CarAudioZoneFocusProto {
172    message CarAudioFocusProto {
173      message FocusInteractionProto {
174        optional bool reject_navigation_on_call = 1;
175      }
176      message FocusEntryProto {
177        optional string client_id = 1;
178        optional CarAudioAttributesProto attributes = 2;
179        optional bool receives_duck_events = 3;
180        optional bool wants_pause_instead_of_ducking = 4;
181        optional bool is_ducked = 5;
182        optional bool is_unblocked = 6;
183        repeated FocusEntryProto blockers = 7;
184      }
185      optional int32 zone_id = 1;
186      optional bool focus_restricted = 2;
187      optional bool external_focus_enabled = 3;
188      optional FocusInteractionProto focus_interaction = 4;
189      repeated FocusEntryProto focus_holders = 5;
190      repeated FocusEntryProto focus_losers = 6;
191      optional string delayed_focus = 7;
192    }
193    optional bool hasFocusCallback = 1;
194    repeated CarAudioFocusProto car_audio_focuses = 2;
195  }
196
197  optional CarAudioZoneFocusProto focus_handler = 9;
198
199  message HalAudioFocusProto {
200    message HalFocusRequestsByZoneAndAttributes {
201      optional int32 zone_id = 1;
202      repeated string hal_focus_requests_by_attributes = 2;
203    }
204    repeated HalFocusRequestsByZoneAndAttributes hal_focus_requests_by_zone_and_attributes = 1;
205  }
206  optional HalAudioFocusProto hal_audio_focus = 10;
207
208  message CarDuckingProto {
209    repeated string tags = 1;
210    message CarDuckingInfoProto {
211      message PlaybackTrackMetaData {
212        optional string usage = 1;
213        optional int32 content_type = 2;
214        repeated string tags = 3;
215      }
216      optional int32 zone_id = 1;
217      repeated string addresses_to_duck = 2;
218      repeated string addresses_to_unduck = 3;
219      repeated PlaybackTrackMetaData playback_meta_data_holding_focus = 4;
220    }
221    repeated CarDuckingInfoProto current_ducking_infos = 2;
222  }
223  optional CarDuckingProto car_ducking = 11;
224
225  message CarVolumeGroupMutingProto {
226    message CarMutingInfo {
227      optional int32 zone_id = 1;
228      repeated string device_addresses_to_mute = 2;
229      repeated string device_addresses_to_unmute = 3;
230    }
231    optional bool is_muting_restricted = 1;
232    repeated CarMutingInfo last_muting_information = 2;
233  }
234  optional CarVolumeGroupMutingProto car_volume_group_muting = 12;
235
236  message CarAudioPlaybackCallbackProto {
237    message ZoneAudioPlaybackCallbackProto {
238      message AudioDeviceAddressToConfig {
239        optional string address = 1;
240        optional string config = 2;
241      }
242      message AudioAttributesToStartTime {
243        optional CarAudioAttributesProto audio_attributes = 1;
244        optional int64 start_time = 2;
245      }
246      optional int32 zone_id = 1;
247      repeated AudioDeviceAddressToConfig last_active_configs = 2;
248      repeated AudioAttributesToStartTime audio_attributes_to_start_times = 3;
249    }
250    repeated ZoneAudioPlaybackCallbackProto zone_audio_playback_callbacks = 1;
251  }
252  optional CarAudioPlaybackCallbackProto car_audio_playback_callback = 13;
253
254  message CarAudioMirrorRequestHandlerProto {
255    message RequestIdToZones {
256      optional int64 request_id = 1;
257      repeated int32 zone_ids = 2;
258    }
259    message RequestIdToMirrorDevice {
260      optional CarAudioDeviceInfoProto mirror_device = 1;
261      optional int64 request_id = 2;
262    }
263    optional bool is_mirror_audio_enabled = 1;
264    repeated CarAudioDeviceInfoProto mirror_device_infos = 2;
265    optional int32 register_count = 3;
266    repeated RequestIdToZones mirroring_configurations = 4;
267    repeated RequestIdToMirrorDevice mirror_device_mappings = 5;
268  }
269  optional CarAudioMirrorRequestHandlerProto car_audio_mirror_request_handler = 14;
270
271  message MediaRequestHandlerProto {
272    message MediaRequestIdToCallback {
273      optional int64 request_id = 1;
274      optional string callback = 2;
275    }
276    message MediaRequestIdToApprover {
277      optional int64 request_id = 1;
278      optional string approver = 2;
279    }
280    optional int32 media_request_callback_count = 1;
281    repeated string media_request_callbacks = 2;
282    repeated string assigned_occupants = 3;
283    repeated MediaRequestIdToCallback request_id_to_callback_mappings = 4;
284    repeated MediaRequestIdToApprover request_id_to_approver_mappings = 5;
285  }
286  optional MediaRequestHandlerProto media_request_handler = 15;
287  repeated CarAudioFadeConfigurationProto available_car_fade_configurations = 16;
288
289  message CarAudioFadeConfigurationProto {
290    message FadeManagerConfigurationProto {
291      message VolumeShaperConfiguration {
292        optional int32 duration = 1;
293      }
294      message UsagesToVolumeShaperConfiguration {
295        optional int32 usage = 1;
296        optional VolumeShaperConfiguration fade_out_vol_shaper_config = 2;
297        optional VolumeShaperConfiguration fade_in_vol_shaper_config = 3;
298      }
299      message AttributeToVolumeShaperConfiguration {
300        optional CarAudioAttributesProto attributes = 1;
301        optional VolumeShaperConfiguration fade_out_vol_shaper_config = 2;
302        optional VolumeShaperConfiguration fade_in_vol_shaper_config = 3;
303      }
304      optional int32 state = 1;
305      repeated int32 fadeable_usages = 2;
306      repeated int32 unfadeable_content_types = 3;
307      repeated int32 unfadeable_uids = 4;
308      repeated CarAudioAttributesProto unfadeable_attributes = 5;
309      repeated UsagesToVolumeShaperConfiguration usages_to_volume_shaper_config = 6;
310      repeated AttributeToVolumeShaperConfiguration attr_to_volume_shaper_config = 7;
311    }
312    optional string name = 1;
313    optional FadeManagerConfigurationProto fade_manager_configuration = 2;
314  }
315}
316