Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
main ▾

Modern-Apps.git / auto / protocol / src / main / proto / gal / control.proto

control.proto242 lines · 8.3 KiBRaw
1// Google Automotive Link control channel.
2//
3// Field numbers, wire types and cardinality were recovered from the protobuf-lite
4// RawMessageInfo descriptors in the Android Auto APK (analysis/maauto/dump_protos.py) and are
5// exact. Message and field NAMES are not in the APK -- they follow the public aasdk/openauto
6// naming, which uses the same field numbers.
7//
8// proto2 throughout, because the originals are proto2: `required` and explicit presence are
9// load-bearing here, and a head unit will reject a message missing a required field.
10
11syntax = "proto2";
12
13package gal;
14
15import "gal/services.proto";
16
17option java_package = "com.vayunmathur.auto.protocol.gal";
18option java_multiple_files = true;
19
20// ---- enums ----
21
22// Recovered verbatim from the APK's Java enums, values included.
23enum MessageStatus {
24 STATUS_SUCCESS = 0;
25 STATUS_UNSOLICITED_MESSAGE = 1;
26 STATUS_NO_COMPATIBLE_VERSION = -1;
27 STATUS_CERTIFICATE_ERROR = -2;
28 STATUS_AUTHENTICATION_FAILURE = -3;
29 STATUS_INVALID_SERVICE = -4;
30 STATUS_INVALID_CHANNEL = -5;
31 STATUS_INVALID_PRIORITY = -6;
32 STATUS_INTERNAL_ERROR = -7;
33 STATUS_MEDIA_CONFIG_MISMATCH = -8;
34 STATUS_INVALID_SENSOR = -9;
35 STATUS_BLUETOOTH_PAIRING_DELAYED = -10;
36 STATUS_BLUETOOTH_UNAVAILABLE = -11;
37 STATUS_BLUETOOTH_INVALID_ADDRESS = -12;
38 STATUS_BLUETOOTH_INVALID_PAIRING_METHOD = -13;
39 STATUS_BLUETOOTH_INVALID_AUTH_DATA = -14;
40 STATUS_BLUETOOTH_AUTH_DATA_MISMATCH = -15;
41 STATUS_BLUETOOTH_HFP_ANOTHER_CONNECTION = -16;
42 STATUS_BLUETOOTH_HFP_CONNECTION_FAILURE = -17;
43 STATUS_KEYCODE_NOT_BOUND = -18;
44 STATUS_RADIO_INVALID_STATION = -19;
45 STATUS_INVALID_INPUT = -20;
46 STATUS_RADIO_STATION_PRESETS_NOT_SUPPORTED = -21;
47 STATUS_RADIO_COMM_ERROR = -22;
48 STATUS_AUTHENTICATION_FAILURE_CERT_NOT_YET_VALID = -23;
49 STATUS_AUTHENTICATION_FAILURE_CERT_EXPIRED = -24;
50 STATUS_PING_TIMEOUT = -25;
51 STATUS_CAR_PROPERTY_SET_REQUEST_FAILED = -26;
52 STATUS_CAR_PROPERTY_LISTENER_REGISTRATION_FAILED = -27;
53 STATUS_COMMAND_NOT_SUPPORTED = -250;
54 STATUS_FRAMING_ERROR = -251;
55 STATUS_UNEXPECTED_MESSAGE = -253;
56 STATUS_BUSY = -254;
57 STATUS_OUT_OF_MEMORY = -255;
58}
59
60enum ByeByeReason {
61 USER_SELECTION = 1;
62 DEVICE_SWITCH = 2;
63 NOT_SUPPORTED = 3;
64 NOT_CURRENTLY_SUPPORTED = 4;
65 PROBE_SUPPORTED = 5;
66 WIRELESS_PROJECTION_DISABLED = 6;
67 POWER_DOWN = 7;
68 USER_PROFILE_SWITCH = 8;
69}
70
71enum AudioFocusRequestType {
72 AUDIO_FOCUS_GAIN = 1;
73 AUDIO_FOCUS_GAIN_TRANSIENT = 2;
74 AUDIO_FOCUS_GAIN_TRANSIENT_MAY_DUCK = 3;
75 AUDIO_FOCUS_RELEASE = 4;
76}
77
78enum AudioFocusState {
79 AUDIO_FOCUS_STATE_INVALID = 0;
80 AUDIO_FOCUS_STATE_GAIN = 1;
81 AUDIO_FOCUS_STATE_GAIN_TRANSIENT = 2;
82 AUDIO_FOCUS_STATE_LOSS = 3;
83 AUDIO_FOCUS_STATE_LOSS_TRANSIENT_CAN_DUCK = 4;
84 AUDIO_FOCUS_STATE_LOSS_TRANSIENT = 5;
85 AUDIO_FOCUS_STATE_GAIN_MEDIA_ONLY = 6;
86 AUDIO_FOCUS_STATE_GAIN_TRANSIENT_GUIDANCE_ONLY = 7;
87}
88
89enum NavigationFocusType {
90 NAV_FOCUS_NATIVE = 1;
91 NAV_FOCUS_PROJECTED = 2;
92}
93
94// ---- messages ----
95
96// Control message 5. Sent by the PHONE. Only sent once version negotiation reaches >= 1.6.
97//
98// ONLY field 5 goes on the wire in practice: gearhead's `jog.run()` sets fields
99// 1-3 (`izu.g/h/i`), 4 (`izu.f`) and 6 (`izu.j`) only when that state is non-null,
100// and all of it is null on the plain DHU path (fields 1-3/4 come from optional
101// head-unit resource config, 6 needs a version-gated non-null string). `jog` then
102// nulls g/h/i/f, so every repeat is field-5-only by construction. Field 5 is the
103// device label: `Build.MODEL` with `"$MANUFACTURER "` prepended unless MODEL
104// already starts with MANUFACTURER (e.g. "Google Pixel 8").
105//
106// A Desktop Head Unit answers any other shape here with a bare MessageError
107// (0xff), which is what blocked us until this matched gearhead byte for byte.
108// The fields stay `optional` here (proto2 required-ness is load-bearing in the
109// other direction only), and the sender sets exactly field 5.
110message ServiceDiscoveryRequest {
111 optional bytes field1 = 1;
112 optional bytes field2 = 2;
113 optional bytes field3 = 3;
114 optional string device_name = 4;
115 optional string device_brand = 5;
116 optional bytes field6 = 6;
117}
118
119// Control message 6. Sent by the HEAD UNIT: it advertises, we consume.
120message ServiceDiscoveryResponse {
121 repeated Service services = 1;
122 optional string head_unit_name = 2;
123 optional string car_model = 3;
124 optional string car_year = 4;
125 optional string car_serial = 5;
126 optional int32 driver_position = 6;
127 optional string headunit_make = 7;
128 optional string headunit_model = 8;
129 optional string headunit_software_build = 9;
130 optional string headunit_software_version = 10;
131 optional bool can_play_native_media_during_vr = 11;
132 optional int32 field13 = 13;
133 optional string field14 = 14;
134 optional bool hide_clock = 15;
135 optional bytes field17 = 17;
136 // Fields 12 and 16 are absent from this build.
137}
138
139// The service id doubles as the channel id. Exactly one of the payload fields is set;
140// which one tells you what the service is.
141message Service {
142 required int32 id = 1;
143 optional SensorSourceService sensor_source = 2;
144 optional MediaSinkService media_sink = 3;
145 optional InputSourceService input_source = 4;
146 optional MediaSourceService media_source = 5;
147 optional BluetoothService bluetooth = 6;
148 // Field 7 (`xnb`): `dump_protos.py` recovers a single optional message
149 // field 2, but the nested message class is unidentified in the dump, so
150 // this stays opaque bytes (NOT_SUPPORTED) rather than a mistyped DTO.
151 optional bytes radio = 7;
152 optional NavigationStatusService navigation_status = 8;
153 // Fields 9-11 (`xkn` media-playback-status, `xmf` phone-status, `xki`
154 // media-browser): every descriptor decodes EMPTY (proto2, zero fields), so
155 // there is no channel layout to type -- opaque bytes (NOT_SUPPORTED).
156 // Now-playing is served from the on-device media session and rendered into
157 // the ch2 video stream instead.
158 optional bytes media_playback_status = 9;
159 optional bytes phone_status = 10;
160 optional bytes media_browser = 11;
161 optional VendorExtensionService vendor_extension = 12;
162 // Field 13 (`xjm` notification): descriptor decodes EMPTY like 9-11 above,
163 // so the real ch14 IDs are unrecovered -- opaque bytes (NOT_SUPPORTED) and
164 // the MA-defined `gal/notification.proto` stub rides instead.
165 optional bytes notification = 13;
166 optional WifiProjectionService wifi_projection = 14;
167 // Fields 15-18 (`rro` 18 WIFI_DISCOVERY, 19 CAR_CONTROL, 20 CAR_LOCAL_MEDIA,
168 // 21 BUFFERED_MEDIA_SINK, 22 CAR_INTENT): `xnz` carries no class references
169 // for these slots, so their payload classes are unrecoverable from the
170 // dump -- opaque bytes (NOT_SUPPORTED), one slot per service in `rro` order.
171 optional bytes field15 = 15;
172 optional bytes field16 = 16;
173 optional bytes field17 = 17;
174 optional bytes field18 = 18;
175}
176
177// Control message 26: hot-add or replace one service after the initial discovery.
178message ServiceDiscoveryUpdate {
179 optional Service service = 1;
180}
181
182// Control message 7. Note the order: priority first, then the service id. `priority` is
183// sint32 because the control channel opens itself at -128.
184message ChannelOpenRequest {
185 required sint32 priority = 1;
186 required int32 service_id = 2;
187}
188
189// Control message 8. Sent by the HEAD UNIT: whether our channel-open request
190// succeeded. `xir.c` is the `xkr` status enum value (STATUS_SUCCESS = 0).
191// gearhead's `iza.a()` parses exactly this and, on anything but SUCCESS, closes
192// the channel (`P(1)` + `c()`).
193message ChannelOpenResponse {
194 required int32 status = 1;
195}
196
197// Control message 4.
198message AuthComplete {
199 required int32 status = 1;
200}
201
202// Control message 11.
203message PingRequest {
204 required int64 timestamp = 1;
205 optional bool bug_report = 2;
206 optional bytes field3 = 3;
207}
208
209// Control message 12.
210message PingResponse {
211 required int64 timestamp = 1;
212 optional bytes field2 = 2;
213}
214
215// Control message 15.
216message ByeByeRequest {
217 required ByeByeReason reason = 1;
218}
219
220// Control message 16. Genuinely empty.
221message ByeByeResponse {}
222
223// Control message 18.
224message AudioFocusRequestMessage {
225 required AudioFocusRequestType request = 1;
226}
227
228// Control message 19.
229message AudioFocusNotification {
230 required AudioFocusState state = 1;
231 optional bool unsolicited = 2;
232}
233
234// Control message 14.
235message NavigationFocusNotification {
236 required NavigationFocusType focus = 1;
237}
238
239// Control message 24.
240message CallAvailabilityStatus {
241 optional bool call_available = 1;
242}