1/* 2 * Copyright (C) 2023 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"; 18 19// !!!!!!!!!!!!!!!!!!!!!!!!!!!!! DISCLAIMER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 20// The messages definition here must be in sync with atoms definitions in 21// hardware/google/pixel/pixelstats/pixelatoms.proto 22 23// C++ namespace: android.chre.metrics 24package android.chre.metrics; 25 26option optimize_for = LITE_RUNTIME; 27 28option java_package = "android.chre"; 29option java_outer_classname = "Metrics"; 30 31/** 32 * Logs an event indicating that a nanoapp loading has failed at the HAL. 33 */ 34message ChreHalNanoappLoadFailed { 35 // Vendor reverse domain name (expecting "com.google.pixel"). 36 optional string reverse_domain_name = 1; 37 38 enum Type { 39 TYPE_UNKNOWN = 0; 40 // Corresponds to preloaded nanoapps on the device. 41 TYPE_PRELOADED = 1; 42 // Dynamic loading of a nanoapp (e.g. code download). 43 TYPE_DYNAMIC = 2; 44 } 45 46 enum Reason { 47 REASON_UNKNOWN = 0; 48 // A generic error code that does not match any of the others. 49 REASON_ERROR_GENERIC = 1; 50 // Failure at the connection between HAL<->CHRE. 51 REASON_CONNECTION_ERROR = 2; 52 // System ran out of memory. 53 REASON_OOM = 3; 54 // Nanoapp did not have the right signing for loading. 55 REASON_SIGNATURE_MISMATCH = 4; 56 } 57 58 // The 64-bit unique nanoapp identifier of the nanoapp that failed. 59 optional int64 nanoapp_id = 2; 60 61 // The type of the load event. 62 optional Type type = 3; 63 64 // The reason for the failure. 65 optional Reason reason = 4; 66} 67 68/** 69 * An enum describing a module within CHRE. 70 */ 71enum ChreModuleType { 72 CHRE_MODULE_TYPE_UNKNOWN = 0; 73 CHRE_MODULE_TYPE_CHRE = 1; // Core CHRE framework 74 CHRE_MODULE_TYPE_PAL = 2; // PAL module (could be CHPP) 75 CHRE_MODULE_TYPE_NANOAPP = 3; 76} 77 78/** 79 * An enum describing the CHRE PAL type. 80 */ 81enum ChrePalType { 82 CHRE_PAL_TYPE_UNKNOWN = 0; 83 CHRE_PAL_TYPE_SENSOR = 1; 84 CHRE_PAL_TYPE_WIFI = 2; 85 CHRE_PAL_TYPE_GNSS = 3; 86 CHRE_PAL_TYPE_WWAN = 4; 87 CHRE_PAL_TYPE_AUDIO = 5; 88 CHRE_PAL_TYPE_BLE = 6; 89} 90 91/** 92 * Logs an event indicating that a CHRE PAL open has failed. 93 */ 94message ChrePalOpenFailed { 95 // Vendor reverse domain name (expecting "com.google.pixel"). 96 optional string reverse_domain_name = 1; 97 98 enum Type { 99 TYPE_UNKNOWN = 0; 100 // Initial open when CHRE starts. 101 INITIAL_OPEN = 1; 102 // Any form of "reopen" event internally in the PAL. 103 REOPEN = 2; 104 } 105 106 // The PAL this failure event is for. 107 optional ChrePalType pal = 2; 108 109 // The type of failure observed. 110 optional Type type = 3; 111} 112 113/** 114 * The type of CHRE API request. 115 */ 116enum ChreApiType { 117 CHRE_API_TYPE_UNKNOWN = 0; 118 CHRE_API_TYPE_WIFI_SCAN_MONITOR = 1; 119 CHRE_API_TYPE_WIFI_ACTIVE_SCAN = 2; 120 CHRE_API_TYPE_WIFI_RTT_RANGING = 3; 121} 122 123/** 124 * The type of CHRE API error. 125 */ 126enum ChreError { 127 CHRE_ERROR_UNKNOWN = 0; 128 129 // No error occurred. 130 CHRE_ERROR_NONE = 1; 131 132 // An unspecified failure occurred. 133 CHRE_ERROR = 2; 134 135 // One or more supplied arguments are invalid. 136 CHRE_ERROR_INVALID_ARGUMENT = 3; 137 138 // Unable to satisfy request because the system is busy. 139 CHRE_ERROR_BUSY = 4; 140 141 // Unable to allocate memory. 142 CHRE_ERROR_NO_MEMORY = 5; 143 144 // The requested feature is not supported. 145 CHRE_ERROR_NOT_SUPPORTED = 6; 146 147 // A timeout occurred while processing the request. 148 CHRE_ERROR_TIMEOUT = 7; 149 150 // The relevant capability is disabled, for example due to a user 151 // configuration that takes precedence over this request. 152 CHRE_ERROR_FUNCTION_DISABLED = 8; 153} 154 155/** 156 * Distribution of CHRE API error codes. 157 */ 158message ChreApiErrorCodeDistributionTaken { 159 // Vendor reverse domain name (expecting "com.google.pixel"). 160 optional string reverse_domain_name = 1; 161 162 // The chreGetTime() value when this snapshot was taken, in milliseconds. 163 optional int32 snapshot_chre_get_time_ms = 2; 164 165 // The CHRE API type. 166 optional ChreApiType api_type = 3; 167 168 // Corresponds to the CHRE error code that occurred, as defined in the 169 // "enum chreError" field in chre_api/chre/common.h. 170 optional ChreError error_code = 4; 171 optional int32 num_errors = 5; 172} 173 174/** 175 * Snapshot of the dynamic memory allocated in CHRE. 176 */ 177message ChreDynamicMemorySnapshotReported { 178 // Vendor reverse domain name (expecting "com.google.pixel"). 179 optional string reverse_domain_name = 1; 180 181 // The chreGetTime() value when this snapshot was taken, in milliseconds. 182 optional int32 snapshot_chre_get_time_ms = 2; 183 184 // The type of the module. 185 optional ChreModuleType module_type = 3; 186 187 // The unique 64-bit ID for a nanoapp, only used if the module_type is 188 // NANOAPP. If module_type is PAL, then it represents the ChrePalType enum. If 189 // the module_type is CHRE, then a zero value should be used. 190 optional int64 pal_type_or_nanoapp_id = 4; 191 192 // The max allocation amount of this module in bytes. 193 optional int32 max_allocation_bytes = 5; 194 195 // The current allocation amount of this module in bytes. 196 optional int32 current_allocation_bytes = 6; 197} 198 199/** 200 * Snapshot of the event queue stats in CHRE. 201 */ 202message ChreEventQueueSnapshotReported { 203 // Vendor reverse domain name (expecting "com.google.pixel"). 204 optional string reverse_domain_name = 1; 205 206 // The chreGetTime() value when this snapshot was taken, in milliseconds. 207 optional int32 snapshot_chre_get_time_ms = 2; 208 209 // The maximum size the event queue got to (i.e. num pending events). 210 optional int32 max_event_queue_size = 3; 211 212 // The average size the event queue got to (i.e. num pending events). 213 optional int32 mean_event_queue_size = 4; 214 215 // The number of events that were dropped due to capacity limits. 216 optional int32 num_dropped_events = 5; 217 218 // The maximum amount of time it took for an event, from when it was received, 219 // to when it was delivered to all interested modules. This value represents 220 // the total delay within the CHRE subsystem. 221 optional int64 max_queue_delay_us = 6; 222 223 // The mean value of the delay in microseconds. 224 optional int64 mean_queue_delay_us = 7; 225} 226 227/** 228 * Indicates that a nanoapp has woken up the AP. 229 */ 230message ChreApWakeUpOccurred { 231 // Vendor reverse domain name (expecting "com.google.pixel"). 232 optional string reverse_domain_name = 1; 233 234 // The 64-bit unique nanoapp identifier that describes the entity that has 235 // caused an AP wake-up from CHRE. Whenever this event occurs, this means that 236 // the nanoapp sent a message to the AP causing a transition between 237 // suspend/wake-up. 238 optional int64 nanoapp_id = 2; 239} 240