| 1 |
/* |
| 2 |
* Copyright (C) 2018 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 |
|
| 17 |
syntax = "proto2"; |
| 18 |
package android.service.usb; |
| 19 |
|
| 20 |
option java_multiple_files = true; |
| 21 |
option java_outer_classname = "UsbServiceProto"; |
| 22 |
|
| 23 |
import "frameworks/base/core/proto/android/content/component_name.proto"; |
| 24 |
import "frameworks/base/core/proto/android/privacy.proto"; |
| 25 |
import "frameworks/proto_logging/stats/enums/service/enums.proto"; |
| 26 |
|
| 27 |
message UsbServiceDumpProto { |
| 28 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 29 |
|
| 30 |
optional UsbDeviceManagerProto device_manager = 1; |
| 31 |
optional UsbHostManagerProto host_manager = 2; |
| 32 |
optional UsbPortManagerProto port_manager = 3; |
| 33 |
optional UsbAlsaManagerProto alsa_manager = 4; |
| 34 |
optional UsbSettingsManagerProto settings_manager = 5; |
| 35 |
optional UsbPermissionsManagerProto permissions_manager = 6; |
| 36 |
} |
| 37 |
|
| 38 |
message UsbDeviceManagerProto { |
| 39 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 40 |
|
| 41 |
optional UsbHandlerProto handler = 1; |
| 42 |
optional UsbDebuggingManagerProto debugging_manager = 2; |
| 43 |
} |
| 44 |
|
| 45 |
message UsbHandlerProto { |
| 46 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 47 |
|
| 48 |
/* Same as android.hardware.usb.gadget.V1_0.GadgetFunction.* */ |
| 49 |
enum Function { |
| 50 |
FUNCTION_ADB = 1; |
| 51 |
FUNCTION_ACCESSORY = 2; |
| 52 |
FUNCTION_MTP = 4; |
| 53 |
FUNCTION_MIDI = 8; |
| 54 |
FUNCTION_PTP = 16; |
| 55 |
FUNCTION_RNDIS = 32; |
| 56 |
FUNCTION_AUDIO_SOURCE = 64; |
| 57 |
} |
| 58 |
|
| 59 |
repeated Function current_functions = 1; |
| 60 |
optional bool current_functions_applied = 2; |
| 61 |
repeated Function screen_unlocked_functions = 3; |
| 62 |
optional bool screen_locked = 4; |
| 63 |
optional bool connected = 5; |
| 64 |
optional bool configured = 6; |
| 65 |
optional UsbAccessoryProto current_accessory = 7; |
| 66 |
optional bool host_connected = 8; |
| 67 |
optional bool source_power = 9; |
| 68 |
optional bool sink_power = 10; |
| 69 |
optional bool usb_charging = 11; |
| 70 |
optional bool hide_usb_notification = 12; |
| 71 |
optional bool audio_accessory_connected = 13; |
| 72 |
optional bool adb_enabled = 14; |
| 73 |
optional string kernel_state = 15; |
| 74 |
optional string kernel_function_list = 16; |
| 75 |
optional string uevent = 17; |
| 76 |
} |
| 77 |
|
| 78 |
message UsbAccessoryProto { |
| 79 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 80 |
|
| 81 |
optional string manufacturer = 1; |
| 82 |
optional string model = 2; |
| 83 |
// For "classical" USB-accessories the manufacturer bakes this into the |
| 84 |
// firmware of the device. If an Android phone is configured as accessory, the |
| 85 |
// app that sets up the accessory side of the connection set this. Either way, |
| 86 |
// these are part of the detection protocol, and so they cannot be user set or |
| 87 |
// unique. |
| 88 |
optional string description = 3; |
| 89 |
optional string version = 4; |
| 90 |
optional string uri = 5 [ (android.privacy).dest = DEST_EXPLICIT ]; |
| 91 |
// Non-resettable hardware ID. |
| 92 |
optional string serial = 6 [ (android.privacy).dest = DEST_LOCAL ]; |
| 93 |
} |
| 94 |
|
| 95 |
message UsbDebuggingManagerProto { |
| 96 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 97 |
|
| 98 |
optional bool connected_to_adb = 1; |
| 99 |
// A workstation that connects to the phone for debugging is identified by |
| 100 |
// this key. |
| 101 |
optional string last_key_received = 2 [ (android.privacy).dest = DEST_EXPLICIT ]; |
| 102 |
optional string user_keys = 3 [ (android.privacy).dest = DEST_LOCAL ]; |
| 103 |
optional string system_keys = 4 [ (android.privacy).dest = DEST_LOCAL ]; |
| 104 |
} |
| 105 |
|
| 106 |
message UsbHostManagerProto { |
| 107 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 108 |
|
| 109 |
optional android.content.ComponentNameProto default_usb_host_connection_handler = 1; |
| 110 |
repeated UsbDeviceProto devices = 2; |
| 111 |
optional int32 num_connects = 3; |
| 112 |
repeated UsbConnectionRecordProto connections = 4; |
| 113 |
repeated UsbDirectMidiDeviceProto midi_devices = 5; |
| 114 |
} |
| 115 |
|
| 116 |
message UsbDeviceProto { |
| 117 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 118 |
|
| 119 |
// Generic USB name, not user-provided. |
| 120 |
optional string name = 1; |
| 121 |
// ID specific to the vendor, not the device. |
| 122 |
optional int32 vendor_id = 2; |
| 123 |
// ID of this product type: Each vendor gives each product a unique ID. E.g. |
| 124 |
// all mice of the same model would have the same ID. |
| 125 |
optional int32 product_id = 3; |
| 126 |
optional int32 class = 4; |
| 127 |
optional int32 subclass = 5; |
| 128 |
optional int32 protocol = 6; |
| 129 |
optional string manufacturer_name = 7; |
| 130 |
optional string product_name = 8; |
| 131 |
optional string version = 9; |
| 132 |
// Non-resettable hardware ID. |
| 133 |
optional string serial_number = 10 [ (android.privacy).dest = DEST_LOCAL ]; |
| 134 |
repeated UsbConfigurationProto configurations = 11; |
| 135 |
} |
| 136 |
|
| 137 |
message UsbConfigurationProto { |
| 138 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 139 |
|
| 140 |
// A single USB device can have several configurations and the app accessing |
| 141 |
// the USB device can switch between them. At any time only one can be active. |
| 142 |
// Each configuration can present completely different interfaces end |
| 143 |
// endpoints, i.e. a completely different behavior. |
| 144 |
optional int32 id = 1; |
| 145 |
// Hardware-defined name, not set by the user. |
| 146 |
optional string name = 2; |
| 147 |
optional uint32 attributes = 3; |
| 148 |
optional int32 max_power = 4; |
| 149 |
repeated UsbInterfaceProto interfaces = 5; |
| 150 |
} |
| 151 |
|
| 152 |
message UsbInterfaceProto { |
| 153 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 154 |
|
| 155 |
// Hardware defined. This is the id used by the app to identify the interface. |
| 156 |
optional int32 id = 1; |
| 157 |
optional int32 alternate_settings = 2; |
| 158 |
optional string name = 3; |
| 159 |
optional int32 class = 4; |
| 160 |
optional int32 subclass = 5; |
| 161 |
optional int32 protocol = 6; |
| 162 |
repeated UsbEndPointProto endpoints = 7; |
| 163 |
} |
| 164 |
|
| 165 |
message UsbEndPointProto { |
| 166 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 167 |
|
| 168 |
optional int32 endpoint_number = 1; |
| 169 |
optional android.service.UsbEndPointDirection direction = 2; |
| 170 |
// The address of the endpoint. Needed to read and write to the endpoint. |
| 171 |
optional int32 address = 3; |
| 172 |
optional android.service.UsbEndPointType type = 4; |
| 173 |
optional uint32 attributes = 5; |
| 174 |
optional int32 max_packet_size = 6; |
| 175 |
optional int32 interval = 7; |
| 176 |
} |
| 177 |
|
| 178 |
message UsbConnectionRecordProto { |
| 179 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 180 |
|
| 181 |
// usb device's address, e.g. 001/002, nothing about the phone |
| 182 |
optional string device_address = 1; |
| 183 |
optional android.service.UsbConnectionRecordMode mode = 2; |
| 184 |
optional int64 timestamp = 3; |
| 185 |
optional int32 manufacturer = 4; |
| 186 |
optional int32 product = 5; |
| 187 |
optional UsbIsHeadsetProto is_headset = 6; |
| 188 |
} |
| 189 |
|
| 190 |
message UsbIsHeadsetProto { |
| 191 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 192 |
|
| 193 |
optional bool in = 1; |
| 194 |
optional bool out = 2; |
| 195 |
} |
| 196 |
|
| 197 |
message UsbPortManagerProto { |
| 198 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 199 |
|
| 200 |
enum HalVersion { |
| 201 |
V_UNKNOWN = 0; |
| 202 |
V1_0 = 10; |
| 203 |
V1_1 = 11; |
| 204 |
V1_2 = 12; |
| 205 |
V1_3 = 13; |
| 206 |
V2 = 20; |
| 207 |
} |
| 208 |
|
| 209 |
optional bool is_simulation_active = 1; |
| 210 |
repeated UsbPortInfoProto usb_ports = 2; |
| 211 |
optional bool enable_usb_data_signaling = 3; |
| 212 |
optional HalVersion hal_version = 4; |
| 213 |
} |
| 214 |
|
| 215 |
message UsbPortInfoProto { |
| 216 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 217 |
|
| 218 |
optional UsbPortProto port = 1; |
| 219 |
optional UsbPortStatusProto status = 2; |
| 220 |
optional bool can_change_mode = 3; |
| 221 |
optional bool can_change_power_role = 4; |
| 222 |
optional bool can_change_data_role = 5; |
| 223 |
optional int64 connected_at_millis = 6; |
| 224 |
optional int64 last_connect_duration_millis = 7; |
| 225 |
} |
| 226 |
|
| 227 |
message UsbPortProto { |
| 228 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 229 |
|
| 230 |
/* Same as android.hardware.usb.V1_1.Constants.PortMode_1_1 */ |
| 231 |
enum Mode { |
| 232 |
MODE_NONE = 0; |
| 233 |
MODE_UFP = 1; |
| 234 |
MODE_DFP = 2; |
| 235 |
MODE_DRP = 3; |
| 236 |
MODE_AUDIO_ACCESSORY = 4; |
| 237 |
MODE_DEBUG_ACCESSORY = 8; |
| 238 |
} |
| 239 |
|
| 240 |
// ID of the port. A device (eg: Chromebooks) might have multiple ports. |
| 241 |
optional string id = 1; |
| 242 |
repeated Mode supported_modes = 2; |
| 243 |
} |
| 244 |
|
| 245 |
message UsbPortStatusProto { |
| 246 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 247 |
|
| 248 |
/* Same as android.hardware.usb.V1_0.Constants.PortPowerRole */ |
| 249 |
enum PowerRole { |
| 250 |
POWER_ROLE_NONE = 0; |
| 251 |
POWER_ROLE_SOURCE = 1; |
| 252 |
POWER_ROLE_SINK = 2; |
| 253 |
} |
| 254 |
|
| 255 |
/* Same as android.hardware.usb.V1_0.Constants.PortDataRole */ |
| 256 |
enum DataRole { |
| 257 |
DATA_ROLE_NONE = 0; |
| 258 |
DATA_ROLE_HOST = 1; |
| 259 |
DATA_ROLE_DEVICE = 2; |
| 260 |
} |
| 261 |
|
| 262 |
optional bool connected = 1; |
| 263 |
optional UsbPortProto.Mode current_mode = 2; |
| 264 |
optional PowerRole power_role = 3; |
| 265 |
optional DataRole data_role = 4; |
| 266 |
repeated UsbPortStatusRoleCombinationProto role_combinations = 5; |
| 267 |
optional android.service.ContaminantPresenceStatus contaminant_presence_status = 6; |
| 268 |
optional string usb_data_status = 7; |
| 269 |
optional bool is_power_transfer_limited = 8; |
| 270 |
optional string usb_power_brick_status = 9; |
| 271 |
} |
| 272 |
|
| 273 |
message UsbPortStatusRoleCombinationProto { |
| 274 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 275 |
|
| 276 |
optional UsbPortStatusProto.PowerRole power_role = 1; |
| 277 |
optional UsbPortStatusProto.DataRole data_role = 2; |
| 278 |
} |
| 279 |
|
| 280 |
message UsbAlsaManagerProto { |
| 281 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 282 |
|
| 283 |
optional int32 cards_parser = 1; |
| 284 |
repeated UsbAlsaDeviceProto alsa_devices = 2; |
| 285 |
repeated UsbMidiDeviceProto midi_devices = 3; |
| 286 |
} |
| 287 |
|
| 288 |
message UsbAlsaDeviceProto { |
| 289 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 290 |
|
| 291 |
optional int32 card = 1; |
| 292 |
optional int32 device = 2; |
| 293 |
optional string name = 3; |
| 294 |
optional bool has_playback = 4; |
| 295 |
optional bool has_capture = 5; |
| 296 |
// usb device's address, e.g. 001/002, nothing about the phone |
| 297 |
optional string address = 6; |
| 298 |
} |
| 299 |
|
| 300 |
message UsbMidiDeviceProto { |
| 301 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 302 |
|
| 303 |
optional int32 card = 1; |
| 304 |
optional int32 device = 2; |
| 305 |
// usb device's address, e.g. 001/002, nothing about the phone |
| 306 |
optional string device_address = 3; |
| 307 |
} |
| 308 |
|
| 309 |
message UsbDirectMidiDeviceProto { |
| 310 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 311 |
|
| 312 |
optional int32 num_inputs = 1; |
| 313 |
optional int32 num_outputs = 2; |
| 314 |
optional bool is_universal = 3; |
| 315 |
optional string name = 4; |
| 316 |
optional UsbMidiBlockParserProto block_parser = 5; |
| 317 |
} |
| 318 |
|
| 319 |
message UsbMidiBlockParserProto { |
| 320 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 321 |
|
| 322 |
optional int32 length = 1; |
| 323 |
optional int32 descriptor_type = 2; |
| 324 |
optional int32 descriptor_subtype = 3; |
| 325 |
optional int32 total_length = 4; |
| 326 |
repeated UsbGroupTerminalBlockProto block = 5; |
| 327 |
} |
| 328 |
|
| 329 |
message UsbGroupTerminalBlockProto { |
| 330 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 331 |
|
| 332 |
optional int32 length = 1; |
| 333 |
optional int32 descriptor_type = 2; |
| 334 |
optional int32 descriptor_subtype = 3; |
| 335 |
optional int32 group_block_id = 4; |
| 336 |
optional int32 group_terminal_block_type = 5; |
| 337 |
optional int32 group_terminal = 6; |
| 338 |
optional int32 num_group_terminals = 7; |
| 339 |
optional int32 block_item = 8; |
| 340 |
optional int32 midi_protocol = 9; |
| 341 |
optional int32 max_input_bandwidth = 10; |
| 342 |
optional int32 max_output_bandwidth = 11; |
| 343 |
} |
| 344 |
|
| 345 |
message UsbSettingsManagerProto { |
| 346 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 347 |
|
| 348 |
repeated UsbUserSettingsManagerProto user_settings = 1; |
| 349 |
repeated UsbProfileGroupSettingsManagerProto profile_group_settings = 2; |
| 350 |
} |
| 351 |
|
| 352 |
message UsbUserSettingsManagerProto { |
| 353 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 354 |
|
| 355 |
optional int32 user_id = 1; |
| 356 |
reserved 2; // previously device_permissions, now unused |
| 357 |
reserved 3; // previously accessory_permissions, now unused |
| 358 |
repeated UsbDeviceAttachedActivities device_attached_activities = 4; |
| 359 |
repeated UsbAccessoryAttachedActivities accessory_attached_activities = 5; |
| 360 |
} |
| 361 |
|
| 362 |
message UsbProfileGroupSettingsManagerProto { |
| 363 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 364 |
|
| 365 |
// The user id of the personal profile if the device has a work profile. |
| 366 |
optional int32 parent_user_id = 1; |
| 367 |
repeated UsbSettingsDevicePreferenceProto device_preferences = 2; |
| 368 |
repeated UsbSettingsAccessoryPreferenceProto accessory_preferences = 3; |
| 369 |
optional string intent = 4; |
| 370 |
} |
| 371 |
|
| 372 |
message UsbSettingsDevicePreferenceProto { |
| 373 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 374 |
|
| 375 |
optional UsbDeviceFilterProto filter = 1; |
| 376 |
optional UserPackageProto user_package = 2; |
| 377 |
} |
| 378 |
|
| 379 |
message UsbPermissionsManagerProto { |
| 380 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 381 |
|
| 382 |
repeated UsbUserPermissionsManagerProto user_permissions = 1; |
| 383 |
} |
| 384 |
|
| 385 |
message UsbUserPermissionsManagerProto { |
| 386 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 387 |
|
| 388 |
optional int32 user_id = 1; |
| 389 |
|
| 390 |
repeated UsbDevicePermissionProto device_permissions = 2; |
| 391 |
repeated UsbAccessoryPermissionProto accessory_permissions = 3; |
| 392 |
|
| 393 |
repeated UsbDevicePersistentPermissionProto device_persistent_permissions = 4; |
| 394 |
repeated UsbAccessoryPersistentPermissionProto accessory_persistent_permissions = 5; |
| 395 |
} |
| 396 |
|
| 397 |
message UsbDevicePermissionProto { |
| 398 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 399 |
|
| 400 |
// Name of device set by manufacturer |
| 401 |
// All devices of the same model have the same name |
| 402 |
optional string device_name = 1; |
| 403 |
repeated int32 uids = 2; |
| 404 |
} |
| 405 |
|
| 406 |
message UsbAccessoryPermissionProto { |
| 407 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 408 |
|
| 409 |
// Description of accessory set by manufacturer |
| 410 |
// All accessories of the same model have the same description |
| 411 |
optional string accessory_description = 1; |
| 412 |
repeated int32 uids = 2; |
| 413 |
} |
| 414 |
|
| 415 |
message UsbDevicePersistentPermissionProto { |
| 416 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 417 |
|
| 418 |
optional UsbDeviceFilterProto device_filter = 1; |
| 419 |
repeated UsbUidPermissionProto permission_values = 2; |
| 420 |
} |
| 421 |
|
| 422 |
message UsbAccessoryPersistentPermissionProto { |
| 423 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 424 |
|
| 425 |
optional UsbAccessoryFilterProto accessory_filter = 1; |
| 426 |
repeated UsbUidPermissionProto permission_values = 2; |
| 427 |
} |
| 428 |
|
| 429 |
message UsbUidPermissionProto { |
| 430 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 431 |
|
| 432 |
optional int32 uid = 1; |
| 433 |
optional bool is_granted = 2; |
| 434 |
} |
| 435 |
|
| 436 |
message UsbDeviceFilterProto { |
| 437 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 438 |
|
| 439 |
// Mirrors the vendor_id of UsbDeviceProto. |
| 440 |
optional int32 vendor_id = 1; |
| 441 |
optional int32 product_id = 2; |
| 442 |
optional int32 class = 3; |
| 443 |
optional int32 subclass = 4; |
| 444 |
optional int32 protocol = 5; |
| 445 |
optional string manufacturer_name = 6; |
| 446 |
optional string product_name = 7; |
| 447 |
optional string serial_number = 8 [ (android.privacy).dest = DEST_EXPLICIT ]; |
| 448 |
} |
| 449 |
|
| 450 |
message UserPackageProto { |
| 451 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 452 |
|
| 453 |
optional int32 user_id = 1; |
| 454 |
optional string package_name =2; |
| 455 |
} |
| 456 |
|
| 457 |
message UsbSettingsAccessoryPreferenceProto { |
| 458 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 459 |
|
| 460 |
optional UsbAccessoryFilterProto filter = 1; |
| 461 |
optional UserPackageProto user_package = 2; |
| 462 |
} |
| 463 |
|
| 464 |
message UsbAccessoryFilterProto { |
| 465 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 466 |
|
| 467 |
optional string manufacturer = 1; |
| 468 |
optional string model = 2; |
| 469 |
optional string version = 3; |
| 470 |
} |
| 471 |
|
| 472 |
message UsbDeviceAttachedActivities { |
| 473 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 474 |
|
| 475 |
optional android.content.ComponentNameProto activity = 1; |
| 476 |
repeated UsbDeviceFilterProto filters = 2; |
| 477 |
} |
| 478 |
|
| 479 |
message UsbAccessoryAttachedActivities { |
| 480 |
option (android.msg_privacy).dest = DEST_AUTOMATIC; |
| 481 |
|
| 482 |
optional android.content.ComponentNameProto activity = 1; |
| 483 |
repeated UsbAccessoryFilterProto filters = 2; |
| 484 |
} |