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. 25 HAL_CONVENTIONAL = 1; 26 // For a submodule of a shared library HAL . 27 HAL_CONVENTIONAL_SUBMODULE = 2; 28 // For a legacy HAL. 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 97 // for bionic's libm 98 BIONIC_LIBM = 1001; 99 100 // for bionic's libc 101 BIONIC_LIBC = 1002; 102 103 // for VNDK's libcutils 104 VNDK_LIBCUTILS = 1101; 105 106 // for OS kernel's system call. 107 SYSCALL = 2001; 108} 109 110 111// Type of a variable. 112enum VariableType { 113 UNKNOWN_VARIABLE_TYPE = 0; 114 TYPE_PREDEFINED = 1; 115 TYPE_SCALAR = 2; 116 TYPE_STRING = 3; 117 TYPE_ENUM = 4; 118 TYPE_ARRAY = 5; 119 TYPE_VECTOR = 6; 120 TYPE_STRUCT = 7; 121 // for conventional HALs, to keep a data structure with one or multiple 122 // callback functions. 123 TYPE_FUNCTION_POINTER = 8; 124 TYPE_VOID = 9; 125 TYPE_HIDL_CALLBACK = 10; 126 TYPE_SUBMODULE = 11; 127 TYPE_UNION = 12; 128 TYPE_HIDL_INTERFACE = 13; 129 TYPE_HANDLE = 14; 130 // for an enum whose every enumerator value is a number which is power of 2. 131 TYPE_MASK = 15; 132 // for hidl_memory type 133 TYPE_HIDL_MEMORY = 16; 134 // for pointer type 135 TYPE_POINTER = 17; 136 // for FMQ types 137 TYPE_FMQ_SYNC = 18; 138 TYPE_FMQ_UNSYNC = 19; 139 // for HIDL ref<>, a restricted native pointer type. 140 TYPE_REF = 20; 141} 142 143 144// Type of a target processor architecture. 145enum TargetArch { 146 UNKNOWN_TARGET_ARCH = 0; 147 TARGET_ARCH_ARM = 1; 148 TARGET_ARCH_ARM64 = 2; 149} 150 151 152// To specify a call flow event. 153message CallFlowSpecificationMessage { 154 // true if for a function call event. 155 optional bool entry = 1 [default = false]; 156 // true if for an exit event from a function. 157 optional bool exit = 2 [default = false]; 158 // a list of functions that can be called right after this event. 159 repeated bytes next = 11; 160 // a list of functions that can be called right before this event. 161 repeated bytes prev = 12; 162} 163 164 165// To specify the measured native code coverage raw data. 166message NativeCodeCoverageRawDataMessage { 167 // gcno file path. 168 optional bytes file_path = 1; 169 170 // content of a gcda file. 171 optional bytes gcda = 11; 172} 173 174 175// To specify an API call to an interface. 176message FunctionCallMessage { 177 // Name of the interface. Not required if hal_driver_id is set. 178 // Currently only used by fuzzer. 179 optional bytes hidl_interface_name = 1; 180 181 // HAL driver ID, if set (e.g., >0), use the given driver_id to get the 182 // corresponding driver instance; otherwise, create a new driver based 183 // on the component info (package, version etc.) 184 optional int32 hal_driver_id = 11 [default = -1]; 185 186 // Component class, e.g., HIDL HAL or Conventional HAL. 187 optional ComponentClass component_class = 21; 188 // Component type, e.g., BLUETOOTH, used for Conventional HAL only. 189 optional ComponentType component_type = 22; 190 // Component version (e.g., 1.0). 191 optional bytes component_type_version = 23; 192 // Component name (e.g., INfc), used for HIDL HALs only. 193 optional bytes component_name = 24; 194 // Component package name (e.g., android.hardware.nfc). 195 optional bytes package_name = 25; 196 197 // Specifies API function and inputs. 198 optional FunctionSpecificationMessage api = 100; 199} 200 201// To specify a function. 202message FunctionSpecificationMessage { 203 // the function name. 204 optional bytes name = 1; 205 206 // the submodule name. 207 optional bytes submodule_name = 2; 208 209 // the HIDL interface ID used to call an API of another nested interface 210 // using a VTS HAL driver (for HIDL HAL). 0 for the main interface. 211 optional int32 hidl_interface_id = 3; 212 213 // data type of the return value (for legacy HALs and shared libraries). 214 optional VariableSpecificationMessage return_type = 11; 215 216 // data type of the return value (for HIDL HALs). 217 repeated VariableSpecificationMessage return_type_hidl = 12; 218 219 // used to pass the spec of a found HAL_CONVENTIONAL_SUBMODULE to the host. 220 optional ComponentSpecificationMessage return_type_submodule_spec = 13; 221 222 // a list of arguments. 223 repeated VariableSpecificationMessage arg = 21; 224 225 // hidl annotation fields { 226 227 // a specification of the call flows of the function. 228 repeated CallFlowSpecificationMessage callflow = 31; 229 // if true, will not be fuzz tested. 230 optional bool do_not_fuzz = 32 [default = false]; 231 232 // } hidl annotation fields 233 234 // whether it is a callback. 235 optional bool is_callback = 41 [deprecated = true]; 236 237 // when it is a callback. 238 optional FunctionPointerSpecificationMessage function_pointer = 42; 239 240 // profiling data. 241 repeated float profiling_data = 101; 242 243 // measured processed coverage data. 244 repeated uint32 processed_coverage_data = 201; 245 246 // measured raw coverage data. 247 repeated NativeCodeCoverageRawDataMessage raw_coverage_data = 202; 248 249 // not a user-provided variable. used by the frameworks to tell the sub 250 // struct hierarchy. 251 optional bytes parent_path = 301; 252 253 // to specify a syscall number. 254 optional uint32 syscall_number = 401; 255} 256 257 258// To keep the value of a scalar variable. 259message ScalarDataValueMessage { 260 optional bool bool_t = 1; 261 262 optional int32 int8_t = 11; 263 optional uint32 uint8_t = 12; 264 265 optional int32 char = 13; 266 optional uint32 uchar = 14; 267 268 optional int32 int16_t = 21; 269 optional uint32 uint16_t = 22; 270 271 optional int32 int32_t = 31; 272 optional uint32 uint32_t = 32; 273 274 optional int64 int64_t = 41; 275 optional uint64 uint64_t = 42; 276 277 optional float float_t = 101; 278 optional double double_t = 102; 279 280 optional uint32 pointer = 201; 281 optional uint32 opaque = 202; 282 optional uint32 void_pointer = 211; 283 optional uint32 char_pointer = 212; 284 optional uint32 uchar_pointer = 213; 285 optional uint32 pointer_pointer = 251; 286} 287 288 289// To keep the specification and value of a function pointer. 290message FunctionPointerSpecificationMessage { 291 // used for a function pointer to keep its function name. 292 optional bytes function_name = 1; 293 294 // actual pointer value. 295 optional uint32 address = 11; 296 // ID used for VTS RMI (remote method invocation). 297 optional bytes id = 21; 298 299 // argument(s) 300 repeated VariableSpecificationMessage arg = 101; 301 302 // data type of the return value (for legacy HALs and shared libraries). 303 optional VariableSpecificationMessage return_type = 111; 304} 305 306 307// To keep the value of a string variable. 308message StringDataValueMessage { 309 // for actual contents. 310 optional bytes message = 1; 311 312 // for length in bytes, and usually not required. 313 optional uint32 length = 11; 314} 315 316 317// To keep the value of an enum type variable. 318message EnumDataValueMessage { 319 // for the enumerator names. 320 repeated bytes enumerator = 1; 321 322 // for the corresponding values. 323 repeated ScalarDataValueMessage scalar_value = 2; 324 optional bytes scalar_type = 3; 325} 326 327// To keep the value of a memory variable. 328message MemoryDataValueMessage { 329 optional int64 size = 1; 330 optional bytes contents = 2; 331} 332 333// Type of a file descriptor. 334enum FdType { 335 FILE_TYPE = 1; 336 DIR_TYPE = 2; 337 DEV_TYPE = 3; 338 PIPE_TYPE = 4; 339 SOCKET_TYPE = 5; 340 LINK_TYPE = 6; 341} 342 343// To keep the value of a file-descriptor. 344message FdMessage { 345 optional FdType type = 1; 346 optional uint32 mode = 2; 347 optional int32 flags = 3; 348 optional bytes file_name = 4; 349 // For shared memory. 350 optional MemoryDataValueMessage memory = 6; 351} 352 353// To keep the value of a handle variable. 354message HandleDataValueMessage { 355 // sizeof(native_handle_t) 356 optional int32 version = 1; 357 // number of file-descriptors. 358 optional int32 num_fds = 2; 359 // number of ints. 360 optional int32 num_ints = 3; 361 // file-descriptor values. 362 repeated FdMessage fd_val = 4; 363 // ints values 364 repeated int32 int_val = 5; 365} 366 367// To specify a function argument or an attribute in general. 368message VariableSpecificationMessage { 369 // the variable name. empty if for a type definition. 370 optional bytes name = 1; 371 372 // the variable type which is one of: 373 // TYPE_SCALAR, TYPE_STRING, TYPE_ENUM, TYPE_ARRAY, 374 // TYPE_VECTOR, TYPE_STRUCT, TYPE_UNION, TYPE_HIDL_CALLBACK, 375 // TYPE_HIDL_INTERFACE, TYPE_HANDLE 376 // 377 // not yet supported: 378 // "template", "typedef", "binder", "parcelable". 379 optional VariableType type = 2; 380 381 // the actual value(s) for an scalar data type. 382 // repeated values for a vector. 383 optional ScalarDataValueMessage scalar_value = 101; 384 optional bytes scalar_type = 102; 385 386 optional StringDataValueMessage string_value = 111; 387 388 // for the definition of enum type only. 389 // The value of an eunm variable is stored in scalar_value message. 390 optional EnumDataValueMessage enum_value = 121; 391 392 // for both TYPE_ARRAY (using size field) and TYPE_VECTOR. 393 repeated VariableSpecificationMessage vector_value = 131; 394 // Length of an array. Also used for TYPE_VECTOR at runtime. 395 optional int32 vector_size = 132; 396 397 // for sub variables when this's a struct type. 398 repeated VariableSpecificationMessage struct_value = 141; 399 // the type name of this struct. 400 optional bytes struct_type = 142; 401 402 // for nested struct type declarations (without actual definitions). 403 repeated VariableSpecificationMessage sub_struct = 143; 404 405 // for sub variables when this's a union type. 406 repeated VariableSpecificationMessage union_value = 151; 407 // the type name of this union. 408 optional bytes union_type = 152; 409 410 // for nested union type declarations (without actual definitions). 411 repeated VariableSpecificationMessage sub_union = 153; 412 413 // for the definition/value of TYPE_FMQ_SYNC and TYPE_FMQ_UNSYNC. 414 repeated VariableSpecificationMessage fmq_value = 161; 415 416 // for TYPE_REF. 417 optional VariableSpecificationMessage ref_value = 171; 418 419 // for TYPE_HIDL_MEMROY. 420 optional MemoryDataValueMessage hidl_memory_value =172; 421 422 // for TYPE_HANDLE. 423 optional HandleDataValueMessage handle_value =181; 424 425 // for non HIDL HAL, to use a custom type defined in C/C++. 426 optional bytes predefined_type = 201; 427 428 // for non HIDL HAL, to set function pointer(s). 429 repeated FunctionPointerSpecificationMessage function_pointer = 221; 430 431 // for HIDL HAL, to use a HIDL callback instance. 432 optional bytes hidl_callback_type = 231; 433 434 // for HIDL HAL, to specify the HIDL_INTERFACE ID. ID is used between 435 // a VTS driver and other modules (e.g., agent and host-side module). 436 optional int32 hidl_interface_id = 241; 437 438 // for HIDL HAL, to specify an HIDL interface's client proxy object's 439 // pointer value. Passed from a DriverBase instance to the VTS HAL driver 440 // framework as a return value of its CallFunction() method. Another use 441 // case is when this variable is passed to a DriverBase instance from the 442 // VTS HAL driver framework which can get this value from another 443 // (potentially nested or main) DriverBase instance. 444 optional uint64 hidl_interface_pointer = 242; 445 446 // true if the argument is an input (valid only for the top-level message). 447 optional bool is_input = 301 [default = true]; 448 // true if the argument is an output. 449 optional bool is_output = 302 [default = false]; 450 // true if the argument is a constant variable. 451 optional bool is_const = 303 [default = false]; 452 // true if the argument is a struct with one or multiple function pointers. 453 optional bool is_callback = 304 [default = false]; 454} 455 456 457// To specify a sub-structure. 458message StructSpecificationMessage { 459 // the sub-structure's variable name in its parent data structure. 460 optional bytes name = 1; 461 462 // whether itself a pointer varaible in its parent data structure. 463 optional bool is_pointer = 2 [default = false]; 464 465 // a list of functions contained in the struct. 466 repeated FunctionSpecificationMessage api = 1001; 467 468 // a list of structures contained in the component. 469 repeated StructSpecificationMessage sub_struct = 2001; 470 471 // The definitions of custom-defined aggregate types. 472 repeated VariableSpecificationMessage attribute = 3001; 473} 474 475 476// To specify an interface of a component 477message InterfaceSpecificationMessage { 478 // whether this interface is a HIDL callback. 479 optional bool is_hidl_callback = 101 [default = false]; 480 481 // a list of functions exposed by the component. 482 repeated FunctionSpecificationMessage api = 2001; 483 484 // The definitions of custom-defined aggregate types. 485 repeated VariableSpecificationMessage attribute = 3001; 486 487 // a list of structures contained in the component. 488 repeated StructSpecificationMessage sub_struct = 4001; 489} 490 491 492// To specify a module (which is logically equivalent to a .hal file in case 493// of a HIDL HAL). 494message ComponentSpecificationMessage { 495 // Class, type, and version of a target component. 496 optional ComponentClass component_class = 1; 497 optional ComponentType component_type = 2; 498 optional float component_type_version = 3 [default = 1.0]; 499 500 // The name of a target component (used for HIDL HALs). 501 optional bytes component_name = 4; 502 503 // for the target processor architecture. 504 optional TargetArch target_arch = 5; 505 506 // The package path of a target component (e.g., android.hardware.name). 507 // name implies the component_type field. 508 optional bytes package = 11; 509 510 // The modules to import (e.g., package_path.component_name). 511 repeated bytes import = 12; 512 513 // The name of original C/C++ data structure 514 // (used for conventional and legacy HALs). 515 optional bytes original_data_structure_name = 1001; 516 517 // a list of headers that need to be imported in order to use the component. 518 repeated bytes header = 1002; 519 520 // For a .hal file which actually defines an interface. 521 optional InterfaceSpecificationMessage interface = 2001; 522 523 // For a .hal file which does not defines an interface (e.g., types.hal). 524 repeated VariableSpecificationMessage attribute = 2101; 525} 526