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"; 18package android.adservices; 19 20// Recommended setup in go/java-proto-names 21option java_outer_classname = "AdservicesProtoEnums"; 22option java_multiple_files = true; 23 24/** 25 * Type of the classifier used for classifying apps. 26 */ 27enum ClassifierType { 28 /** Unknown classifier option. */ 29 UNKNOWN_CLASSIFIER = 0; 30 /** Only on-device classification. */ 31 ON_DEVICE_CLASSIFIER = 1; 32 /** Only Precomputed classification. */ 33 PRECOMPUTED_CLASSIFIER = 2; 34 /** Precomputed classification values are preferred over on-device classification values. */ 35 PRECOMPUTED_THEN_ON_DEVICE_CLASSIFIER = 3; 36} 37 38/** 39 * On Device classifier status. 40 */ 41enum OnDeviceClassifierStatus { 42 ON_DEVICE_CLASSIFIER_STATUS_UNSPECIFIED = 0; 43 ON_DEVICE_CLASSIFIER_STATUS_NOT_INVOKED = 1; 44 ON_DEVICE_CLASSIFIER_STATUS_SUCCESS = 2; 45 ON_DEVICE_CLASSIFIER_STATUS_FAILURE = 3; 46} 47 48/** 49 * Precomputed classifier status. 50 */ 51enum PrecomputedClassifierStatus { 52 PRECOMPUTED_CLASSIFIER_STATUS_UNSPECIFIED = 0; 53 PRECOMPUTED_CLASSIFIER_STATUS_NOT_INVOKED = 1; 54 PRECOMPUTED_CLASSIFIER_STATUS_SUCCESS = 2; 55 PRECOMPUTED_CLASSIFIER_STATUS_FAILURE = 3; 56} 57 58/** 59 * Attribution types. 60 */ 61enum AttributionType { 62 UNKNOWN = 0; 63 APP_APP = 1; 64 APP_WEB = 2; 65 WEB_APP = 3; 66 WEB_WEB = 4; 67} 68 69/** 70 * Enum representing an error/exception. These errors can be common to all 71 * PPAPIs or specific to a particular API. We will group enums in blocks of 72 * 1000 like this below: 73 * - Common errors: 1-1000 74 * - Topics errors: 1001-2000 75 * - Measurement errors: 2001-3000 76 * - Fledge errors: 3001-4000 77 * - UX errors: 4001-5000 78 */ 79enum ErrorCode { 80 // Common Errors: 1-1000 81 ERROR_CODE_UNSPECIFIED = 0; 82 DATABASE_READ_EXCEPTION = 1; 83 DATABASE_WRITE_EXCEPTION = 2; 84 API_REMOTE_EXCEPTION = 3; 85 86 // Error occurred when unable to send result to the callback. 87 API_CALLBACK_ERROR = 4; 88 89 // Error occurred when failed to call the callback on Rate Limit Reached. 90 RATE_LIMIT_CALLBACK_FAILURE = 5; 91 92 // Error occurred when calling package name is not found. 93 PACKAGE_NAME_NOT_FOUND_EXCEPTION = 6; 94 95 // Shared pref update failure. 96 SHARED_PREF_UPDATE_FAILURE = 7; 97 98 // Shared pref reset failure. 99 SHARED_PREF_RESET_FAILURE = 8; 100 101 // Topics errors: 1001-2000 102 // Remote exception when calling get topics. 103 GET_TOPICS_REMOTE_EXCEPTION = 1001; 104 105 // Topics API is disabled. 106 TOPICS_API_DISABLED = 1002; 107 108 // SQLException occurred when failed to persist classified Topics. 109 TOPICS_PERSIST_CLASSIFIED_TOPICS_FAILURE = 1003; 110 111 // SQLException occurred when failed to persist Top Topics. 112 TOPICS_PERSIST_TOP_TOPICS_FAILURE = 1004; 113 114 // SQLException occurred when failed to record App-Sdk usage history. 115 TOPICS_RECORD_APP_SDK_USAGE_FAILURE = 1005; 116 117 // SQLException occurred when failed to record App Only usage history. 118 TOPICS_RECORD_APP_USAGE_FAILURE = 1006; 119 120 // SQLException occurred when failed to record can learn topic. 121 TOPICS_RECORD_CAN_LEARN_TOPICS_FAILURE = 1007; 122 123 // SQLException occurred when failed to record returned topic. 124 TOPICS_RECORD_RETURNED_TOPICS_FAILURE = 1008; 125 126 // SQLException occurred when failed to record returned topic. 127 TOPICS_RECORD_BLOCKED_TOPICS_FAILURE = 1009; 128 129 // SQLException occurred when failed to remove blocked topic. 130 TOPICS_DELETE_BLOCKED_TOPICS_FAILURE = 1010; 131 132 // SQLException occurred when failed to delete old epochs. 133 TOPICS_DELETE_OLD_EPOCH_FAILURE = 1011; 134 135 // SQLException occurred when failed to delete a column in table 136 TOPICS_DELETE_COLUMN_FAILURE = 1012; 137 138 // SQLException occurred when failed to persist topic contributors. 139 TOPICS_PERSIST_TOPICS_CONTRIBUTORS_FAILURE = 1013; 140 141 // SQLException occurred when failed to delete all entries from table. 142 TOPICS_DELETE_ALL_ENTRIES_IN_TABLE_FAILURE = 1014; 143 144 // Exception occurred when classify call failed. 145 TOPICS_ON_DEVICE_CLASSIFY_FAILURE = 1015; 146 147 // Exception occurred ML model did not return a topic id. 148 TOPICS_ON_DEVICE_NUMBER_FORMAT_EXCEPTION = 1016; 149 150 // Exception occurred when failed to load ML model. 151 TOPICS_LOAD_ML_MODEL_FAILURE = 1017; 152 153 // Exception occurred when unable to retrieve topics id to topics name. 154 TOPICS_ID_TO_NAME_LIST_READ_FAILURE = 1018; 155 156 // Exception occurred when unable to read classifier asset file. 157 TOPICS_READ_CLASSIFIER_ASSET_FILE_FAILURE = 1019; 158 159 // NoSuchAlgorithmException occurred when unable to find correct message. 160 // digest algorithm. 161 TOPICS_MESSAGE_DIGEST_ALGORITHM_NOT_FOUND = 1020; 162 163 // Error occurred when failed to find downloaded classifier model file. 164 DOWNLOADED_CLASSIFIER_MODEL_FILE_NOT_FOUND = 1021; 165 166 // No downloaded or bundled classifier model available. 167 NO_CLASSIFIER_MODEL_AVAILABLE = 1022; 168 169 // Error occurred when failed to read labels file. 170 READ_LABELS_FILE_FAILURE = 1023; 171 172 // Error occurred when failed to read precomuted labels. 173 READ_PRECOMUTRED_LABELS_FAILURE = 1024; 174 175 // Error occurred when failed to read top apps file. 176 READ_TOP_APPS_FILE_FAILURE = 1025; 177 178 // Error occurred when saving a topic not in labels file. 179 INVALID_TOPIC_ID = 1026; 180 181 // Error occurred when failed to read precomuted app topics list. 182 READ_PRECOMUTRED_APP_TOPICS_LIST_FAILURE = 1027; 183 184 // Error occurred when failed to read bundled metadata file. 185 READ_BUNDLED_METADATA_FILE_FAILURE = 1028; 186 187 // Error occurred when reading redundant metadata property. 188 CLASSIFIER_METADATA_REDUNDANT_PROPERTY= 1029; 189 190 // Error occurred when reading redundant metadata asset. 191 CLASSIFIER_METADATA_REDUNDANT_ASSET = 1030; 192 193 // Error occurred when parsing metadata json missing property or asset_name. 194 CLASSIFIER_METADATA_MISSING_PROPERTY_OR_ASSET_NAME = 1031; 195 196 // Error occurred when failed to read classifier assets metadata file. 197 READ_CLASSIFIER_ASSETS_METADATA_FAILURE = 1032; 198 199 // Error occurred when failed to load downloaded file by file Id. 200 DOWNLOADED_CLASSIFIER_MODEL_FILE_LOAD_FAILURE = 1033; 201 202 // RuntimeException occurred when use invalid type of blocked topics 203 // source of truth. 204 TOPICS_INVALID_BLOCKED_TOPICS_SOURCE_OF_TRUTH = 1034; 205 206 // RuntimeException occurred when unable to remove the blocked topic. 207 TOPICS_REMOVE_BLOCKED_TOPIC_FAILURE = 1035; 208 209 // RuntimeException occurred when unable to get all blocked topics. 210 TOPICS_GET_BLOCKED_TOPIC_FAILURE = 1036; 211 212 // RuntimeException occurred when unable to clear all blocked topics 213 // in system server. 214 TOPICS_CLEAR_ALL_BLOCKED_TOPICS_IN_SYSTEM_SERVER_FAILURE = 1037; 215 216 // Error occurred when unable to handle JobService. 217 TOPICS_HANDLE_JOB_SERVICE_FAILURE = 1038; 218 219 // Error occurred when unable to fetch job scheduler. 220 TOPICS_FETCH_JOB_SCHEDULER_FAILURE = 1039; 221 222 // Measurement errors: 2001-3000 223 // Error eccurred when inserting enrollment data to DB. 224 ENROLLMENT_DATA_INSERT_ERROR = 2001; 225 226 // UX errors: 4001-5000 227 CONSENT_REVOKED_ERROR = 4001; 228 229 // Error occurred when failed to get downloaded OTA file URI. 230 DOWNLOADED_OTA_FILE_ERROR = 4002; 231 232 // Exception while trying to add ResourcesProvider. 233 RESOURCES_PROVIDER_ADD_ERROR = 4003; 234 235 // Exception occurred when unable to load MDD file group 236 LOAD_MDD_FILE_GROUP_FAILURE = 4004; 237 238 // Dismiss notification error 239 DISMISS_NOTIFICATION_FAILURE = 4005; 240 241 // Datastore exception while get content 242 DATASTORE_EXCEPTION_WHILE_GET_CONTENT = 4006; 243 244 // Datastore exception while recording notification 245 DATASTORE_EXCEPTION_WHILE_RECORDING_NOTIFICATION = 4007; 246 247 // Datastore exception while recording default consent. 248 DATASTORE_EXCEPTION_WHILE_RECORDING_DEFAULT_CONSENT = 4008; 249 250 // Exception while recording manual consent interaction 251 DATASTORE_EXCEPTION_WHILE_RECORDING_MANUAL_CONSENT_INTERACTION = 4009; 252 253 // Exception while saving privacy sandbox feature. 254 PRIVACY_SANDBOX_SAVE_FAILURE = 4010; 255 256 // Error message indicating invalid consent source of truth. 257 INVALID_CONSENT_SOURCE_OF_TRUTH = 4011; 258 259 // Error message while calling get consent. 260 ERROR_WHILE_GET_CONSENT = 4012; 261 262 // App search consent data migration failure. 263 APP_SEARCH_DATA_MIGRATION_FAILURE = 4013; 264 265 // Ad services entry point failure. 266 AD_SERVICES_ENTRY_POINT_FAILURE = 4014; 267} 268 269/** 270 * Adservices API names. 271 */ 272enum PpapiName { 273 PPAPI_NAME_UNSPECIFIED = 0; 274 TOPICS = 1; 275 MEASUREMENT = 2; 276 FLEDGE = 3; 277 AD_ID = 4; 278 APP_SET_ID = 5; 279 UX = 6; 280} 281 282/** 283 * Type of the result code that implies different execution results of Adservices background jobs. 284 */ 285enum ExecutionResultCode { 286 /** Unspecified result code. */ 287 UNSPECIFIED_CODE = 0; 288 289 /** Successful execution. */ 290 SUCCESSFUL = 1; 291 292 /** Failed execution with retrying the job. */ 293 FAILED_WITH_RETRY = 2; 294 295 /** Failed execution without retrying the job. */ 296 FAILED_WITHOUT_RETRY = 3; 297 298 /** OnJobStop() is invoked with retrying the job. */ 299 ONSTOP_CALLED_WITH_RETRY = 4; 300 301 /** OnJobStop() is invoked without retrying the job. */ 302 ONSTOP_CALLED_WITHOUT_RETRY = 5; 303 304 /** 305 * The execution is halted by system or device for unknown reason, leaving 306 * a not finished execution. 307 */ 308 HALTED_FOR_UNKNOWN_REASON = 6; 309 310 /** Skipped execution due to a job scheduled in ExtServices running on T+. */ 311 SKIP_FOR_EXTSERVICES_JOB_ON_TPLUS = 7; 312 313 /** Skipped execution due to kill switch is on. */ 314 SKIP_FOR_KILL_SWITCH_ON = 8; 315 316 /** Skipped execution due to user consent is revoked. */ 317 SKIP_FOR_USER_CONSENT_REVOKED = 9; 318} 319 320// Region of the user who interacted with AdServicesSettings UI. 321enum AdServiceSettingRegion { 322 // fallback when getDeviceRegion call failed. 323 REGION_UNSPECIFIED = 0; 324 // European Union user (based on isoCountryInfo). 325 EU = 1; 326 // Non-European Union user (based on isoCountryInfo). 327 ROW = 2; 328} 329 330