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 * - FederatedCompute errors: 5001-6000
79 * - Back Compat errors: 6001-7000
80 * - IAPC errors: 7001 - 8000
81 * - ODP errors: 8001-9000
82 *
83 * NOTE: AdId / AdSetId don't have a range yet (because they're just using common codes)
84 */
85enum ErrorCode {
86  // Common Errors: 1-1000
87  ERROR_CODE_UNSPECIFIED = 0;
88  DATABASE_READ_EXCEPTION = 1;
89  DATABASE_WRITE_EXCEPTION = 2;
90  API_REMOTE_EXCEPTION = 3;
91
92  // Error occurred when unable to send result to the callback.
93  API_CALLBACK_ERROR = 4;
94
95  // Error occurred when failed to call the callback on Rate Limit Reached.
96  RATE_LIMIT_CALLBACK_FAILURE = 5;
97
98  // Error occurred when calling package name is not found.
99  PACKAGE_NAME_NOT_FOUND_EXCEPTION = 6;
100
101  // Shared pref update failure.
102  SHARED_PREF_UPDATE_FAILURE = 7;
103
104  // Shared pref reset failure.
105  SHARED_PREF_RESET_FAILURE = 8;
106
107  // Remote exception when calling the Cobalt upload API.
108  COBALT_UPLOAD_API_REMOTE_EXCEPTION = 9;
109
110  // Exception occurred when parsing the Adservices Config XML provided by an app.
111  APP_MANIFEST_CONFIG_PARSING_ERROR = 10;
112
113  // Generic exception when dealing with shared prefs.
114  SHARED_PREF_EXCEPTION = 11;
115
116  // Error logging an API check using Adservices Config XML provided by an app.
117  APP_MANIFEST_CONFIG_LOGGING_ERROR = 12;
118
119  // Incorrect version of the json file.
120  ENCRYPTION_KEYS_INCORRECT_JSON_VERSION = 13;
121
122  // JSON parsing error for the key.
123  ENCRYPTION_KEYS_JSON_PARSING_ERROR = 14;
124
125  // Failed to delete an expired encryption key.
126  ENCRYPTION_KEYS_FAILED_DELETE_EXPIRED_KEY = 15;
127
128  // Failed to load Encryption Keys MDD filegroup
129  ENCRYPTION_KEYS_FAILED_MDD_FILEGROUP = 16;
130
131  // Encryption Keys no MDD files available.
132  ENCRYPTION_KEYS_MDD_NO_FILE_AVAILABLE = 17;
133
134  // JobScheduler is not available.
135  JOB_SCHEDULER_IS_UNAVAILABLE = 18;
136
137  // Failed to encrypt data in Cobalt.
138  COBALT_ENCRYPTION_FAILED_EXCEPTION = 19;
139
140  // Failed to fabricate Cobalt observations.
141  COBALT_PRIVACY_GENERATION_EXCEPTION = 20;
142
143  // Cobalt logger initialization failed in AppNameApiErrorLogger.
144  COBALT_API_ERROR_LOGGER_INITIALIZATION_EXCEPTION = 21;
145
146  // SPE Errors: 901 - 1000
147  // Get an unavailable job execution start timestamp when calculating the execution latency.
148  SPE_UNAVAILABLE_JOB_EXECUTION_START_TIMESTAMP = 901;
149
150  // Get an invalid execution period during the calculation.
151  SPE_INVALID_EXECUTION_PERIOD = 902;
152
153  // Failed to persist execution start time in the storage.
154  SPE_FAIL_TO_COMMIT_JOB_EXECUTION_START_TIME = 903;
155
156  // Failed to persist execution stop time in the storage.
157  SPE_FAIL_TO_COMMIT_JOB_EXECUTION_STOP_TIME = 904;
158
159  // Execution failure.
160  SPE_JOB_EXECUTION_FAILURE = 905;
161
162  // JobScheduler is not available.
163  SPE_JOB_SCHEDULER_IS_UNAVAILABLE = 906;
164
165  // Invalid Job Policy configured in the server.
166  SPE_INVALID_JOB_POLICY_SYNC = 907;
167
168  // Job is not configured correctly.
169  SPE_JOB_NOT_CONFIGURED_CORRECTLY = 908;
170
171  // Scheduling Failure.
172  SPE_JOB_SCHEDULING_FAILURE = 909;
173
174  // Failure of the customized logic in onStopJob().
175  SPE_JOB_ON_STOP_EXECUTION_FAILURE = 910;
176
177  // Topics errors: 1001-2000
178  // Remote exception when calling get topics.
179  GET_TOPICS_REMOTE_EXCEPTION = 1001;
180
181  // Topics API is disabled.
182  TOPICS_API_DISABLED = 1002;
183
184  // SQLException occurred when failed to persist classified Topics.
185  TOPICS_PERSIST_CLASSIFIED_TOPICS_FAILURE = 1003;
186
187  // SQLException occurred when failed to persist Top Topics.
188  TOPICS_PERSIST_TOP_TOPICS_FAILURE = 1004;
189
190  // SQLException occurred when failed to record App-Sdk usage history.
191  TOPICS_RECORD_APP_SDK_USAGE_FAILURE = 1005;
192
193  // SQLException occurred when failed to record App Only usage history.
194  TOPICS_RECORD_APP_USAGE_FAILURE = 1006;
195
196  // SQLException occurred when failed to record can learn topic.
197  TOPICS_RECORD_CAN_LEARN_TOPICS_FAILURE = 1007;
198
199  // SQLException occurred when failed to record returned topic.
200  TOPICS_RECORD_RETURNED_TOPICS_FAILURE = 1008;
201
202  // SQLException occurred when failed to record returned topic.
203  TOPICS_RECORD_BLOCKED_TOPICS_FAILURE = 1009;
204
205  // SQLException occurred when failed to remove blocked topic.
206  TOPICS_DELETE_BLOCKED_TOPICS_FAILURE = 1010;
207
208  // SQLException occurred when failed to delete old epochs.
209  TOPICS_DELETE_OLD_EPOCH_FAILURE = 1011;
210
211  // SQLException occurred when failed to delete a column in table
212  TOPICS_DELETE_COLUMN_FAILURE = 1012;
213
214  // SQLException occurred when failed to persist topic contributors.
215  TOPICS_PERSIST_TOPICS_CONTRIBUTORS_FAILURE = 1013;
216
217  // SQLException occurred when failed to delete all entries from table.
218  TOPICS_DELETE_ALL_ENTRIES_IN_TABLE_FAILURE = 1014;
219
220  // Exception occurred when classify call failed.
221  TOPICS_ON_DEVICE_CLASSIFY_FAILURE = 1015;
222
223  // Exception occurred ML model did not return a topic id.
224  TOPICS_ON_DEVICE_NUMBER_FORMAT_EXCEPTION = 1016;
225
226  // Exception occurred when failed to load ML model.
227  TOPICS_LOAD_ML_MODEL_FAILURE = 1017;
228
229  // Exception occurred when unable to retrieve topics id to topics name.
230  TOPICS_ID_TO_NAME_LIST_READ_FAILURE = 1018;
231
232  // Exception occurred when unable to read classifier asset file.
233  TOPICS_READ_CLASSIFIER_ASSET_FILE_FAILURE = 1019;
234
235  // NoSuchAlgorithmException occurred when unable to find correct message.
236  // digest algorithm.
237  TOPICS_MESSAGE_DIGEST_ALGORITHM_NOT_FOUND = 1020;
238
239  // Error occurred when failed to find downloaded classifier model file.
240  DOWNLOADED_CLASSIFIER_MODEL_FILE_NOT_FOUND = 1021;
241
242  // No downloaded or bundled classifier model available.
243  NO_CLASSIFIER_MODEL_AVAILABLE = 1022;
244
245  // Error occurred when failed to read labels file.
246  READ_LABELS_FILE_FAILURE = 1023;
247
248  // Error occurred when failed to read precomuted labels.
249  READ_PRECOMUTRED_LABELS_FAILURE = 1024;
250
251  // Error occurred when failed to read top apps file.
252  READ_TOP_APPS_FILE_FAILURE = 1025;
253
254  // Error occurred when saving a topic not in labels file.
255  INVALID_TOPIC_ID = 1026;
256
257  // Error occurred when failed to read precomuted app topics list.
258  READ_PRECOMUTRED_APP_TOPICS_LIST_FAILURE = 1027;
259
260  // Error occurred when failed to read bundled metadata file.
261  READ_BUNDLED_METADATA_FILE_FAILURE = 1028;
262
263  // Error occurred when reading redundant metadata property.
264  CLASSIFIER_METADATA_REDUNDANT_PROPERTY = 1029;
265
266  // Error occurred when reading redundant metadata asset.
267  CLASSIFIER_METADATA_REDUNDANT_ASSET = 1030;
268
269  // Error occurred when parsing metadata json missing property or asset_name.
270  CLASSIFIER_METADATA_MISSING_PROPERTY_OR_ASSET_NAME = 1031;
271
272  // Error occurred when failed to read classifier assets metadata file.
273  READ_CLASSIFIER_ASSETS_METADATA_FAILURE = 1032;
274
275  // Error occurred when failed to load downloaded file by file Id.
276  DOWNLOADED_CLASSIFIER_MODEL_FILE_LOAD_FAILURE = 1033;
277
278  // RuntimeException occurred when use invalid type of blocked topics
279  // source of truth.
280  TOPICS_INVALID_BLOCKED_TOPICS_SOURCE_OF_TRUTH = 1034;
281
282  // RuntimeException occurred when unable to remove the blocked topic.
283  TOPICS_REMOVE_BLOCKED_TOPIC_FAILURE = 1035;
284
285  // RuntimeException occurred when unable to get all blocked topics.
286  TOPICS_GET_BLOCKED_TOPIC_FAILURE = 1036;
287
288  // RuntimeException occurred when unable to clear all blocked topics
289  // in system server.
290  TOPICS_CLEAR_ALL_BLOCKED_TOPICS_IN_SYSTEM_SERVER_FAILURE = 1037;
291
292  // Error occurred when unable to handle JobService.
293  TOPICS_HANDLE_JOB_SERVICE_FAILURE = 1038;
294
295  // Error occurred when unable to fetch job scheduler.
296  TOPICS_FETCH_JOB_SCHEDULER_FAILURE = 1039;
297
298  // Error occurred while deleting a table for Topics.
299  TOPICS_DELETE_TABLE_FAILURE = 1040;
300
301  // Cobalt initialisation failure for Topics.
302  TOPICS_COBALT_LOGGER_INITIALIZATION_FAILURE = 1041;
303
304  // Failure to convert plaintext topic object to encrypted topic.
305  TOPICS_ENCRYPTION_FAILURE = 1042;
306
307  // Topics encryption key with invalid length.
308  TOPICS_ENCRYPTION_INVALID_KEY_LENGTH = 1043;
309
310  // Topics encryption with invalid response length.
311  TOPICS_ENCRYPTION_INVALID_RESPONSE_LENGTH = 1044;
312
313  // Topics encryption key failed to decode with Base64 decoder.
314  TOPICS_ENCRYPTION_KEY_DECODE_FAILURE = 1045;
315
316  // Topics encryption received null params in request for the encrypter.
317  TOPICS_ENCRYPTION_NULL_REQUEST = 1046;
318
319  // Topics encryption received null response from the encrypter.
320  TOPICS_ENCRYPTION_NULL_RESPONSE = 1047;
321
322  // Topics encryption received error while serialization to JSON.
323  TOPICS_ENCRYPTION_SERIALIZATION_ERROR = 1048;
324
325  // Topics encryption public key is missing.
326  TOPICS_ENCRYPTION_KEY_MISSING = 1049;
327
328  // Topics API request has empty sdk name.
329  TOPICS_REQUEST_EMPTY_SDK_NAME = 1050;
330
331  // Measurement errors: 2001-3000
332  // Error occurred when inserting enrollment data to DB.
333  ENROLLMENT_DATA_INSERT_ERROR = 2001;
334
335  // Error occurred when deleting enrollment data to DB.
336  ENROLLMENT_DATA_DELETE_ERROR = 2002;
337
338  // Measurement foreground unknown failure.
339  MEASUREMENT_FOREGROUND_UNKNOWN_FAILURE = 2003;
340
341  // Measurement datastore failure.
342  MEASUREMENT_DATASTORE_FAILURE = 2004;
343
344  // Measurement datastore unknown failure.
345  MEASUREMENT_DATASTORE_UNKNOWN_FAILURE = 2005;
346
347  // Measurement invalid parameter fetching public keys.
348  MEASUREMENT_PUBLIC_KEY_FETCHER_INVALID_PARAMETER = 2006;
349
350  // Measurement IO exception while fetching public keys.
351  MEASUREMENT_PUBLIC_KEY_FETCHER_IO_ERROR = 2007;
352
353  // Measurement error while parsing public keys.
354  MEASUREMENT_PUBLIC_KEY_FETCHER_PARSING_ERROR = 2008;
355
356  // Failure to save seed in SharedPreferences
357  ENROLLMENT_SHARED_PREFERENCES_SEED_SAVE_FAILURE = 2009;
358
359  // When report deliver fails due to a network issue (IOException).
360  MEASUREMENT_REPORTING_NETWORK_ERROR = 2010;
361
362  // When report delivery fails due to report building as JSON.
363  MEASUREMENT_REPORTING_PARSING_ERROR = 2011;
364
365  // When encryption of aggregate report fails.
366  MEASUREMENT_REPORTING_ENCRYPTION_ERROR = 2012;
367
368  // Reporting errors should have specific error codes.
369  MEASUREMENT_REPORTING_UNKNOWN_ERROR = 2013;
370
371  // When parsing of enrollment file fails.
372  ENROLLMENT_FAILED_PARSING = 2014;
373
374  // Error occurred when encountering invalid enrollment.
375  ENROLLMENT_INVALID = 2015;
376
377  // Error occurred when trying to get instance of an ODP system event manager
378  MEASUREMENT_REGISTRATION_ODP_GET_MANAGER_ERROR = 2016;
379
380  // Error due to the ODP header being in an invalid format
381  MEASUREMENT_REGISTRATION_ODP_INVALID_HEADER_FORMAT_ERROR = 2017;
382
383  // Error due to the ODP header missing a required field
384  MEASUREMENT_REGISTRATION_ODP_MISSING_REQUIRED_HEADER_FIELD_ERROR = 2018;
385
386  // Error due to the ODP header containing a field with an invalid value
387  MEASUREMENT_REGISTRATION_ODP_INVALID_HEADER_FIELD_VALUE_ERROR = 2019;
388
389  // Error occurred when trying to parse the ODP header (JSON Exception)
390  MEASUREMENT_REGISTRATION_ODP_JSON_PARSING_ERROR = 2020;
391
392  // Error occurred when trying to parse the ODP header (Unknown Exception)
393  MEASUREMENT_REGISTRATION_ODP_PARSING_UNKNOWN_ERROR = 2021;
394
395  // Error occurred when trying to initialize cobalt logger for measurement metrics.
396  MEASUREMENT_COBALT_LOGGER_INITIALIZATION_FAILURE = 2022;
397
398  // UX errors: 4001-5000
399  CONSENT_REVOKED_ERROR = 4001;
400
401  // Error occurred when failed to get downloaded OTA file URI.
402  DOWNLOADED_OTA_FILE_ERROR = 4002;
403
404  // Exception while trying to add ResourcesProvider.
405  RESOURCES_PROVIDER_ADD_ERROR = 4003;
406
407  // Exception occurred when unable to load MDD file group
408  LOAD_MDD_FILE_GROUP_FAILURE = 4004;
409
410  // Dismiss notification error
411  DISMISS_NOTIFICATION_FAILURE = 4005;
412
413  // Datastore exception while get content
414  DATASTORE_EXCEPTION_WHILE_GET_CONTENT = 4006;
415
416  // Datastore exception while recording notification
417  DATASTORE_EXCEPTION_WHILE_RECORDING_NOTIFICATION = 4007;
418
419  // Datastore exception while recording default consent.
420  DATASTORE_EXCEPTION_WHILE_RECORDING_DEFAULT_CONSENT = 4008;
421
422  // Exception while recording manual consent interaction
423  DATASTORE_EXCEPTION_WHILE_RECORDING_MANUAL_CONSENT_INTERACTION = 4009;
424
425  // Exception while saving privacy sandbox feature.
426  PRIVACY_SANDBOX_SAVE_FAILURE = 4010;
427
428  // Error message indicating invalid consent source of truth.
429  INVALID_CONSENT_SOURCE_OF_TRUTH = 4011;
430
431  // Error message while calling get consent.
432  ERROR_WHILE_GET_CONSENT = 4012;
433
434  // App search consent data migration failure.
435  APP_SEARCH_DATA_MIGRATION_FAILURE = 4013;
436
437  // Adservices entry point failure.
438  AD_SERVICES_ENTRY_POINT_FAILURE = 4014;
439
440  // Used to be MEASUREMENT_FOREGROUND_UNKNOWN_FAILURE but renamed in
441  // commit 94af8756d2f03ff17924721ee1b7c4a4520377ff
442  RESERVED_ERROR_CODE_4015 = 4015;
443
444  // FederatedCompute errors: 5001-6000
445  // Datastore exception while deleting a federated task.
446  DELETE_TASK_FAILURE = 5001;
447
448  // Exception while trying to close file descriptor.
449  FILE_DESCRIPTOR_CLOSE_ERROR = 5002;
450
451  // Error message indicating invalid federated job plan type.
452  CLIENT_PLAN_SPEC_ERROR = 5003;
453
454  // Exception when trying to parse protobuf message.
455  INVALID_PROTOBUF_ERROR = 5004;
456
457  // Exception occurred when isolated training process runs.
458  ISOLATED_TRAINING_PROCESS_ERROR = 5005;
459
460  // Exception while trying to iterate data.
461  ITERATOR_NEXT_FAILURE = 5006;
462
463  // Timeout exception while trying to iterate data.
464  ITERATOR__NEXT_TIMEOUT = 5007;
465
466  // Back Compat errors: 6001-7000
467  // AdExtDataService get failed
468  GET_ADEXT_DATA_SERVICE_ERROR = 6001;
469
470  // AdExtDataService put failed
471  PUT_ADEXT_DATA_SERVICE_ERROR = 6002;
472
473  // Failed to cancel background jobs in back compat init.
474  BACK_COMPAT_INIT_CANCEL_JOB_FAILURE = 6003;
475
476  // Failed to update UI activity enabled setting in back compat init.
477  BACK_COMPAT_INIT_UPDATE_ACTIVITY_FAILURE = 6004;
478
479  // Failed to update service enabled setting in back compat init.
480  BACK_COMPAT_INIT_UPDATE_SERVICE_FAILURE = 6005;
481
482  // Failed to enable package changed receiver in back compat init.
483  BACK_COMPAT_INIT_ENABLE_RECEIVER_FAILURE = 6006;
484
485  // Failed to disable package changed receiver in back compat init.
486  BACK_COMPAT_INIT_DISABLE_RECEIVER_FAILURE = 6007;
487
488  // Failed to run back compat init in boot completed receiver.
489  BACK_COMPAT_INIT_BOOT_COMPLETED_RECEIVER_FAILURE = 6008;
490
491  // IAPC errors: 7001-8000
492  // AdIdProviderService is not available.
493  IAPC_AD_ID_PROVIDER_NOT_AVAILABLE = 7001;
494  // Exception when calling UpdateAdId API in service side.
495  IAPC_UPDATE_AD_ID_API_ERROR = 7002;
496
497  // ODP errors: 8001-9000
498  // ODP generic error
499  ON_DEVICE_PERSONALIZATION_ERROR = 8001;
500
501  // ODP execute Isolated service error
502  ISOLATED_SERVICE_EXECUTE_ERROR = 8002;
503
504  // ODP download Isolated service error
505  ISOLATED_SERVICE_DOWNLOAD_ERROR = 8003;
506
507  // ODP render Isolated service error
508  ISOLATED_SERVICE_RENDER_ERROR = 8004;
509
510  // ODP web view event Isolated service error
511  ISOLATED_SERVICE_EVENT_ERROR = 8005;
512
513  // ODP training example Isolated service error
514  ISOLATED_SERVICE_TRAINING_EXAMPLE_ERROR = 8006;
515
516  // ODP web trigger Isolated service error
517  ISOLATED_SERVICE_WEB_TRIGGER_ERROR = 8007;
518}
519
520/**
521 * Adservices API names.
522 */
523enum PpapiName {
524  PPAPI_NAME_UNSPECIFIED = 0;
525  TOPICS = 1;
526  MEASUREMENT = 2;
527  FLEDGE = 3;
528  AD_ID = 4;
529  APP_SET_ID = 5;
530  UX = 6;
531  // Use COMMON enum when the error happens in the common code path.
532  COMMON = 7;
533  // Represents federatedcompute APK in OnDevicePersonalization module.
534  FEDERATED_COMPUTE = 8;
535  // Data service used for migrating consent from Android R
536  ADEXT_DATA_SERVICE = 9;
537  // Represents ondevicepersonalization APK of OnDevicePersonalization module.
538  ODP = 10;
539}
540
541/**
542 * Type of the result code that implies different execution results of Adservices background jobs.
543 */
544enum ExecutionResultCode {
545  /** Unspecified result code. */
546  UNSPECIFIED_CODE = 0;
547
548  /** Successful execution. */
549  SUCCESSFUL = 1;
550
551  /** Failed execution with retrying the job. */
552  FAILED_WITH_RETRY = 2;
553
554  /** Failed execution without retrying the job. */
555  FAILED_WITHOUT_RETRY = 3;
556
557  /** OnJobStop() is invoked with retrying the job. */
558  ONSTOP_CALLED_WITH_RETRY = 4;
559
560  /** OnJobStop() is invoked without retrying the job. */
561  ONSTOP_CALLED_WITHOUT_RETRY = 5;
562
563  /**
564   * The execution is halted by system or device for unknown reason, leaving
565   * a not finished execution.
566   */
567  HALTED_FOR_UNKNOWN_REASON = 6;
568
569  /** Skipped execution due to a job scheduled in ExtServices running on T+. */
570  SKIP_FOR_EXTSERVICES_JOB_ON_TPLUS = 7;
571
572  /** Skipped execution due to kill switch is on. */
573  SKIP_FOR_KILL_SWITCH_ON = 8;
574
575  /** Skipped execution due to user consent is revoked. */
576  SKIP_FOR_USER_CONSENT_REVOKED = 9;
577
578  /** Skipped execution due to job is not configured. */
579  SKIP_FOR_JOB_NOT_CONFIGURED = 10;
580
581  /** Skipped execution due to personalization not enabled. */
582  SKIP_FOR_PERSONALIZATION_NOT_ENABLED = 11;
583}
584
585/** Type of the result code that implies different scheduling results. */
586enum JobSchedulingResultCode {
587  // Default value.
588  SCHEDULING_RESULT_CODE_UNSPECIFIED = 0;
589
590  // Indicates the scheduling is successful.
591  SCHEDULING_RESULT_CODE_SUCCESSFUL = 1;
592
593  // Indicates the scheduling is failed.
594  SCHEDULING_RESULT_CODE_FAILED = 2;
595
596  // Indicates the scheduling is skipped due to same policy.
597  SCHEDULING_RESULT_CODE_SKIPPED = 3;
598}
599
600/** Type of scheduler used for the job scheduling. */
601enum SchedulerType {
602  // Default value.
603  SCHEDULER_TYPE_UNSPECIFIED = 0;
604
605  // Indicates the scheduler is Platform JobScheduler.
606  SCHEDULER_TYPE_JOB_SCHEDULER = 1;
607
608  // Indicates the scheduler is Platform SPE (Scheduling Policy Engine).
609  SCHEDULER_TYPE_SPE = 2;
610}
611
612// Region of the user who interacted with AdServicesSettings UI.
613enum AdServiceSettingRegion {
614  // fallback when getDeviceRegion call failed.
615  REGION_UNSPECIFIED = 0;
616  // European Union user (based on isoCountryInfo).
617  EU = 1;
618  // Non-European Union user (based on isoCountryInfo).
619  ROW = 2;
620}
621
622/* APIs whose access can be overridden by the app developer through the Android manifest. */
623enum AppApiAccessType {
624  API_ACCESS_TYPE_UNSPECIFIED = 0;
625  API_ACCESS_TYPE_TOPICS = 1;
626  API_ACCESS_TYPE_CUSTOM_AUDIENCES = 2;
627  API_ACCESS_TYPE_ATTRIBUTION = 3;
628  API_ACCESS_TYPE_PROTECTED_SIGNALS = 4;
629  API_ACCESS_TYPE_AD_SELECTION = 5;
630}
631
632/* Result of a call to check if an app allows access to a given AdServices API. */
633enum AppApiAccessResult {
634  API_ACCESS_RESULT_UNSPECIFIED = 0;
635  API_ACCESS_RESULT_ALLOWED_BY_DEFAULT_APP_DOES_NOT_HAVE_CONFIG = 1;
636  API_ACCESS_RESULT_ALLOWED_BY_DEFAULT_APP_HAS_CONFIG_WITHOUT_API_SECTION = 2;
637  API_ACCESS_RESULT_ALLOWED_APP_ALLOWS_ALL = 3;
638  API_ACCESS_RESULT_ALLOWED_APP_ALLOWS_SPECIFIC_ID = 4;
639  API_ACCESS_RESULT_DISALLOWED_APP_DOES_NOT_EXIST = 5;
640  API_ACCESS_RESULT_DISALLOWED_APP_CONFIG_PARSING_ERROR = 6;
641  API_ACCESS_RESULT_DISALLOWED_APP_DOES_NOT_HAVE_CONFIG = 7;
642  API_ACCESS_RESULT_DISALLOWED_APP_DOES_HAS_CONFIG_WITHOUT_API_SECTION = 8;
643  API_ACCESS_RESULT_DISALLOWED_BY_APP = 9;
644  API_ACCESS_RESULT_DISALLOWED_GENERIC_ERROR = 10;
645}
646
647// Module for which the job is reported.
648enum ModuleName {
649  UNKNOWN_MODULE_NAME = 0;
650  MODULE_NAME_ADSERVICES = 1;
651  MODULE_NAME_ON_DEVICE_PERSONALIZATION = 2;
652  MODULE_NAME_FEDERATED_COMPUTE = 3;
653}
654
655/**
656 * Enum representing a shell command. We will group enums in blocks of
657 * 100 like this below:
658 * - Common commands: 1-100
659 * - Custom audience commands: 101-200
660 * - Ad Selection commands: 201-300
661 *
662 */
663enum Command {
664  COMMAND_UNSET = 0;
665
666  // Common commands: 1-100
667  COMMAND_ECHO = 1;
668  COMMAND_IS_ALLOWED_ATTRIBUTION_ACCESS = 2;
669  COMMAND_IS_ALLOWED_PROTECTED_SIGNALS_ACCESS = 3;
670  COMMAND_IS_ALLOWED_CUSTOM_AUDIENCE_ACCESS = 4;
671  COMMAND_IS_ALLOWED_AD_SELECTION_ACCESS = 5;
672  COMMAND_IS_ALLOWED_TOPICS_ACCESS = 6;
673
674  // Custom audience commands: 101-200
675  COMMAND_CUSTOM_AUDIENCE_VIEW = 101;
676  COMMAND_CUSTOM_AUDIENCE_LIST = 102;
677  COMMAND_CUSTOM_AUDIENCE_REFRESH = 103;
678
679  // Ad Selection commands: 201-300
680  COMMAND_AD_SELECTION_CONSENTED_DEBUG_ENABLE = 201;
681  COMMAND_AD_SELECTION_CONSENTED_DEBUG_DISABLE = 202;
682  COMMAND_AD_SELECTION_CONSENTED_DEBUG_VIEW = 203;
683  COMMAND_AD_SELECTION_CONSENTED_DEBUG_HELP = 204;
684  COMMAND_AD_SELECTION_GET_AD_SELECTION_DATA = 205;
685  COMMAND_AD_SELECTION_MOCK_AUCTION = 206;
686
687  // Protected App Signals commands: 301-400
688  reserved 301;
689  COMMAND_APP_SIGNALS_GENERATE_INPUT_FOR_ENCODING = 302;
690}
691
692// Result of the shell command
693enum CommandResult {
694  COMMAND_RESULT_UNKNOWN = 0;
695  COMMAND_RESULT_SUCCESS = 1;
696  COMMAND_RESULT_GENERIC_ERROR = 2;
697  COMMAND_RESULT_INVALID_ARGS = 3;
698  COMMAND_RESULT_TIMEOUT_ERROR = 4;
699  COMMAND_RESULT_INVALID_COMMAND = 5;
700  COMMAND_RESULT_NOT_ENABLED = 6;
701}
702
703