File: usb.proto

package info (click to toggle)
android-platform-frameworks-base 1%3A10.0.0%2Br36-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 321,788 kB
  • sloc: java: 962,234; cpp: 274,314; xml: 242,770; python: 5,060; sh: 1,432; ansic: 494; makefile: 47; sed: 19
file content (396 lines) | stat: -rw-r--r-- 13,102 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
/*
 * 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.
 */

syntax = "proto2";
package android.service.usb;

option java_multiple_files = true;
option java_outer_classname = "UsbServiceProto";

import "frameworks/base/core/proto/android/content/component_name.proto";
import "frameworks/base/core/proto/android/service/enums.proto";
import "frameworks/base/core/proto/android/privacy.proto";

message UsbServiceDumpProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional UsbDeviceManagerProto device_manager = 1;
    optional UsbHostManagerProto host_manager = 2;
    optional UsbPortManagerProto port_manager = 3;
    optional UsbAlsaManagerProto alsa_manager = 4;
    optional UsbSettingsManagerProto settings_manager = 5;
}

message UsbDeviceManagerProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional UsbHandlerProto handler = 1;
    optional UsbDebuggingManagerProto debugging_manager = 2;
}

message UsbHandlerProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    /* Same as android.hardware.usb.gadget.V1_0.GadgetFunction.* */
    enum Function {
        FUNCTION_ADB = 1;
        FUNCTION_ACCESSORY = 2;
        FUNCTION_MTP = 4;
        FUNCTION_MIDI = 8;
        FUNCTION_PTP = 16;
        FUNCTION_RNDIS = 32;
        FUNCTION_AUDIO_SOURCE = 64;
    }

    repeated Function current_functions = 1;
    optional bool current_functions_applied = 2;
    repeated Function screen_unlocked_functions = 3;
    optional bool screen_locked = 4;
    optional bool connected = 5;
    optional bool configured = 6;
    optional UsbAccessoryProto current_accessory = 7;
    optional bool host_connected = 8;
    optional bool source_power = 9;
    optional bool sink_power = 10;
    optional bool usb_charging = 11;
    optional bool hide_usb_notification = 12;
    optional bool audio_accessory_connected = 13;
    optional bool adb_enabled = 14;
    optional string kernel_state = 15;
    optional string kernel_function_list = 16;
}

message UsbAccessoryProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional string manufacturer = 1;
    optional string model = 2;
    // For "classical" USB-accessories the manufacturer bakes this into the
    // firmware of the device. If an Android phone is configured as accessory, the
    // app that sets up the accessory side of the connection set this. Either way,
    // these are part of the detection protocol, and so they cannot be user set or
    // unique.
    optional string description = 3;
    optional string version = 4;
    optional string uri = 5 [ (android.privacy).dest = DEST_EXPLICIT ];
    // Non-resettable hardware ID.
    optional string serial = 6 [ (android.privacy).dest = DEST_LOCAL ];
}

message UsbDebuggingManagerProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional bool connected_to_adb = 1;
    // A workstation that connects to the phone for debugging is identified by
    // this key.
    optional string last_key_received = 2 [ (android.privacy).dest = DEST_EXPLICIT ];
    optional string user_keys = 3 [ (android.privacy).dest = DEST_LOCAL ];
    optional string system_keys = 4 [ (android.privacy).dest = DEST_LOCAL ];
}

message UsbHostManagerProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional android.content.ComponentNameProto default_usb_host_connection_handler = 1;
    repeated UsbDeviceProto devices = 2;
    optional int32 num_connects = 3;
    repeated UsbConnectionRecordProto connections = 4;
}

message UsbDeviceProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    // Generic USB name, not user-provided.
    optional string name = 1;
    // ID specific to the vendor, not the device.
    optional int32 vendor_id = 2;
    // ID of this product type: Each vendor gives each product a unique ID. E.g.
    // all mice of the same model would have the same ID.
    optional int32 product_id = 3;
    optional int32 class = 4;
    optional int32 subclass = 5;
    optional int32 protocol = 6;
    optional string manufacturer_name = 7;
    optional string product_name = 8;
    optional string version = 9;
    // Non-resettable hardware ID.
    optional string serial_number = 10 [ (android.privacy).dest = DEST_LOCAL ];
    repeated UsbConfigurationProto configurations = 11;
}

message UsbConfigurationProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    // A single USB device can have several configurations and the app accessing
    // the USB device can switch between them. At any time only one can be active.
    // Each configuration can present completely different interfaces end
    // endpoints, i.e. a completely different behavior.
    optional int32 id = 1;
    // Hardware-defined name, not set by the user.
    optional string name = 2;
    optional uint32 attributes = 3;
    optional int32 max_power = 4;
    repeated UsbInterfaceProto interfaces = 5;
}

message UsbInterfaceProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    // Hardware defined. This is the id used by the app to identify the interface.
    optional int32 id = 1;
    optional int32 alternate_settings = 2;
    optional string name = 3;
    optional int32 class = 4;
    optional int32 subclass = 5;
    optional int32 protocol = 6;
    repeated UsbEndPointProto endpoints = 7;
}

message UsbEndPointProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional int32 endpoint_number = 1;
    optional android.service.UsbEndPointDirection direction = 2;
      // The address of the endpoint. Needed to read and write to the endpoint.
    optional int32 address = 3;
    optional android.service.UsbEndPointType type = 4;
    optional uint32 attributes = 5;
    optional int32 max_packet_size = 6;
    optional int32 interval = 7;
}

message UsbConnectionRecordProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    // usb device's address, e.g. 001/002, nothing about the phone
    optional string device_address = 1;
    optional android.service.UsbConnectionRecordMode mode = 2;
    optional int64 timestamp = 3;
    optional int32 manufacturer = 4;
    optional int32 product = 5;
    optional UsbIsHeadsetProto is_headset = 6;
}

message UsbIsHeadsetProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional bool in = 1;
    optional bool out = 2;
}

message UsbPortManagerProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional bool is_simulation_active = 1;
    repeated UsbPortInfoProto usb_ports = 2;
}

message UsbPortInfoProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional UsbPortProto port = 1;
    optional UsbPortStatusProto status = 2;
    optional bool can_change_mode = 3;
    optional bool can_change_power_role = 4;
    optional bool can_change_data_role = 5;
    optional int64 connected_at_millis = 6;
    optional int64 last_connect_duration_millis = 7;
}

message UsbPortProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    /* Same as android.hardware.usb.V1_1.Constants.PortMode_1_1 */
    enum Mode {
        MODE_NONE = 0;
        MODE_UFP = 1;
        MODE_DFP = 2;
        MODE_DRP = 3;
        MODE_AUDIO_ACCESSORY = 4;
        MODE_DEBUG_ACCESSORY = 8;
    }

    // ID of the port. A device (eg: Chromebooks) might have multiple ports.
    optional string id = 1;
    repeated Mode supported_modes = 2;
}

/* Same as android.hardware.usb.V1_2.Constants.ContaminantPresenceStatus */
enum ContaminantPresenceStatus {
    CONTAMINANT_STATUS_UNKNOWN = 0;
    CONTAMINANT_STATUS_NOT_SUPPORTED = 1;
    CONTAMINANT_STATUS_DISABLED = 2;
    CONTAMINANT_STATUS_NOT_DETECTED = 3;
    CONTAMINANT_STATUS_DETECTED = 4;
}

message UsbPortStatusProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    /* Same as android.hardware.usb.V1_0.Constants.PortPowerRole */
    enum PowerRole {
        POWER_ROLE_NONE = 0;
        POWER_ROLE_SOURCE = 1;
        POWER_ROLE_SINK = 2;
    }

    /* Same as android.hardware.usb.V1_0.Constants.PortDataRole */
    enum DataRole {
        DATA_ROLE_NONE = 0;
        DATA_ROLE_HOST = 1;
        DATA_ROLE_DEVICE = 2;
    }

    optional bool connected = 1;
    optional UsbPortProto.Mode current_mode = 2;
    optional PowerRole power_role = 3;
    optional DataRole data_role = 4;
    repeated UsbPortStatusRoleCombinationProto role_combinations = 5;
    optional ContaminantPresenceStatus contaminant_presence_status = 6;
}

message UsbPortStatusRoleCombinationProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional UsbPortStatusProto.PowerRole power_role = 1;
    optional UsbPortStatusProto.DataRole data_role = 2;
}

message UsbAlsaManagerProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional int32 cards_parser = 1;
    repeated UsbAlsaDeviceProto alsa_devices = 2;
    repeated UsbMidiDeviceProto midi_devices = 3;
}

message UsbAlsaDeviceProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional int32 card = 1;
    optional int32 device = 2;
    optional string name = 3;
    optional bool has_playback = 4;
    optional bool has_capture = 5;
    // usb device's address, e.g. 001/002, nothing about the phone
    optional string address = 6;
}

message UsbMidiDeviceProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional int32 card = 1;
    optional int32 device = 2;
    // usb device's address, e.g. 001/002, nothing about the phone
    optional string device_address = 3;
}

message UsbSettingsManagerProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    repeated UsbUserSettingsManagerProto user_settings = 1;
    repeated UsbProfileGroupSettingsManagerProto profile_group_settings = 2;
}

message UsbUserSettingsManagerProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional int32 user_id = 1;
    repeated UsbSettingsDevicePermissionProto device_permissions = 2;
    repeated UsbSettingsAccessoryPermissionProto accessory_permissions = 3;
    repeated UsbDeviceAttachedActivities device_attached_activities = 4;
    repeated UsbAccessoryAttachedActivities accessory_attached_activities = 5;
}

message UsbSettingsDevicePermissionProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional string device_name = 1;
    repeated int32 uids = 2;
}

message UsbSettingsAccessoryPermissionProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional string accessory_description = 1;
    repeated int32 uids = 2;
}

message UsbProfileGroupSettingsManagerProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    // The user id of the personal profile if the device has a work profile.
    optional int32 parent_user_id = 1;
    repeated UsbSettingsDevicePreferenceProto device_preferences = 2;
    repeated UsbSettingsAccessoryPreferenceProto accessory_preferences = 3;
}

message UsbSettingsDevicePreferenceProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional UsbDeviceFilterProto filter = 1;
    optional UserPackageProto user_package = 2;
}

message UsbDeviceFilterProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    // Mirrors the vendor_id of UsbDeviceProto.
    optional int32 vendor_id = 1;
    optional int32 product_id = 2;
    optional int32 class = 3;
    optional int32 subclass = 4;
    optional int32 protocol = 5;
    optional string manufacturer_name = 6;
    optional string product_name = 7;
    optional string serial_number = 8 [ (android.privacy).dest = DEST_EXPLICIT ];
}

message UserPackageProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional int32 user_id = 1;
    optional string package_name =2;
}

message UsbSettingsAccessoryPreferenceProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional UsbAccessoryFilterProto filter = 1;
    optional UserPackageProto user_package = 2;
}

message UsbAccessoryFilterProto {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional string manufacturer = 1;
    optional string model = 2;
    optional string version = 3;
}

message UsbDeviceAttachedActivities {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional android.content.ComponentNameProto activity = 1;
    repeated UsbDeviceFilterProto filters = 2;
}

message UsbAccessoryAttachedActivities {
    option (android.msg_privacy).dest = DEST_AUTOMATIC;

    optional android.content.ComponentNameProto activity = 1;
    repeated UsbAccessoryFilterProto filters = 2;
}