1// Copyright 2016 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto2"; 16 17package android.vts; 18option java_package = "com.android.vts.proto"; 19option java_outer_classname = "VtsComponentSpecificationMessage"; 20 21// Class of a target component. 22enum ComponentClass { 23 UNKNOWN_CLASS = 0; 24 // For a HAL shared library. Deprecated. 25 HAL_CONVENTIONAL = 1; 26 // For a submodule of a shared library HAL. Deprecated. 27 HAL_CONVENTIONAL_SUBMODULE = 2; 28 // For a legacy HAL. Deprecated. 29 HAL_LEGACY = 3; 30 // For a HAL which uses HIDL (HAL Interface Definition Language). 31 HAL_HIDL = 4; 32 // For a HAL which uses HIDL (HAL Interface Definition Language). 33 HAL_HIDL_WRAPPED_CONVENTIONAL = 5; 34 35 // For a shared library which is not a HAL (e.g., standard library). 36 LIB_SHARED = 11; 37 38 // For an OS kernel. 39 KERNEL = 21; 40 // For an OS kernel module. 41 KERNEL_MODULE = 22; 42} 43 44 45// Type of a target component. 46enum ComponentType { 47 UNKNOWN_TYPE = 0; 48 // For an audio submodule. 49 AUDIO = 1; 50 // For a camera submodule. 51 CAMERA = 2; 52 // For a GPS submodule. 53 GPS = 3; 54 // For a Lights sensor submodule. 55 LIGHT = 4; 56 // For a WiFi submodule. 57 WIFI = 5; 58 // For a mobile networking submodule. 59 MOBILE = 6; 60 // For a WiFi submodule. 61 BLUETOOTH = 7; 62 // For a NFC submodule. 63 NFC = 8; 64 // For a power HAL. 65 POWER = 9; 66 // For a mem track HAL. 67 MEMTRACK = 10; 68 // For a biometrics fingerprint HAL. 69 BFP = 11; 70 // For a vibrator submodule. 71 VIBRATOR = 12; 72 // For a thermal submodule. 73 THERMAL = 13; 74 // For a tv_input HAL. 75 TV_INPUT = 14; 76 // For a tv hdmi_cec submodule 77 TV_CEC = 15; 78 // For sensors submodule 79 SENSORS = 16; 80 // For a vehicle submodule 81 VEHICLE = 17; 82 // For a VR submodule. 83 VR = 18; 84 // For a graphics allocator submodule. 85 GRAPHICS_ALLOCATOR = 19; 86 // For a graphics mapper submodule. 87 GRAPHICS_MAPPER = 20; 88 // For a radio submodule 89 RADIO = 21; 90 // For the context hub HAL. 91 CONTEXTHUB = 22; 92 // For a graphics composer submodule. 93 GRAPHICS_COMPOSER = 23; 94 // For a media omx submodule. 95 MEDIA_OMX = 24; 96 // For msgq test HAL. 97 TESTS_MSGQ = 25; 98 // For memory test HAL. 99 TESTS_MEMORY = 26; 100 // For dumpstate HAL (a lazy HAL, for debugging). 101 DUMPSTATE = 27; 102 103 // for bionic's libm 104 BIONIC_LIBM = 1001; 105 106 // for bionic's libc 107 BIONIC_LIBC = 1002; 108 109 // for VNDK's libcutils 110 VNDK_LIBCUTILS = 1101; 111 112 // for OS kernel's system call. 113 SYSCALL = 2001; 114} 115 116 117// Type of a variable. 118enum VariableType { 119 UNKNOWN_VARIABLE_TYPE = 0; 120 TYPE_PREDEFINED = 1; 121 TYPE_SCALAR = 2; 122 TYPE_STRING = 3; 123 TYPE_ENUM = 4; 124 TYPE_ARRAY = 5; 125 TYPE_VECTOR = 6; 126 TYPE_STRUCT = 7; 127 // for conventional HALs, to keep a data structure with one or multiple 128 // callback functions. 129 TYPE_FUNCTION_POINTER = 8; 130 TYPE_VOID = 9; 131 TYPE_HIDL_CALLBACK = 10; 132 TYPE_SUBMODULE = 11; 133 TYPE_UNION = 12; 134 TYPE_HIDL_INTERFACE = 13; 135 TYPE_HANDLE = 14; 136 // for an enum whose every enumerator value is a number which is power of 2. 137 TYPE_MASK = 15; 138 // for hidl_memory type 139 TYPE_HIDL_MEMORY = 16; 140 // for pointer type 141 TYPE_POINTER = 17; 142 // for FMQ types 143 TYPE_FMQ_SYNC = 18; 144 TYPE_FMQ_UNSYNC = 19; 145 // for HIDL ref<>, a restricted native pointer type. 146 TYPE_REF = 20; 147 // similar to TYPE_UNION, but support runtime type check. 148 TYPE_SAFE_UNION = 21; 149} 150 151 152// Type of a target processor architecture. 153enum TargetArch { 154 UNKNOWN_TARGET_ARCH = 0; 155 TARGET_ARCH_ARM = 1; 156 TARGET_ARCH_ARM64 = 2; 157} 158 159 160// To specify a call flow event. 161message CallFlowSpecificationMessage { 162 // true if for a function call event. 163 optional bool entry = 1 [default = false]; 164 // true if for an exit event from a function. 165 optional bool exit = 2 [default = false]; 166 // a list of functions that can be called right after this event. 167 repeated bytes next = 11; 168 // a list of functions that can be called right before this event. 169 repeated bytes prev = 12; 170} 171 172 173// To specify the measured native code coverage raw data. 174message NativeCodeCoverageRawDataMessage { 175 // gcno file path. 176 optional bytes file_path = 1; 177 178 // content of a gcda file. 179 optional bytes gcda = 11; 180} 181 182 183// To specify an API call to an interface. 184message FunctionCallMessage { 185 // Name of the interface. Not required if hal_driver_id is set. 186 // Currently only used by fuzzer. 187 optional bytes hidl_interface_name = 1; 188 189 // HAL driver ID, if set (e.g., >0), use the given driver_id to get the 190 // corresponding driver instance; otherwise, create a new driver based 191 // on the component info (package, version etc.) 192 optional int32 hal_driver_id = 11 [default = -1]; 193 194 // Component class, e.g., HIDL HAL or Conventional HAL. 195 optional ComponentClass component_class = 21; 196 // Component type, e.g., BLUETOOTH, used for Conventional HAL only. 197 optional ComponentType component_type = 22; 198 // Component version (e.g., 1.0). 199 // Deprecated, use component_type_version_major and component_type_version_minor instead. 200 optional bytes component_type_version = 23 [deprecated = true]; 201 // Component name (e.g., INfc), used for HIDL HALs only. 202 optional bytes component_name = 24; 203 // Component package name (e.g., android.hardware.nfc). 204 optional bytes package_name = 25; 205 // Component major and minor versions stored separately. 206 // HAL major version of component (e.g. 1.0 -> 1). 207 optional int32 component_type_version_major = 26 [default = -1]; 208 // HAL minor version of component (e.g. 1.0 -> 0). 209 optional int32 component_type_version_minor = 27 [default = -1]; 210 211 // Specifies API function and inputs. 212 optional FunctionSpecificationMessage api = 100; 213} 214 215// To specify a function. 216message FunctionSpecificationMessage { 217 // the function name. 218 optional bytes name = 1; 219 220 // the submodule name. 221 optional bytes submodule_name = 2; 222 223 // the HIDL interface ID used to call an API of another nested interface 224 // using a VTS HAL driver (for HIDL HAL). 0 for the main interface. 225 optional int32 hidl_interface_id = 3; 226 227 // whether the function is inherited from another class. 228 optional bool is_inherited = 4; 229 230 // data type of the return value (for legacy HALs and shared libraries). 231 optional VariableSpecificationMessage return_type = 11; 232 233 // data type of the return value (for HIDL HALs). 234 repeated VariableSpecificationMessage return_type_hidl = 12; 235 236 // used to pass the spec of a found HAL_CONVENTIONAL_SUBMODULE to the host. 237 optional ComponentSpecificationMessage return_type_submodule_spec = 13; 238 239 // a list of arguments. 240 repeated VariableSpecificationMessage arg = 21; 241 242 // hidl annotation fields { 243 244 // a specification of the call flows of the function. 245 repeated CallFlowSpecificationMessage callflow = 31; 246 // if true, will not be fuzz tested. 247 optional bool do_not_fuzz = 32 [default = false]; 248 249 // } hidl annotation fields 250 251 // whether it is a callback. 252 optional bool is_callback = 41 [deprecated = true]; 253 254 // when it is a callback. 255 optional FunctionPointerSpecificationMessage function_pointer = 42; 256 257 // profiling data. 258 repeated float profiling_data = 101; 259 260 // measured processed coverage data. 261 repeated uint32 processed_coverage_data = 201; 262 263 // measured raw coverage data. 264 repeated NativeCodeCoverageRawDataMessage raw_coverage_data = 202; 265 266 // not a user-provided variable. used by the frameworks to tell the sub 267 // struct hierarchy. 268 optional bytes parent_path = 301; 269 270 // to specify a syscall number. 271 optional uint32 syscall_number = 401; 272} 273 274 275// To keep the value of a scalar variable. 276message ScalarDataValueMessage { 277 optional bool bool_t = 1; 278 279 optional int32 int8_t = 11; 280 optional uint32 uint8_t = 12; 281 282 optional int32 char = 13; 283 optional uint32 uchar = 14; 284 285 optional int32 int16_t = 21; 286 optional uint32 uint16_t = 22; 287 288 optional int32 int32_t = 31; 289 optional uint32 uint32_t = 32; 290 291 optional int64 int64_t = 41; 292 optional uint64 uint64_t = 42; 293 294 optional float float_t = 101; 295 optional double double_t = 102; 296 297 optional uint32 pointer = 201; 298 optional uint32 opaque = 202; 299 optional uint32 void_pointer = 211; 300 optional uint32 char_pointer = 212; 301 optional uint32 uchar_pointer = 213; 302 optional uint32 pointer_pointer = 251; 303} 304 305 306// To keep the specification and value of a function pointer. 307message FunctionPointerSpecificationMessage { 308 // used for a function pointer to keep its function name. 309 optional bytes function_name = 1; 310 311 // actual pointer value. 312 optional uint32 address = 11; 313 // ID used for VTS RMI (remote method invocation). 314 optional bytes id = 21; 315 316 // argument(s) 317 repeated VariableSpecificationMessage arg = 101; 318 319 // data type of the return value (for legacy HALs and shared libraries). 320 optional VariableSpecificationMessage return_type = 111; 321} 322 323 324// To keep the value of a string variable. 325message StringDataValueMessage { 326 // for actual contents. 327 optional bytes message = 1; 328 329 // for length in bytes, and usually not required. 330 optional uint32 length = 11; 331} 332 333 334// To keep the value of an enum type variable. 335message EnumDataValueMessage { 336 // for the enumerator names. 337 repeated bytes enumerator = 1; 338 339 // for the corresponding values. 340 repeated ScalarDataValueMessage scalar_value = 2; 341 optional bytes scalar_type = 3; 342} 343 344// To keep the value of a memory variable. 345message MemoryDataValueMessage { 346 optional int64 size = 1; 347 optional bytes contents = 2; 348 // To identify an existing hidl_memory object stored in resource_manager. 349 optional int32 mem_id = 3 [default = -1]; 350 // To record the pointer address of hidl_memory object. 351 // We use uint64 to represent the address of the hidl_memory pointer, 352 // which allows vtsc to reinterpret the address when caller wants to use 353 // an existing hidl_memory object stored in resource_manager. 354 // This field is updated by driver_manager when the hidl_memory address 355 // is found in memory. 356 optional uint64 hidl_mem_address = 4; 357} 358 359// Type of a file descriptor. 360enum FdType { 361 FILE_TYPE = 1; 362 DIR_TYPE = 2; 363 DEV_TYPE = 3; 364 PIPE_TYPE = 4; 365 SOCKET_TYPE = 5; 366 LINK_TYPE = 6; 367} 368 369// To keep the value of a file-descriptor. 370message FdMessage { 371 optional FdType type = 1; 372 optional uint32 mode = 2; 373 optional int32 flags = 3; 374 optional bytes file_name = 4; 375 // When opening a file in host side, user specifies file 376 // access mode in string. 377 optional bytes file_mode_str = 5; 378 // For shared memory. 379 optional MemoryDataValueMessage memory = 6; 380} 381 382// To keep the value of a handle variable. 383message HandleDataValueMessage { 384 // sizeof(native_handle_t) 385 optional int32 version = 1; 386 // number of file-descriptors. 387 optional int32 num_fds = 2; 388 // number of ints. 389 optional int32 num_ints = 3; 390 // file-descriptor values. 391 repeated FdMessage fd_val = 4; 392 // ints values 393 repeated int32 int_val = 5; 394 // To specify an existing handle object registered in target-side driver. 395 // If host side specifies this field, HIDL function calls will retrieve 396 // the handle object from target-side driver, instead of creating a new one. 397 optional int32 handle_id = 6 [default = -1]; 398 // To record the pointer address of hidl_handle object. 399 // We use uint64 to represent the address of the hidl_handle pointer, 400 // which allows vtsc to reinterpret the address when caller wants to use 401 // an existing hidl_handle object stored in target-side driver. 402 // This field is updated by driver_manager when the hidl_handle address 403 // is found in memory. 404 optional uint64 hidl_handle_address = 7; 405} 406 407// To specify a function argument or an attribute in general. 408message VariableSpecificationMessage { 409 // the variable name. empty if for a type definition. 410 optional bytes name = 1; 411 412 // the variable type which is one of: 413 // TYPE_SCALAR, TYPE_STRING, TYPE_ENUM, TYPE_ARRAY, 414 // TYPE_VECTOR, TYPE_STRUCT, TYPE_UNION, TYPE_HIDL_CALLBACK, 415 // TYPE_HIDL_INTERFACE, TYPE_HANDLE 416 // 417 // not yet supported: 418 // "template", "typedef", "binder", "parcelable". 419 optional VariableType type = 2; 420 421 // the actual value(s) for an scalar data type. 422 // repeated values for a vector. 423 optional ScalarDataValueMessage scalar_value = 101; 424 optional bytes scalar_type = 102; 425 426 optional StringDataValueMessage string_value = 111; 427 428 // for the definition of enum type only. 429 // The value of an eunm variable is stored in scalar_value message. 430 optional EnumDataValueMessage enum_value = 121; 431 432 // for both TYPE_ARRAY (using size field) and TYPE_VECTOR. 433 repeated VariableSpecificationMessage vector_value = 131; 434 // Length of an array. Also used for TYPE_VECTOR at runtime. 435 optional int32 vector_size = 132; 436 437 // for sub variables when this's a struct type. 438 repeated VariableSpecificationMessage struct_value = 141; 439 // the type name of this struct. 440 optional bytes struct_type = 142; 441 442 // for nested struct type declarations (without actual definitions). 443 repeated VariableSpecificationMessage sub_struct = 143; 444 445 // for sub variables when this's a union type. 446 repeated VariableSpecificationMessage union_value = 151; 447 // the type name of this union. 448 optional bytes union_type = 152; 449 450 // for nested union type declarations (without actual definitions). 451 repeated VariableSpecificationMessage sub_union = 153; 452 453 // for sub variables when this's a safe_union type. 454 repeated VariableSpecificationMessage safe_union_value = 154; 455 456 // the runtime type used in the safe union. 457 optional VariableType safe_union_type = 155; 458 459 // for nested safe_union type declarations. 460 repeated VariableSpecificationMessage sub_safe_union = 156; 461 462 // for the definition/value of TYPE_FMQ_SYNC and TYPE_FMQ_UNSYNC. 463 repeated VariableSpecificationMessage fmq_value = 161; 464 // for queue identifier of TYPE_FMQ_SYNC and TYPE_FMQ_UNSYNC, 465 // when caller wants to use an existing FMQ. 466 optional int32 fmq_id = 162 [default = -1]; 467 // descriptor of an existing queue. 468 // The descriptor can be passed in hidl and be used to create new 469 // FMQ objects. We use uint64 to represent the address of the descriptor, 470 // which allows vtsc to reinterpret the address when callers wants to use 471 // an existing FMQ. 472 // This field is updated by driver_manager when the descriptor of 473 // an queue object is located in memory. 474 optional uint64 fmq_desc_address = 163; 475 476 // for TYPE_REF. 477 optional VariableSpecificationMessage ref_value = 171; 478 479 // for TYPE_HIDL_MEMROY. 480 optional MemoryDataValueMessage hidl_memory_value =172; 481 482 // for TYPE_HANDLE. 483 optional HandleDataValueMessage handle_value =181; 484 485 // for non HIDL HAL, to use a custom type defined in C/C++. 486 optional bytes predefined_type = 201; 487 488 // for non HIDL HAL, to set function pointer(s). 489 repeated FunctionPointerSpecificationMessage function_pointer = 221; 490 491 // for HIDL HAL, to use a HIDL callback instance. 492 optional bytes hidl_callback_type = 231; 493 494 // for HIDL HAL, to specify the HIDL_INTERFACE ID. ID is used between 495 // a VTS driver and other modules (e.g., agent and host-side module). 496 optional int32 hidl_interface_id = 241; 497 498 // for HIDL HAL, to specify an HIDL interface's client proxy object's 499 // pointer value. Passed from a DriverBase instance to the VTS HAL driver 500 // framework as a return value of its CallFunction() method. Another use 501 // case is when this variable is passed to a DriverBase instance from the 502 // VTS HAL driver framework which can get this value from another 503 // (potentially nested or main) DriverBase instance. 504 optional uint64 hidl_interface_pointer = 242; 505 506 // true if the argument is an input (valid only for the top-level message). 507 optional bool is_input = 301 [default = true]; 508 // true if the argument is an output. 509 optional bool is_output = 302 [default = false]; 510 // true if the argument is a constant variable. 511 optional bool is_const = 303 [default = false]; 512 // true if the argument is a struct with one or multiple function pointers. 513 optional bool is_callback = 304 [default = false]; 514} 515 516 517// To specify a sub-structure. 518message StructSpecificationMessage { 519 // the sub-structure's variable name in its parent data structure. 520 optional bytes name = 1; 521 522 // whether itself a pointer varaible in its parent data structure. 523 optional bool is_pointer = 2 [default = false]; 524 525 // a list of functions contained in the struct. 526 repeated FunctionSpecificationMessage api = 1001; 527 528 // a list of structures contained in the component. 529 repeated StructSpecificationMessage sub_struct = 2001; 530 531 // The definitions of custom-defined aggregate types. 532 repeated VariableSpecificationMessage attribute = 3001; 533} 534 535 536// To specify an interface of a component 537message InterfaceSpecificationMessage { 538 // whether this interface is a HIDL callback. 539 optional bool is_hidl_callback = 101 [default = false]; 540 541 // a list of functions exposed by the component. 542 repeated FunctionSpecificationMessage api = 2001; 543 544 // The definitions of custom-defined aggregate types. 545 repeated VariableSpecificationMessage attribute = 3001; 546 547 // a list of structures contained in the component. 548 repeated StructSpecificationMessage sub_struct = 4001; 549} 550 551 552// To specify a module (which is logically equivalent to a .hal file in case 553// of a HIDL HAL). 554message ComponentSpecificationMessage { 555 // Class, type, and version of a target component. 556 optional ComponentClass component_class = 1; 557 optional ComponentType component_type = 2; 558 // component HAL version (e.g. 1.0). 559 // Deprecated, use component_type_version_major and component_type_version_minor instead. 560 optional float component_type_version = 3 [deprecated = true]; 561 562 // The name of a target component (used for HIDL HALs). 563 optional bytes component_name = 4; 564 565 // for the target processor architecture. 566 optional TargetArch target_arch = 5; 567 568 // use two ints to represent major and minor versions separately. 569 // HAL major version of component (e.g. 1.0 -> 1). 570 optional int32 component_type_version_major = 6 [default = -1]; 571 // HAL minor version of component (e.g. 1.0 -> 0). 572 optional int32 component_type_version_minor = 7 [default = -1]; 573 574 // The package path of a target component (e.g., android.hardware.name). 575 // name implies the component_type field. 576 optional bytes package = 11; 577 578 // The modules to import (e.g., package_path.component_name). 579 repeated bytes import = 12; 580 581 // The name of original C/C++ data structure 582 // (used for conventional and legacy HALs). 583 optional bytes original_data_structure_name = 1001; 584 585 // a list of headers that need to be imported in order to use the component. 586 repeated bytes header = 1002; 587 588 // For a .hal file which actually defines an interface. 589 optional InterfaceSpecificationMessage interface = 2001; 590 591 // For a .hal file which does not defines an interface (e.g., types.hal). 592 repeated VariableSpecificationMessage attribute = 2101; 593} 594