1 /* 2 * Copyright (C) 2022 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 17 package android.adservices.ondevicepersonalization; 18 19 /** 20 * Constants used internally in the OnDevicePersonalization Module and not used in public APIs. 21 * 22 * @hide 23 */ 24 public class Constants { 25 // Status codes used within the ODP service or returned from service to manager classes. 26 // These will be mapped to existing platform exceptions or subclasses of 27 // OnDevicePersonalizationException in APIs. 28 public static final int STATUS_SUCCESS = 0; 29 public static final int STATUS_INTERNAL_ERROR = 100; 30 public static final int STATUS_NAME_NOT_FOUND = 101; 31 public static final int STATUS_CLASS_NOT_FOUND = 102; 32 public static final int STATUS_SERVICE_FAILED = 103; 33 public static final int STATUS_PERSONALIZATION_DISABLED = 104; 34 public static final int STATUS_KEY_NOT_FOUND = 105; 35 36 // Operations implemented by IsolatedService. 37 public static final int OP_EXECUTE = 1; 38 public static final int OP_DOWNLOAD = 2; 39 public static final int OP_RENDER = 3; 40 public static final int OP_WEB_VIEW_EVENT = 4; 41 public static final int OP_TRAINING_EXAMPLE = 5; 42 public static final int OP_WEB_TRIGGER = 6; 43 44 // Keys for Bundle objects passed between processes. 45 public static final String EXTRA_APP_PARAMS_SERIALIZED = 46 "android.ondevicepersonalization.extra.app_params_serialized"; 47 public static final String EXTRA_CALLEE_METADATA = 48 "android.ondevicepersonalization.extra.callee_metadata"; 49 public static final String EXTRA_DATA_ACCESS_SERVICE_BINDER = 50 "android.ondevicepersonalization.extra.data_access_service_binder"; 51 public static final String EXTRA_FEDERATED_COMPUTE_SERVICE_BINDER = 52 "android.ondevicepersonalization.extra.federated_computation_service_binder"; 53 public static final String EXTRA_MODEL_SERVICE_BINDER = 54 "android.ondevicepersonalization.extra.model_service_binder"; 55 public static final String EXTRA_DESTINATION_URL = 56 "android.ondevicepersonalization.extra.destination_url"; 57 public static final String EXTRA_EVENT_PARAMS = 58 "android.ondevicepersonalization.extra.event_params"; 59 public static final String EXTRA_INPUT = "android.ondevicepersonalization.extra.input"; 60 public static final String EXTRA_LOOKUP_KEYS = 61 "android.ondevicepersonalization.extra.lookup_keys"; 62 public static final String EXTRA_MEASUREMENT_WEB_TRIGGER_PARAMS = 63 "android.adservices.ondevicepersonalization.measurement_web_trigger_params"; 64 public static final String EXTRA_MIME_TYPE = "android.ondevicepersonalization.extra.mime_type"; 65 public static final String EXTRA_OUTPUT_DATA = 66 "android.ondevicepersonalization.extra.output_data"; 67 public static final String EXTRA_RESPONSE_DATA = 68 "android.ondevicepersonalization.extra.response_data"; 69 public static final String EXTRA_RESULT = "android.ondevicepersonalization.extra.result"; 70 public static final String EXTRA_SURFACE_PACKAGE_TOKEN_STRING = 71 "android.ondevicepersonalization.extra.surface_package_token_string"; 72 public static final String EXTRA_USER_DATA = "android.ondevicepersonalization.extra.user_data"; 73 public static final String EXTRA_VALUE = "android.ondevicepersonalization.extra.value"; 74 public static final String EXTRA_MODEL_INPUTS = 75 "android.ondevicepersonalization.extra.model_inputs"; 76 public static final String EXTRA_MODEL_OUTPUTS = 77 "android.ondevicepersonalization.extra.model_outputs"; 78 // Inference related constants, 79 public static final String EXTRA_INFERENCE_INPUT = 80 "android.ondevicepersonalization.extra.inference_input"; 81 public static final String EXTRA_MODEL_ID = "android.ondevicepersonalization.extra.model_id"; 82 83 // API Names for API metrics logging. Must match the values in 84 // frameworks/proto_logging/stats/atoms/ondevicepersonalization/ondevicepersonalization_extension_atoms.proto 85 public static final int API_NAME_UNKNOWN = 0; 86 public static final int API_NAME_EXECUTE = 1; 87 public static final int API_NAME_REQUEST_SURFACE_PACKAGE = 2; 88 public static final int API_NAME_SERVICE_ON_EXECUTE = 3; 89 public static final int API_NAME_SERVICE_ON_DOWNLOAD_COMPLETED = 4; 90 public static final int API_NAME_SERVICE_ON_RENDER = 5; 91 public static final int API_NAME_SERVICE_ON_EVENT = 6; 92 public static final int API_NAME_SERVICE_ON_TRAINING_EXAMPLE = 7; 93 public static final int API_NAME_SERVICE_ON_WEB_TRIGGER = 8; 94 public static final int API_NAME_REMOTE_DATA_GET = 9; 95 public static final int API_NAME_REMOTE_DATA_KEYSET = 10; 96 public static final int API_NAME_LOCAL_DATA_GET = 11; 97 public static final int API_NAME_LOCAL_DATA_KEYSET = 12; 98 public static final int API_NAME_LOCAL_DATA_PUT = 13; 99 public static final int API_NAME_LOCAL_DATA_REMOVE = 14; 100 public static final int API_NAME_EVENT_URL_CREATE_WITH_RESPONSE = 15; 101 public static final int API_NAME_EVENT_URL_CREATE_WITH_REDIRECT = 16; 102 public static final int API_NAME_LOG_READER_GET_REQUESTS = 17; 103 public static final int API_NAME_LOG_READER_GET_JOINED_EVENTS = 18; 104 public static final int API_NAME_FEDERATED_COMPUTE_SCHEDULE = 19; 105 public static final int API_NAME_MODEL_MANAGER_RUN = 20; 106 public static final int API_NAME_FEDERATED_COMPUTE_CANCEL = 21; 107 public static final int API_NAME_NOTIFY_MEASUREMENT_EVENT = 22; 108 109 // Data Access Service operations. 110 public static final int DATA_ACCESS_OP_REMOTE_DATA_LOOKUP = 1; 111 public static final int DATA_ACCESS_OP_REMOTE_DATA_KEYSET = 2; 112 public static final int DATA_ACCESS_OP_GET_EVENT_URL = 3; 113 public static final int DATA_ACCESS_OP_LOCAL_DATA_LOOKUP = 4; 114 public static final int DATA_ACCESS_OP_LOCAL_DATA_KEYSET = 5; 115 public static final int DATA_ACCESS_OP_LOCAL_DATA_PUT = 6; 116 public static final int DATA_ACCESS_OP_LOCAL_DATA_REMOVE = 7; 117 public static final int DATA_ACCESS_OP_GET_REQUESTS = 8; 118 public static final int DATA_ACCESS_OP_GET_JOINED_EVENTS = 9; 119 public static final int DATA_ACCESS_OP_GET_MODEL = 10; 120 121 // Measurement event types for measurement events received from the OS. 122 public static final int MEASUREMENT_EVENT_TYPE_WEB_TRIGGER = 1; 123 Constants()124 private Constants() {} 125 } 126