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 17syntax = "proto2"; 18package android.service.usb; 19 20option java_multiple_files = true; 21option java_outer_classname = "UsbServiceProto"; 22 23import "frameworks/base/core/proto/android/content/component_name.proto"; 24import "frameworks/base/core/proto/android/service/enums.proto"; 25import "frameworks/base/libs/incident/proto/android/privacy.proto"; 26 27message 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} 36 37message UsbDeviceManagerProto { 38 option (android.msg_privacy).dest = DEST_AUTOMATIC; 39 40 optional UsbHandlerProto handler = 1; 41 optional UsbDebuggingManagerProto debugging_manager = 2; 42} 43 44message UsbHandlerProto { 45 option (android.msg_privacy).dest = DEST_AUTOMATIC; 46 47 /* Same as android.hardware.usb.gadget.V1_0.GadgetFunction.* */ 48 enum Function { 49 FUNCTION_ADB = 1; 50 FUNCTION_ACCESSORY = 2; 51 FUNCTION_MTP = 4; 52 FUNCTION_MIDI = 8; 53 FUNCTION_PTP = 16; 54 FUNCTION_RNDIS = 32; 55 FUNCTION_AUDIO_SOURCE = 64; 56 } 57 58 repeated Function current_functions = 1; 59 optional bool current_functions_applied = 2; 60 repeated Function screen_unlocked_functions = 3; 61 optional bool screen_locked = 4; 62 optional bool connected = 5; 63 optional bool configured = 6; 64 optional UsbAccessoryProto current_accessory = 7; 65 optional bool host_connected = 8; 66 optional bool source_power = 9; 67 optional bool sink_power = 10; 68 optional bool usb_charging = 11; 69 optional bool hide_usb_notification = 12; 70 optional bool audio_accessory_connected = 13; 71 optional bool adb_enabled = 14; 72 optional string kernel_state = 15; 73 optional string kernel_function_list = 16; 74} 75 76message UsbAccessoryProto { 77 option (android.msg_privacy).dest = DEST_AUTOMATIC; 78 79 optional string manufacturer = 1; 80 optional string model = 2; 81 optional string description = 3; 82 optional string version = 4; 83 optional string uri = 5 [ (android.privacy).dest = DEST_EXPLICIT ]; 84 optional string serial = 6 [ (android.privacy).dest = DEST_EXPLICIT ]; 85} 86 87message UsbDebuggingManagerProto { 88 option (android.msg_privacy).dest = DEST_AUTOMATIC; 89 90 optional bool connected_to_adb = 1; 91 optional string last_key_received = 2 [ (android.privacy).dest = DEST_EXPLICIT ]; 92 optional string user_keys = 3 [ (android.privacy).dest = DEST_LOCAL ]; 93 optional string system_keys = 4 [ (android.privacy).dest = DEST_LOCAL ]; 94} 95 96message UsbHostManagerProto { 97 option (android.msg_privacy).dest = DEST_AUTOMATIC; 98 99 optional android.content.ComponentNameProto default_usb_host_connection_handler = 1; 100 repeated UsbDeviceProto devices = 2; 101 optional int32 num_connects = 3; 102 repeated UsbConnectionRecordProto connections = 4; 103} 104 105message UsbDeviceProto { 106 option (android.msg_privacy).dest = DEST_AUTOMATIC; 107 108 optional string name = 1; 109 optional int32 vendor_id = 2; 110 optional int32 product_id = 3; 111 optional int32 class = 4; 112 optional int32 subclass = 5; 113 optional int32 protocol = 6; 114 optional string manufacturer_name = 7; 115 optional string product_name = 8; 116 optional string version = 9; 117 optional string serial_number = 10 [ (android.privacy).dest = DEST_EXPLICIT ]; 118 repeated UsbConfigurationProto configurations = 11; 119} 120 121message UsbConfigurationProto { 122 option (android.msg_privacy).dest = DEST_AUTOMATIC; 123 124 optional int32 id = 1; 125 optional string name = 2; 126 optional uint32 attributes = 3; 127 optional int32 max_power = 4; 128 repeated UsbInterfaceProto interfaces = 5; 129} 130 131message UsbInterfaceProto { 132 option (android.msg_privacy).dest = DEST_AUTOMATIC; 133 134 optional int32 id = 1; 135 optional int32 alternate_settings = 2; 136 optional string name = 3; 137 optional int32 class = 4; 138 optional int32 subclass = 5; 139 optional int32 protocol = 6; 140 repeated UsbEndPointProto endpoints = 7; 141} 142 143message UsbEndPointProto { 144 option (android.msg_privacy).dest = DEST_AUTOMATIC; 145 146 optional int32 endpoint_number = 1; 147 optional android.service.UsbEndPointDirection direction = 2; 148 optional int32 address = 3; 149 optional android.service.UsbEndPointType type = 4; 150 optional uint32 attributes = 5; 151 optional int32 max_packet_size = 6; 152 optional int32 interval = 7; 153} 154 155message UsbConnectionRecordProto { 156 option (android.msg_privacy).dest = DEST_AUTOMATIC; 157 158 // usb device's address, e.g. 001/002, nothing about the phone 159 optional string device_address = 1; 160 optional android.service.UsbConnectionRecordMode mode = 2; 161 optional int64 timestamp = 3; 162 optional int32 manufacturer = 4; 163 optional int32 product = 5; 164 optional UsbIsHeadsetProto is_headset = 6; 165} 166 167message UsbIsHeadsetProto { 168 option (android.msg_privacy).dest = DEST_AUTOMATIC; 169 170 optional bool in = 1; 171 optional bool out = 2; 172} 173 174message UsbPortManagerProto { 175 option (android.msg_privacy).dest = DEST_AUTOMATIC; 176 177 optional bool is_simulation_active = 1; 178 repeated UsbPortInfoProto usb_ports = 2; 179} 180 181message UsbPortInfoProto { 182 option (android.msg_privacy).dest = DEST_AUTOMATIC; 183 184 optional UsbPortProto port = 1; 185 optional UsbPortStatusProto status = 2; 186 optional bool can_change_mode = 3; 187 optional bool can_change_power_role = 4; 188 optional bool can_change_data_role = 5; 189} 190 191message UsbPortProto { 192 option (android.msg_privacy).dest = DEST_AUTOMATIC; 193 194 /* Same as android.hardware.usb.V1_1.Constants.PortMode_1_1 */ 195 enum Mode { 196 MODE_NONE = 0; 197 MODE_UFP = 1; 198 MODE_DFP = 2; 199 MODE_DRP = 3; 200 MODE_AUDIO_ACCESSORY = 4; 201 MODE_DEBUG_ACCESSORY = 8; 202 } 203 204 optional string id = 1; 205 repeated Mode supported_modes = 2; 206} 207 208message UsbPortStatusProto { 209 option (android.msg_privacy).dest = DEST_AUTOMATIC; 210 211 /* Same as android.hardware.usb.V1_0.Constants.PortPowerRole */ 212 enum PowerRole { 213 POWER_ROLE_NONE = 0; 214 POWER_ROLE_SOURCE = 1; 215 POWER_ROLE_SINK = 2; 216 } 217 218 /* Same as android.hardware.usb.V1_0.Constants.PortDataRole */ 219 enum DataRole { 220 DATA_ROLE_NONE = 0; 221 DATA_ROLE_HOST = 1; 222 DATA_ROLE_DEVICE = 2; 223 } 224 225 optional bool connected = 1; 226 optional UsbPortProto.Mode current_mode = 2; 227 optional PowerRole power_role = 3; 228 optional DataRole data_role = 4; 229 repeated UsbPortStatusRoleCombinationProto role_combinations = 5; 230} 231 232message UsbPortStatusRoleCombinationProto { 233 option (android.msg_privacy).dest = DEST_AUTOMATIC; 234 235 optional UsbPortStatusProto.PowerRole power_role = 1; 236 optional UsbPortStatusProto.DataRole data_role = 2; 237} 238 239message UsbAlsaManagerProto { 240 option (android.msg_privacy).dest = DEST_AUTOMATIC; 241 242 optional int32 cards_parser = 1; 243 repeated UsbAlsaDeviceProto alsa_devices = 2; 244 repeated UsbMidiDeviceProto midi_devices = 3; 245} 246 247message UsbAlsaDeviceProto { 248 option (android.msg_privacy).dest = DEST_AUTOMATIC; 249 250 optional int32 card = 1; 251 optional int32 device = 2; 252 optional string name = 3; 253 optional bool has_playback = 4; 254 optional bool has_capture = 5; 255 // usb device's address, e.g. 001/002, nothing about the phone 256 optional string address = 6; 257} 258 259message UsbMidiDeviceProto { 260 option (android.msg_privacy).dest = DEST_AUTOMATIC; 261 262 optional int32 card = 1; 263 optional int32 device = 2; 264 // usb device's address, e.g. 001/002, nothing about the phone 265 optional string device_address = 3; 266} 267 268message UsbSettingsManagerProto { 269 option (android.msg_privacy).dest = DEST_AUTOMATIC; 270 271 repeated UsbUserSettingsManagerProto user_settings = 1; 272 repeated UsbProfileGroupSettingsManagerProto profile_group_settings = 2; 273} 274 275message UsbUserSettingsManagerProto { 276 option (android.msg_privacy).dest = DEST_AUTOMATIC; 277 278 optional int32 user_id = 1; 279 repeated UsbSettingsDevicePermissionProto device_permissions = 2; 280 repeated UsbSettingsAccessoryPermissionProto accessory_permissions = 3; 281} 282 283message UsbSettingsDevicePermissionProto { 284 option (android.msg_privacy).dest = DEST_AUTOMATIC; 285 286 optional string device_name = 1; 287 repeated int32 uids = 2; 288} 289 290message UsbSettingsAccessoryPermissionProto { 291 option (android.msg_privacy).dest = DEST_AUTOMATIC; 292 293 optional string accessory_description = 1; 294 repeated int32 uids = 2; 295} 296 297message UsbProfileGroupSettingsManagerProto { 298 option (android.msg_privacy).dest = DEST_AUTOMATIC; 299 300 optional int32 parent_user_id = 1; 301 repeated UsbSettingsDevicePreferenceProto device_preferences = 2; 302 repeated UsbSettingsAccessoryPreferenceProto accessory_preferences = 3; 303} 304 305message UsbSettingsDevicePreferenceProto { 306 option (android.msg_privacy).dest = DEST_AUTOMATIC; 307 308 optional UsbDeviceFilterProto filter = 1; 309 optional UserPackageProto user_package = 2; 310} 311 312message UsbDeviceFilterProto { 313 option (android.msg_privacy).dest = DEST_AUTOMATIC; 314 315 optional int32 vendor_id = 1; 316 optional int32 product_id = 2; 317 optional int32 class = 3; 318 optional int32 subclass = 4; 319 optional int32 protocol = 5; 320 optional string manufacturer_name = 6; 321 optional string product_name = 7; 322 optional string serial_number = 8 [ (android.privacy).dest = DEST_EXPLICIT ]; 323} 324 325message UserPackageProto { 326 option (android.msg_privacy).dest = DEST_AUTOMATIC; 327 328 optional int32 user_id = 1; 329 optional string package_name =2; 330} 331 332message UsbSettingsAccessoryPreferenceProto { 333 option (android.msg_privacy).dest = DEST_AUTOMATIC; 334 335 optional UsbAccessoryFilterProto filter = 1; 336 optional UserPackageProto user_package = 2; 337} 338 339message UsbAccessoryFilterProto { 340 option (android.msg_privacy).dest = DEST_AUTOMATIC; 341 342 optional string manufacturer = 1; 343 optional string model = 2; 344 optional string version = 3; 345} 346