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; 18 19 20// Class of a target component. 21enum ComponentClass { 22 UNKNOWN_CLASS = 0; 23 // For a HAL shared library. 24 HAL_CONVENTIONAL = 1; 25 // For a submodule of a shared library HAL . 26 HAL_CONVENTIONAL_SUBMODULE = 2; 27 // For a legacy HAL. 28 HAL_LEGACY = 3; 29 // For a HAL which uses HIDL (HAL Interface Definition Language). 30 HAL_HIDL = 4; 31 // For a HAL which uses HIDL (HAL Interface Definition Language). 32 HAL_HIDL_WRAPPED_CONVENTIONAL = 5; 33 34 // For a shared library which is not a HAL (e.g., standard library). 35 LIB_SHARED = 11; 36 37 // For an OS kernel. 38 KERNEL = 21; 39 // For an OS kernel module. 40 KERNEL_MODULE = 22; 41} 42 43 44// Type of a target component. 45enum ComponentType { 46 UNKNOWN_TYPE = 0; 47 // For an audio submodule. 48 AUDIO = 1; 49 // For a camera submodule. 50 CAMERA = 2; 51 // For a GPS submodule. 52 GPS = 3; 53 // For a Lights sensor submodule. 54 LIGHT = 4; 55 // For a WiFi submodule. 56 WIFI = 5; 57 // For a mobile networking submodule. 58 MOBILE = 6; 59 // For a WiFi submodule. 60 BLUETOOTH = 7; 61 // For a NFC submodule. 62 NFC = 8; 63 // For a power HAL. 64 POWER = 9; 65 // For a mem track HAL. 66 MEMTRACK = 10; 67 // For a biometrics fingerprint HAL. 68 BFP = 11; 69 // For a vibrator submodule. 70 VIBRATOR = 12; 71 // For a thermal submodule. 72 THERMAL = 13; 73 // For a tv_input HAL. 74 TV_INPUT = 14; 75 // For a tv hdmi_cec submodule 76 TV_CEC = 15; 77 // For sensors submodule 78 SENSORS = 16; 79 // For a vehicle submodule 80 VEHICLE = 17; 81 // For a VR submodule. 82 VR = 18; 83 // For a graphics allocator submodule. 84 GRAPHICS_ALLOCATOR = 19; 85 // For a graphics mapper submodule. 86 GRAPHICS_MAPPER = 20; 87 // For a radio submodule 88 RADIO = 21; 89 // For the context hub HAL. 90 CONTEXTHUB = 22; 91 // For a graphics composer submodule. 92 GRAPHICS_COMPOSER = 23; 93 // For a media omx submodule. 94 MEDIA_OMX = 24; 95 96 // for bionic's libm 97 BIONIC_LIBM = 1001; 98 99 // for bionic's libc 100 BIONIC_LIBC = 1002; 101 102 // for VNDK's libcutils 103 VNDK_LIBCUTILS = 1101; 104 105 // for OS kernel's system call. 106 SYSCALL = 2001; 107} 108 109 110// Type of a variable. 111enum VariableType { 112 UNKNOWN_VARIABLE_TYPE = 0; 113 TYPE_PREDEFINED = 1; 114 TYPE_SCALAR = 2; 115 TYPE_STRING = 3; 116 TYPE_ENUM = 4; 117 TYPE_ARRAY = 5; 118 TYPE_VECTOR = 6; 119 TYPE_STRUCT = 7; 120 // for conventional HALs, to keep a data structure with one or multiple 121 // callback functions. 122 TYPE_FUNCTION_POINTER = 8; 123 TYPE_VOID = 9; 124 TYPE_HIDL_CALLBACK = 10; 125 TYPE_SUBMODULE = 11; 126 TYPE_UNION = 12; 127 TYPE_HIDL_INTERFACE = 13; 128 TYPE_HANDLE = 14; 129 // for an enum whose every enumerator value is a number which is power of 2. 130 TYPE_MASK = 15; 131 // for hidl_memory type 132 TYPE_HIDL_MEMORY = 16; 133 // for pointer type 134 TYPE_POINTER = 17; 135 // for FMQ types 136 TYPE_FMQ_SYNC = 18; 137 TYPE_FMQ_UNSYNC = 19; 138 // for HIDL ref<>, a restricted native pointer type. 139 TYPE_REF = 20; 140} 141 142 143// Type of a target processor architecture. 144enum TargetArch { 145 UNKNOWN_TARGET_ARCH = 0; 146 TARGET_ARCH_ARM = 1; 147 TARGET_ARCH_ARM64 = 2; 148} 149 150 151// To specify a call flow event. 152message CallFlowSpecificationMessage { 153 // true if for a function call event. 154 optional bool entry = 1 [default = false]; 155 // true if for an exit event from a function. 156 optional bool exit = 2 [default = false]; 157 // a list of functions that can be called right after this event. 158 repeated bytes next = 11; 159 // a list of functions that can be called right before this event. 160 repeated bytes prev = 12; 161} 162 163 164// To specify the measured native code coverage raw data. 165message NativeCodeCoverageRawDataMessage { 166 // gcno file path. 167 optional bytes file_path = 1; 168 169 // content of a gcda file. 170 optional bytes gcda = 11; 171} 172 173 174// To specify a function. 175message FunctionSpecificationMessage { 176 // the function name. 177 optional bytes name = 1; 178 179 // the submodule name. 180 optional bytes submodule_name = 2; 181 182 // data type of the return value (for legacy HALs and shared libraries). 183 optional VariableSpecificationMessage return_type = 11; 184 185 // data type of the return value (for HIDL HALs). 186 repeated VariableSpecificationMessage return_type_hidl = 12; 187 188 // used to pass the spec of a found HAL_CONVENTIONAL_SUBMODULE to the host. 189 optional ComponentSpecificationMessage return_type_submodule_spec = 13; 190 191 // a list of arguments. 192 repeated VariableSpecificationMessage arg = 21; 193 194 // a specification of the call flows of the function. 195 repeated CallFlowSpecificationMessage callflow = 31; 196 197 // whether it is a callback. 198 optional bool is_callback = 41; 199 200 // when it is a callback. 201 optional FunctionPointerSpecificationMessage function_pointer = 42; 202 203 // profiling data. 204 repeated float profiling_data = 101; 205 206 // measured processed coverage data. 207 repeated uint32 processed_coverage_data = 201; 208 209 // measured raw coverage data. 210 repeated NativeCodeCoverageRawDataMessage raw_coverage_data = 202; 211 212 // not a user-provided variable. used by the frameworks to tell the sub 213 // struct hierarchy. 214 optional bytes parent_path = 301; 215 216 // to specify a syscall number. 217 optional uint32 syscall_number = 401; 218} 219 220 221// To keep the value of a scalar variable. 222message ScalarDataValueMessage { 223 optional int32 bool_t = 1; 224 225 optional int32 int8_t = 11; 226 optional uint32 uint8_t = 12; 227 228 optional int32 char = 13; 229 optional uint32 uchar = 14; 230 231 optional int32 int16_t = 21; 232 optional uint32 uint16_t = 22; 233 234 optional int32 int32_t = 31; 235 optional uint32 uint32_t = 32; 236 237 optional int64 int64_t = 41; 238 optional uint64 uint64_t = 42; 239 240 optional float float_t = 101; 241 optional double double_t = 102; 242 243 optional uint32 pointer = 201; 244 optional uint32 opaque = 202; 245 optional uint32 void_pointer = 211; 246 optional uint32 char_pointer = 212; 247 optional uint32 uchar_pointer = 213; 248 optional uint32 pointer_pointer = 251; 249} 250 251 252// To keep the specification and value of a function pointer. 253message FunctionPointerSpecificationMessage { 254 // used for a function pointer to keep its function name. 255 optional bytes function_name = 1; 256 257 // actual pointer value. 258 optional uint32 address = 11; 259 // ID used for VTS RMI (remote method invocation). 260 optional bytes id = 21; 261 262 // argument(s) 263 repeated VariableSpecificationMessage arg = 101; 264 265 // data type of the return value (for legacy HALs and shared libraries). 266 optional VariableSpecificationMessage return_type = 111; 267} 268 269 270// To keep the value of a string variable. 271message StringDataValueMessage { 272 // for actual contents. 273 optional bytes message = 1; 274 275 // for length in bytes, and usually not required. 276 optional uint32 length = 11; 277} 278 279 280// To keep the value of an enum type variable. 281message EnumDataValueMessage { 282 // for the enumerator names. 283 repeated bytes enumerator = 1; 284 285 // for the corresponding values. 286 repeated ScalarDataValueMessage scalar_value = 2; 287 optional bytes scalar_type = 3; 288} 289 290 291// To specify a function argument or an attribute in general. 292message VariableSpecificationMessage { 293 // the variable name. empty if for a type definition. 294 optional bytes name = 1; 295 296 // the variable type which is one of: 297 // TYPE_SCALAR, TYPE_STRING, TYPE_ENUM, TYPE_ARRAY, 298 // TYPE_VECTOR, TYPE_STRUCT, TYPE_UNION, TYPE_HIDL_CALLBACK, 299 // TYPE_HIDL_INTERFACE, TYPE_HANDLE 300 // 301 // not yet supported: 302 // "template", "typedef", "binder", "parcelable". 303 optional VariableType type = 2; 304 305 // the actual value(s) for an scalar data type. 306 // repeated values for a vector. 307 optional ScalarDataValueMessage scalar_value = 101; 308 optional bytes scalar_type = 102; 309 310 optional StringDataValueMessage string_value = 111; 311 312 // for the definition of enum type only. 313 // The value of a eunm variable is stored in scalar_value message. 314 optional EnumDataValueMessage enum_value = 121; 315 316 // for both TYPE_ARRAY (using size field) and TYPE_VECTOR. 317 repeated VariableSpecificationMessage vector_value = 131; 318 // Length of an array. Also used for TYPE_VECTOR at runtime. 319 optional int32 vector_size = 132; 320 321 // for sub variables when this's a struct type. 322 repeated VariableSpecificationMessage struct_value = 141; 323 // the type name of this struct. 324 optional bytes struct_type = 142; 325 326 // for nested struct type declarations (without actual definitions). 327 repeated VariableSpecificationMessage sub_struct = 143; 328 329 // for sub variables when this's a union type. 330 repeated VariableSpecificationMessage union_value = 151; 331 // the type name of this union. 332 optional bytes union_type = 152; 333 334 // for nested union type declarations (without actual definitions). 335 repeated VariableSpecificationMessage sub_union = 153; 336 337 // for the definition/value of TYPE_FMQ_SYNC and TYPE_FMQ_UNSYNC. 338 repeated VariableSpecificationMessage fmq_value = 161; 339 340 // for TYPE_REF. 341 optional VariableSpecificationMessage ref_value = 171; 342 343 // for non HIDL HAL, to use a custom type defined in C/C++. 344 optional bytes predefined_type = 201; 345 346 // for non HIDL HAL, to set function pointer(s). 347 repeated FunctionPointerSpecificationMessage function_pointer = 221; 348 349 // for HIDL HAL, to use a HIDL callback instance. 350 optional bytes hidl_callback_type = 231; 351 352 // true if the argument is an input (valid only for the top-level message). 353 optional bool is_input = 301 [default = true]; 354 // true if the argument is an output. 355 optional bool is_output = 302 [default = false]; 356 // true if the argument is a constant variable. 357 optional bool is_const = 303 [default = false]; 358 // true if the argument is a struct with one or multiple function pointers. 359 optional bool is_callback = 304 [default = false]; 360} 361 362 363// To specify a sub-structure. 364message StructSpecificationMessage { 365 // the sub-structure's variable name in its parent data structure. 366 optional bytes name = 1; 367 368 // whether itself a pointer varaible in its parent data structure. 369 optional bool is_pointer = 2 [default = false]; 370 371 // a list of functions contained in the struct. 372 repeated FunctionSpecificationMessage api = 1001; 373 374 // a list of structures contained in the component. 375 repeated StructSpecificationMessage sub_struct = 2001; 376 377 // The definitions of custom-defined aggregate types. 378 repeated VariableSpecificationMessage attribute = 3001; 379} 380 381 382// To specify an interface of a component 383message InterfaceSpecificationMessage { 384 // a list of functions exposed by the component. 385 repeated FunctionSpecificationMessage api = 2001; 386 387 // The definitions of custom-defined aggregate types. 388 repeated VariableSpecificationMessage attribute = 3001; 389 390 // a list of structures contained in the component. 391 repeated StructSpecificationMessage sub_struct = 4001; 392} 393 394 395// To specify a module (which is logically equivalent to a .hal file in case 396// of a HIDL HAL). 397message ComponentSpecificationMessage { 398 // Class, type, and version of a target component. 399 optional ComponentClass component_class = 1; 400 optional ComponentType component_type = 2; 401 optional float component_type_version = 3 [default = 1.0]; 402 403 // The name of a target component (used for HIDL HALs). 404 optional bytes component_name = 4; 405 406 // for the target processor architecture. 407 optional TargetArch target_arch = 5; 408 409 // The package path of a target component (e.g., android.hardware.name). 410 // name implies the component_type field. 411 optional bytes package = 11; 412 413 // The modules to import (e.g., package_path.component_name). 414 repeated bytes import = 12; 415 416 // The name of original C/C++ data structure 417 // (used for conventional and legacy HALs). 418 optional bytes original_data_structure_name = 1001; 419 420 // a list of headers that need to be imported in order to use the component. 421 repeated bytes header = 1002; 422 423 // For a .hal file which actually defines an interface. 424 optional InterfaceSpecificationMessage interface = 2001; 425 426 // For a .hal file which does not defines an interface (e.g., types.hal). 427 repeated VariableSpecificationMessage attribute = 2101; 428} 429