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 34 /** 35 * Internal code that tracks user privacy is not eligible to run operation. DO NOT expose this 36 * status externally. 37 */ 38 public static final int STATUS_PERSONALIZATION_DISABLED = 104; 39 40 public static final int STATUS_KEY_NOT_FOUND = 105; 41 42 /** Internal error code that tracks failure to read ODP manifest settings. */ 43 public static final int STATUS_MANIFEST_PARSING_FAILED = 106; 44 45 /** Internal error code that tracks misconfigured ODP manifest settings. */ 46 public static final int STATUS_MANIFEST_MISCONFIGURED = 107; 47 48 /** Internal error code that tracks errors in loading the Isolated Service. */ 49 public static final int STATUS_ISOLATED_SERVICE_LOADING_FAILED = 108; 50 51 /** Internal error code that tracks error when Isolated Service times out. */ 52 public static final int STATUS_ISOLATED_SERVICE_TIMEOUT = 109; 53 54 /** Internal error code that tracks error when the FCP manifest is invalid or missing. */ 55 public static final int STATUS_FCP_MANIFEST_INVALID = 110; 56 57 /** Internal code that tracks empty result returned from data storage or example store. */ 58 public static final int STATUS_SUCCESS_EMPTY_RESULT = 111; 59 60 /** Internal code that tracks timeout exception when run operation. */ 61 public static final int STATUS_TIMEOUT = 112; 62 63 /** Internal code that tracks remote exception when run operation. */ 64 public static final int STATUS_REMOTE_EXCEPTION = 113; 65 66 /** Internal code that tracks method not found. */ 67 public static final int STATUS_METHOD_NOT_FOUND = 114; 68 69 public static final int STATUS_CALLER_NOT_ALLOWED = 115; 70 public static final int STATUS_NULL_ADSERVICES_COMMON_MANAGER = 116; 71 72 // Internal code that tracks data access not included result returned from data storage. 73 public static final int STATUS_PERMISSION_DENIED = 117; 74 // Internal code that tracks local data read only result returned from data storage. 75 public static final int STATUS_LOCAL_DATA_READ_ONLY = 118; 76 // Internal code that tracks thread interrupted exception errors. 77 public static final int STATUS_EXECUTION_INTERRUPTED = 119; 78 // Internal code that tracks request timestamps invalid. 79 public static final int STATUS_REQUEST_TIMESTAMPS_INVALID = 120; 80 // Internal code that tracks request model table id invalid. 81 public static final int STATUS_MODEL_TABLE_ID_INVALID = 122; 82 // Internal code that tracks request model DB lookup failed. 83 public static final int STATUS_MODEL_DB_LOOKUP_FAILED = 123; 84 // Internal code that tracks request model lookup generic failure. 85 public static final int STATUS_MODEL_LOOKUP_FAILURE = 124; 86 // Internal code that tracks unsupported operation failure. 87 public static final int STATUS_DATA_ACCESS_UNSUPPORTED_OP = 125; 88 // Internal code that tracks generic data access failure. 89 public static final int STATUS_DATA_ACCESS_FAILURE = 126; 90 // Internal code that tracks local data access failure. 91 public static final int STATUS_LOCAL_WRITE_DATA_ACCESS_FAILURE = 127; 92 // Internal code that tracks parsing error. 93 public static final int STATUS_PARSE_ERROR = 128; 94 // Internal code that tracks non-empty but not enough data from data storage or example store. 95 public static final int STATUS_SUCCESS_NOT_ENOUGH_DATA = 129; 96 97 // Operations implemented by IsolatedService. 98 public static final int OP_EXECUTE = 1; 99 public static final int OP_DOWNLOAD = 2; 100 public static final int OP_RENDER = 3; 101 public static final int OP_WEB_VIEW_EVENT = 4; 102 public static final int OP_TRAINING_EXAMPLE = 5; 103 public static final int OP_WEB_TRIGGER = 6; 104 105 // Keys for Bundle objects passed between processes. 106 public static final String EXTRA_APP_PARAMS_SERIALIZED = 107 "android.ondevicepersonalization.extra.app_params_serialized"; 108 public static final String EXTRA_CALLEE_METADATA = 109 "android.ondevicepersonalization.extra.callee_metadata"; 110 public static final String EXTRA_DATA_ACCESS_SERVICE_BINDER = 111 "android.ondevicepersonalization.extra.data_access_service_binder"; 112 public static final String EXTRA_FEDERATED_COMPUTE_SERVICE_BINDER = 113 "android.ondevicepersonalization.extra.federated_computation_service_binder"; 114 public static final String EXTRA_MODEL_SERVICE_BINDER = 115 "android.ondevicepersonalization.extra.model_service_binder"; 116 public static final String EXTRA_DESTINATION_URL = 117 "android.ondevicepersonalization.extra.destination_url"; 118 public static final String EXTRA_EVENT_PARAMS = 119 "android.ondevicepersonalization.extra.event_params"; 120 public static final String EXTRA_INPUT = "android.ondevicepersonalization.extra.input"; 121 public static final String EXTRA_LOOKUP_KEYS = 122 "android.ondevicepersonalization.extra.lookup_keys"; 123 public static final String EXTRA_MEASUREMENT_WEB_TRIGGER_PARAMS = 124 "android.adservices.ondevicepersonalization.measurement_web_trigger_params"; 125 public static final String EXTRA_MIME_TYPE = "android.ondevicepersonalization.extra.mime_type"; 126 public static final String EXTRA_OUTPUT_DATA = 127 "android.ondevicepersonalization.extra.output_data"; 128 public static final String EXTRA_OUTPUT_BEST_VALUE = 129 "android.ondevicepersonalization.extra.output_best_value"; 130 public static final String EXTRA_RESPONSE_DATA = 131 "android.ondevicepersonalization.extra.response_data"; 132 public static final String EXTRA_RESULT = "android.ondevicepersonalization.extra.result"; 133 public static final String EXTRA_SURFACE_PACKAGE_TOKEN_STRING = 134 "android.ondevicepersonalization.extra.surface_package_token_string"; 135 public static final String EXTRA_USER_DATA = "android.ondevicepersonalization.extra.user_data"; 136 public static final String EXTRA_VALUE = "android.ondevicepersonalization.extra.value"; 137 public static final String EXTRA_MODEL_INPUTS = 138 "android.ondevicepersonalization.extra.model_inputs"; 139 public static final String EXTRA_MODEL_OUTPUTS = 140 "android.ondevicepersonalization.extra.model_outputs"; 141 // Inference related constants, 142 public static final String EXTRA_INFERENCE_INPUT = 143 "android.ondevicepersonalization.extra.inference_input"; 144 public static final String EXTRA_MODEL_ID = "android.ondevicepersonalization.extra.model_id"; 145 146 // API Names for API metrics logging. Must match the values in 147 // frameworks/proto_logging/stats/atoms/ondevicepersonalization/ondevicepersonalization_extension_atoms.proto 148 public static final int API_NAME_UNKNOWN = 0; 149 public static final int API_NAME_EXECUTE = 1; 150 public static final int API_NAME_REQUEST_SURFACE_PACKAGE = 2; 151 public static final int API_NAME_SERVICE_ON_EXECUTE = 3; 152 public static final int API_NAME_SERVICE_ON_DOWNLOAD_COMPLETED = 4; 153 public static final int API_NAME_SERVICE_ON_RENDER = 5; 154 public static final int API_NAME_SERVICE_ON_EVENT = 6; 155 public static final int API_NAME_SERVICE_ON_TRAINING_EXAMPLE = 7; 156 public static final int API_NAME_SERVICE_ON_WEB_TRIGGER = 8; 157 public static final int API_NAME_REMOTE_DATA_GET = 9; 158 public static final int API_NAME_REMOTE_DATA_KEYSET = 10; 159 public static final int API_NAME_LOCAL_DATA_GET = 11; 160 public static final int API_NAME_LOCAL_DATA_KEYSET = 12; 161 public static final int API_NAME_LOCAL_DATA_PUT = 13; 162 public static final int API_NAME_LOCAL_DATA_REMOVE = 14; 163 public static final int API_NAME_EVENT_URL_CREATE_WITH_RESPONSE = 15; 164 public static final int API_NAME_EVENT_URL_CREATE_WITH_REDIRECT = 16; 165 public static final int API_NAME_LOG_READER_GET_REQUESTS = 17; 166 public static final int API_NAME_LOG_READER_GET_JOINED_EVENTS = 18; 167 public static final int API_NAME_FEDERATED_COMPUTE_SCHEDULE = 19; 168 public static final int API_NAME_MODEL_MANAGER_RUN = 20; 169 public static final int API_NAME_FEDERATED_COMPUTE_CANCEL = 21; 170 public static final int API_NAME_NOTIFY_MEASUREMENT_EVENT = 22; 171 public static final int API_NAME_ADSERVICES_GET_COMMON_STATES = 23; 172 public static final int API_NAME_IS_FEATURE_ENABLED = 24; 173 174 // Data Access Service operations. 175 public static final int DATA_ACCESS_OP_REMOTE_DATA_LOOKUP = 1; 176 public static final int DATA_ACCESS_OP_REMOTE_DATA_KEYSET = 2; 177 public static final int DATA_ACCESS_OP_GET_EVENT_URL = 3; 178 public static final int DATA_ACCESS_OP_LOCAL_DATA_LOOKUP = 4; 179 public static final int DATA_ACCESS_OP_LOCAL_DATA_KEYSET = 5; 180 public static final int DATA_ACCESS_OP_LOCAL_DATA_PUT = 6; 181 public static final int DATA_ACCESS_OP_LOCAL_DATA_REMOVE = 7; 182 public static final int DATA_ACCESS_OP_GET_REQUESTS = 8; 183 public static final int DATA_ACCESS_OP_GET_JOINED_EVENTS = 9; 184 public static final int DATA_ACCESS_OP_GET_MODEL = 10; 185 186 // Measurement event types for measurement events received from the OS. 187 public static final int MEASUREMENT_EVENT_TYPE_WEB_TRIGGER = 1; 188 189 // Task type for trace event logging. Must match the values in 190 // frameworks/proto_logging/stats/atoms/ondevicepersonalization/ondevicepersonalization_extension_atoms.proto 191 public static final int TASK_TYPE_UNKNOWN = 0; 192 public static final int TASK_TYPE_EXECUTE = 1; 193 public static final int TASK_TYPE_RENDER = 2; 194 public static final int TASK_TYPE_DOWNLOAD = 3; 195 public static final int TASK_TYPE_WEBVIEW = 4; 196 public static final int TASK_TYPE_TRAINING = 5; 197 public static final int TASK_TYPE_MAINTENANCE = 6; 198 public static final int TASK_TYPE_WEB_TRIGGER = 7; 199 200 // Event type for trace event logging. Must match the values in 201 // frameworks/proto_logging/stats/atoms/ondevicepersonalization/ondevicepersonalization_extension_atoms.proto 202 public static final int EVENT_TYPE_UNKNOWN = 0; 203 public static final int EVENT_TYPE_WRITE_REQUEST_LOG = 1; 204 public static final int EVENT_TYPE_WRITE_EVENT_LOG = 2; 205 206 // Status for trace event logging. Must match the values in 207 // frameworks/proto_logging/stats/atoms/ondevicepersonalization/ondevicepersonalization_extension_atoms.proto 208 public static final int STATUS_REQUEST_LOG_DB_SUCCESS = 1; 209 public static final int STATUS_EVENT_LOG_DB_SUCCESS = 2; 210 public static final int STATUS_LOG_DB_FAILURE = 3; 211 public static final int STATUS_LOG_EXCEPTION = 4; 212 public static final int STATUS_REQUEST_LOG_IS_NULL = 5; 213 public static final int STATUS_REQUEST_LOG_IS_EMPTY = 6; 214 public static final int STATUS_EVENT_LOG_IS_NULL = 7; 215 public static final int STATUS_EVENT_LOG_NOT_EXIST = 8; 216 public static final int STATUS_EVENT_LOG_QUERY_NOT_EXIST = 9; 217 Constants()218 private Constants() {} 219 } 220