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 com.android.adservices.service; 18 19 import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND_SERVICE; 20 21 import static com.android.adservices.shared.common.flags.FeatureFlag.Type.LEGACY_KILL_SWITCH; 22 import static com.android.adservices.shared.common.flags.FeatureFlag.Type.LEGACY_KILL_SWITCH_GLOBAL; 23 import static com.android.adservices.shared.common.flags.FeatureFlag.Type.LEGACY_KILL_SWITCH_RAMPED_UP; 24 25 import android.annotation.IntDef; 26 import android.app.job.JobInfo; 27 28 import androidx.annotation.Nullable; 29 30 import com.android.adservices.cobalt.AppNameApiErrorLogger; 31 import com.android.adservices.cobalt.CobaltConstants; 32 import com.android.adservices.service.measurement.attribution.AttributionJobService; 33 import com.android.adservices.shared.common.flags.ConfigFlag; 34 import com.android.adservices.shared.common.flags.FeatureFlag; 35 import com.android.adservices.shared.common.flags.ModuleSharedFlags; 36 import com.android.adservices.spe.AdServicesJobServiceLogger; 37 import com.android.internal.annotations.VisibleForTesting; 38 import com.android.modules.utils.build.SdkLevel; 39 40 import com.google.common.collect.ImmutableList; 41 42 import java.io.PrintWriter; 43 import java.lang.annotation.Retention; 44 import java.lang.annotation.RetentionPolicy; 45 import java.util.HashMap; 46 import java.util.Map; 47 import java.util.concurrent.TimeUnit; 48 49 /** 50 * AdServices Feature Flags interface. This Flags interface hold the default values of Ad Services 51 * Flags. The default values in this class must match with the default values in PH since we will 52 * migrate to Flag Codegen in the future. With that migration, the Flags.java file will be generated 53 * from the GCL. 54 * 55 * <p><b>NOTE: </b>cannot have any dependency on Android or other AdServices code. 56 */ 57 public interface Flags extends ModuleSharedFlags { 58 /** Topics Epoch Job Period. */ 59 long TOPICS_EPOCH_JOB_PERIOD_MS = 7 * 86_400_000; // 7 days. 60 61 /** Returns the max time period (in millis) between each epoch computation job run. */ getTopicsEpochJobPeriodMs()62 default long getTopicsEpochJobPeriodMs() { 63 return TOPICS_EPOCH_JOB_PERIOD_MS; 64 } 65 66 /** 67 * Topics Epoch Job Flex. Note the minimum value system allows is 5 minutes or 5% of background 68 * job interval time, whichever is greater. Topics epoch job interval time is 7 days, so the 69 * minimum flex time should be 8.4 hours. 70 */ 71 @ConfigFlag long TOPICS_EPOCH_JOB_FLEX_MS = 9 * 60 * 60 * 1000; // 9 hours. 72 73 /** Returns flex for the Epoch computation job in Millisecond. */ getTopicsEpochJobFlexMs()74 default long getTopicsEpochJobFlexMs() { 75 return TOPICS_EPOCH_JOB_FLEX_MS; 76 } 77 78 /* The percentage that we will return a random topic from the Taxonomy. */ 79 int TOPICS_PERCENTAGE_FOR_RANDOM_TOPIC = 5; 80 81 /** Returns the percentage that we will return a random topic from the Taxonomy. */ getTopicsPercentageForRandomTopic()82 default int getTopicsPercentageForRandomTopic() { 83 return TOPICS_PERCENTAGE_FOR_RANDOM_TOPIC; 84 } 85 86 /** The number of top Topics for each epoch. */ 87 int TOPICS_NUMBER_OF_TOP_TOPICS = 5; 88 89 /** Returns the number of top topics. */ getTopicsNumberOfTopTopics()90 default int getTopicsNumberOfTopTopics() { 91 return TOPICS_NUMBER_OF_TOP_TOPICS; 92 } 93 94 /** The number of random Topics for each epoch. */ 95 int TOPICS_NUMBER_OF_RANDOM_TOPICS = 1; 96 97 /** Returns the number of top topics. */ getTopicsNumberOfRandomTopics()98 default int getTopicsNumberOfRandomTopics() { 99 return TOPICS_NUMBER_OF_RANDOM_TOPICS; 100 } 101 102 /** Global blocked Topics. Default value is empty list. */ 103 ImmutableList<Integer> TOPICS_GLOBAL_BLOCKED_TOPIC_IDS = ImmutableList.of(); 104 105 /** Returns a list of global blocked topics. */ getGlobalBlockedTopicIds()106 default ImmutableList<Integer> getGlobalBlockedTopicIds() { 107 return TOPICS_GLOBAL_BLOCKED_TOPIC_IDS; 108 } 109 110 /** How many epochs to look back when deciding if a caller has observed a topic before. */ 111 int TOPICS_NUMBER_OF_LOOK_BACK_EPOCHS = 3; 112 113 /** Flag to disable direct app calls for Topics API. go/app-calls-for-topics-api */ 114 boolean TOPICS_DISABLE_DIRECT_APP_CALLS = false; 115 116 /** Returns the flag to disable direct app calls for Topics API. */ getTopicsDisableDirectAppCalls()117 default boolean getTopicsDisableDirectAppCalls() { 118 return TOPICS_DISABLE_DIRECT_APP_CALLS; 119 } 120 121 /** Flag to enable encrypted Topics feature for Topics API. */ 122 boolean TOPICS_ENCRYPTION_ENABLED = false; 123 124 /** Returns the feature flag to enable encryption for Topics API. */ getTopicsEncryptionEnabled()125 default boolean getTopicsEncryptionEnabled() { 126 return TOPICS_ENCRYPTION_ENABLED; 127 } 128 129 /** Flag to enable Topics encryption metrics for Topics API. */ 130 boolean TOPICS_ENCRYPTION_METRICS_ENABLED = false; 131 132 /** Returns the feature flag to enable Topics encryption metrics for Topics API. */ getTopicsEncryptionMetricsEnabled()133 default boolean getTopicsEncryptionMetricsEnabled() { 134 return TOPICS_ENCRYPTION_METRICS_ENABLED; 135 } 136 137 /** Flag to enable Topics epoch job battery constraint logging for Topics API. */ 138 @FeatureFlag boolean TOPICS_EPOCH_JOB_BATTERY_CONSTRAINT_LOGGING_ENABLED = false; 139 140 /** 141 * Returns the feature flag to enable Topics epoch job battery constraint logging for Topics 142 * API. 143 */ getTopicsEpochJobBatteryConstraintLoggingEnabled()144 default boolean getTopicsEpochJobBatteryConstraintLoggingEnabled() { 145 return TOPICS_EPOCH_JOB_BATTERY_CONSTRAINT_LOGGING_ENABLED; 146 } 147 148 /** Flag to disable plaintext Topics for Topics API response. */ 149 boolean TOPICS_DISABLE_PLAINTEXT_RESPONSE = false; 150 151 /** Returns the feature flag to disable plaintext fields Topics API response. */ getTopicsDisablePlaintextResponse()152 default boolean getTopicsDisablePlaintextResponse() { 153 return TOPICS_DISABLE_PLAINTEXT_RESPONSE; 154 } 155 156 /** 157 * Flag to override base64 public key used for encryption testing. 158 * 159 * <p>Note: Default value for this flag should not be changed from empty. 160 */ 161 String TOPICS_TEST_ENCRYPTION_PUBLIC_KEY = ""; 162 163 /** Returns test public key used for encrypting topics for testing. */ getTopicsTestEncryptionPublicKey()164 default String getTopicsTestEncryptionPublicKey() { 165 return TOPICS_TEST_ENCRYPTION_PUBLIC_KEY; 166 } 167 168 /** 169 * Returns the number of epochs to look back when deciding if a caller has observed a topic 170 * before. 171 */ getTopicsNumberOfLookBackEpochs()172 default int getTopicsNumberOfLookBackEpochs() { 173 return TOPICS_NUMBER_OF_LOOK_BACK_EPOCHS; 174 } 175 176 /** Privacy budget for logging topic ID distributions with randomized response. */ 177 float TOPICS_PRIVACY_BUDGET_FOR_TOPIC_ID_DISTRIBUTION = 5f; 178 179 /** Returns the privacy budget for logging topic ID distributions with randomized response. */ getTopicsPrivacyBudgetForTopicIdDistribution()180 default float getTopicsPrivacyBudgetForTopicIdDistribution() { 181 return TOPICS_PRIVACY_BUDGET_FOR_TOPIC_ID_DISTRIBUTION; 182 } 183 184 /** 185 * Flag to enable rescheduling of Topics job scheduler tasks when modifications are made to the 186 * configuration of the background job. 187 */ 188 @FeatureFlag boolean TOPICS_JOB_SCHEDULER_RESCHEDULE_ENABLED = false; 189 190 /** Returns the feature flag to enable rescheduling of Topics job scheduler. */ getTopicsJobSchedulerRescheduleEnabled()191 default boolean getTopicsJobSchedulerRescheduleEnabled() { 192 return TOPICS_JOB_SCHEDULER_RESCHEDULE_ENABLED; 193 } 194 195 /** 196 * This flag allows you to execute the job regardless of the device's charging status. 197 * 198 * <p>By default, the Topics API background job scheduler requires the device to be in charging 199 * mode for job execution. The default value for this flag is false, indicating that the job 200 * should only be executed when the device is charging. By enabling this flag, the job can be 201 * executed when the battery level is not low. 202 */ 203 @FeatureFlag boolean TOPICS_EPOCH_JOB_BATTERY_NOT_LOW_INSTEAD_OF_CHARGING = false; 204 205 /** 206 * Returns the feature flag to enable the device to be in batter not low mode for Topics API job 207 * execution. 208 */ getTopicsEpochJobBatteryNotLowInsteadOfCharging()209 default boolean getTopicsEpochJobBatteryNotLowInsteadOfCharging() { 210 return TOPICS_EPOCH_JOB_BATTERY_NOT_LOW_INSTEAD_OF_CHARGING; 211 } 212 213 /** 214 * Flag to enable cleaning Topics database when the settings of Topics epoch job is changed from 215 * server side. 216 */ 217 @FeatureFlag boolean TOPICS_CLEAN_DB_WHEN_EPOCH_JOB_SETTINGS_CHANGED = false; 218 219 /** 220 * Returns the feature flag to enable cleaning Topics database when epoch job settings changed. 221 */ getTopicsCleanDBWhenEpochJobSettingsChanged()222 default boolean getTopicsCleanDBWhenEpochJobSettingsChanged() { 223 return TOPICS_CLEAN_DB_WHEN_EPOCH_JOB_SETTINGS_CHANGED; 224 } 225 226 /** Available types of classifier behaviours for the Topics API. */ 227 @IntDef( 228 flag = true, 229 value = { 230 UNKNOWN_CLASSIFIER, 231 ON_DEVICE_CLASSIFIER, 232 PRECOMPUTED_CLASSIFIER, 233 PRECOMPUTED_THEN_ON_DEVICE_CLASSIFIER 234 }) 235 @Retention(RetentionPolicy.SOURCE) 236 @interface ClassifierType {} 237 238 /** Unknown classifier option. */ 239 int UNKNOWN_CLASSIFIER = 0; 240 241 /** Only on-device classification. */ 242 int ON_DEVICE_CLASSIFIER = 1; 243 244 /** Only Precomputed classification. */ 245 int PRECOMPUTED_CLASSIFIER = 2; 246 247 /** Precomputed classification values are preferred over on-device classification values. */ 248 int PRECOMPUTED_THEN_ON_DEVICE_CLASSIFIER = 3; 249 250 /* Type of classifier intended to be used by default. */ 251 @ClassifierType int DEFAULT_CLASSIFIER_TYPE = PRECOMPUTED_THEN_ON_DEVICE_CLASSIFIER; 252 253 /** Returns the type of classifier currently used by Topics. */ 254 @ClassifierType getClassifierType()255 default int getClassifierType() { 256 return DEFAULT_CLASSIFIER_TYPE; 257 } 258 259 /** Number of top labels allowed for every app. */ 260 int CLASSIFIER_NUMBER_OF_TOP_LABELS = 3; 261 262 /** Returns the number of top labels allowed for every app after the classification process. */ getClassifierNumberOfTopLabels()263 default int getClassifierNumberOfTopLabels() { 264 return CLASSIFIER_NUMBER_OF_TOP_LABELS; 265 } 266 267 /** Threshold value for classification values. */ 268 float CLASSIFIER_THRESHOLD = 0.2f; 269 270 /** Returns the threshold value for classification values. */ getClassifierThreshold()271 default float getClassifierThreshold() { 272 return CLASSIFIER_THRESHOLD; 273 } 274 275 /** Number of max words allowed in the description for topics classifier. */ 276 int CLASSIFIER_DESCRIPTION_MAX_WORDS = 500; 277 278 /** Returns the number of max words allowed in the description for topics classifier. */ getClassifierDescriptionMaxWords()279 default int getClassifierDescriptionMaxWords() { 280 return CLASSIFIER_DESCRIPTION_MAX_WORDS; 281 } 282 283 /** Number of max characters allowed in the description for topics classifier. */ 284 int CLASSIFIER_DESCRIPTION_MAX_LENGTH = 2500; 285 286 /** Returns the number of max characters allowed in the description for topics classifier. */ getClassifierDescriptionMaxLength()287 default int getClassifierDescriptionMaxLength() { 288 return CLASSIFIER_DESCRIPTION_MAX_LENGTH; 289 } 290 291 // TODO(b/243829477): Remove this flag when flow of pushing models is refined. 292 /** 293 * Whether classifier should force using bundled files. This flag is mainly used in CTS tests to 294 * force using precomputed_app_list to avoid model mismatch due to update. Default value is 295 * false which means to use downloaded files. 296 */ 297 boolean CLASSIFIER_FORCE_USE_BUNDLED_FILES = false; 298 299 /** Returns whether to force using bundled files */ getClassifierForceUseBundledFiles()300 default boolean getClassifierForceUseBundledFiles() { 301 return CLASSIFIER_FORCE_USE_BUNDLED_FILES; 302 } 303 304 /* The default period for the Maintenance job. */ 305 long MAINTENANCE_JOB_PERIOD_MS = 86_400_000; // 1 day. 306 307 /** Returns the max time period (in millis) between each idle maintenance job run. */ getMaintenanceJobPeriodMs()308 default long getMaintenanceJobPeriodMs() { 309 return MAINTENANCE_JOB_PERIOD_MS; 310 } 311 312 /* The default flex for Maintenance Job. */ 313 long MAINTENANCE_JOB_FLEX_MS = 3 * 60 * 60 * 1000; // 3 hours. 314 315 /** Returns flex for the Daily Maintenance job in Millisecond. */ getMaintenanceJobFlexMs()316 default long getMaintenanceJobFlexMs() { 317 return MAINTENANCE_JOB_FLEX_MS; 318 } 319 getEncryptionKeyNetworkConnectTimeoutMs()320 default int getEncryptionKeyNetworkConnectTimeoutMs() { 321 return ENCRYPTION_KEY_NETWORK_CONNECT_TIMEOUT_MS; 322 } 323 324 int ENCRYPTION_KEY_NETWORK_CONNECT_TIMEOUT_MS = (int) TimeUnit.SECONDS.toMillis(5); 325 getEncryptionKeyNetworkReadTimeoutMs()326 default int getEncryptionKeyNetworkReadTimeoutMs() { 327 return ENCRYPTION_KEY_NETWORK_READ_TIMEOUT_MS; 328 } 329 330 int ENCRYPTION_KEY_NETWORK_READ_TIMEOUT_MS = (int) TimeUnit.SECONDS.toMillis(30); 331 332 /* The default min time period (in millis) between each event main reporting job run. */ 333 long MEASUREMENT_EVENT_MAIN_REPORTING_JOB_PERIOD_MS = 4 * 60 * 60 * 1000; // 4 hours. 334 335 /** Returns min time period (in millis) between each event main reporting job run. */ getMeasurementEventMainReportingJobPeriodMs()336 default long getMeasurementEventMainReportingJobPeriodMs() { 337 return MEASUREMENT_EVENT_MAIN_REPORTING_JOB_PERIOD_MS; 338 } 339 340 /* The default min time period (in millis) between each event fallback reporting job run. */ 341 long MEASUREMENT_EVENT_FALLBACK_REPORTING_JOB_PERIOD_MS = 24 * 60 * 60 * 1000; // 24 hours. 342 343 /** Returns min time period (in millis) between each event fallback reporting job run. */ getMeasurementEventFallbackReportingJobPeriodMs()344 default long getMeasurementEventFallbackReportingJobPeriodMs() { 345 return MEASUREMENT_EVENT_FALLBACK_REPORTING_JOB_PERIOD_MS; 346 } 347 348 /* The default value for whether the trigger debugging availability signal is enabled for event 349 or aggregate reports. */ 350 @FeatureFlag boolean MEASUREMENT_ENABLE_TRIGGER_DEBUG_SIGNAL = false; 351 352 /** 353 * Returns whether the trigger debugging availability signal is enabled for event or aggregate 354 * reports. 355 */ getMeasurementEnableTriggerDebugSignal()356 default boolean getMeasurementEnableTriggerDebugSignal() { 357 return MEASUREMENT_ENABLE_TRIGGER_DEBUG_SIGNAL; 358 } 359 360 /* The default value for whether the trigger debugging availability signal is enabled for event 361 reports that have coarse_event_report_destinations = true. */ 362 @FeatureFlag 363 boolean MEASUREMENT_ENABLE_EVENT_TRIGGER_DEBUG_SIGNAL_FOR_COARSE_DESTINATION = false; 364 365 /** 366 * Returns whether the trigger debugging availability signal is enabled for event reports that 367 * have coarse_event_report_destinations = true. 368 */ getMeasurementEnableEventTriggerDebugSignalForCoarseDestination()369 default boolean getMeasurementEnableEventTriggerDebugSignalForCoarseDestination() { 370 return MEASUREMENT_ENABLE_EVENT_TRIGGER_DEBUG_SIGNAL_FOR_COARSE_DESTINATION; 371 } 372 373 /* The float to control the probability to set trigger debugging availability signal for fake 374 event reports. */ 375 @ConfigFlag float MEASUREMENT_TRIGGER_DEBUG_SIGNAL_PROBABILITY_FOR_FAKE_REPORTS = 0.5F; 376 377 /** 378 * Returns the possibility of trigger debugging availability signal being true for fake event 379 * reports. 380 */ getMeasurementTriggerDebugSignalProbabilityForFakeReports()381 default float getMeasurementTriggerDebugSignalProbabilityForFakeReports() { 382 return MEASUREMENT_TRIGGER_DEBUG_SIGNAL_PROBABILITY_FOR_FAKE_REPORTS; 383 } 384 385 /** 386 * The suffix that is appended to the aggregation coordinator origin for retrieving the 387 * encryption keys. 388 */ 389 String MEASUREMENT_AGGREGATION_COORDINATOR_PATH = 390 ".well-known/aggregation-service/v1/public-keys"; 391 392 /** Returns the URL for fetching public encryption keys for aggregatable reports. */ getMeasurementAggregationCoordinatorPath()393 default String getMeasurementAggregationCoordinatorPath() { 394 return MEASUREMENT_AGGREGATION_COORDINATOR_PATH; 395 } 396 397 boolean MEASUREMENT_AGGREGATION_COORDINATOR_ORIGIN_ENABLED = true; 398 399 /** Returns true if aggregation coordinator origin is enabled. */ getMeasurementAggregationCoordinatorOriginEnabled()400 default boolean getMeasurementAggregationCoordinatorOriginEnabled() { 401 return MEASUREMENT_AGGREGATION_COORDINATOR_ORIGIN_ENABLED; 402 } 403 404 /** 405 * Default list(comma-separated) of origins for creating a URL used to fetch public encryption 406 * keys for aggregatable reports. 407 */ 408 String MEASUREMENT_AGGREGATION_COORDINATOR_ORIGIN_LIST = 409 "https://publickeyservice.msmt.aws.privacysandboxservices.com," 410 + "https://publickeyservice.msmt.gcp.privacysandboxservices.com"; 411 412 /** 413 * Returns a string which is a comma separated list of origins used to fetch public encryption 414 * keys for aggregatable reports. 415 */ getMeasurementAggregationCoordinatorOriginList()416 default String getMeasurementAggregationCoordinatorOriginList() { 417 return MEASUREMENT_AGGREGATION_COORDINATOR_ORIGIN_LIST; 418 } 419 420 /* The list of origins for creating a URL used to fetch public encryption keys for 421 aggregatable reports. AWS is the current default. */ 422 String MEASUREMENT_DEFAULT_AGGREGATION_COORDINATOR_ORIGIN = 423 "https://publickeyservice.msmt.aws.privacysandboxservices.com"; 424 425 /** 426 * Returns the default origin for creating the URI used to fetch public encryption keys for 427 * aggregatable reports. 428 */ getMeasurementDefaultAggregationCoordinatorOrigin()429 default String getMeasurementDefaultAggregationCoordinatorOrigin() { 430 return MEASUREMENT_DEFAULT_AGGREGATION_COORDINATOR_ORIGIN; 431 } 432 433 /* The default min time period (in millis) between each aggregate main reporting job run. */ 434 long MEASUREMENT_AGGREGATE_MAIN_REPORTING_JOB_PERIOD_MS = 4 * 60 * 60 * 1000; // 4 hours. 435 436 /** Returns min time period (in millis) between each aggregate main reporting job run. */ getMeasurementAggregateMainReportingJobPeriodMs()437 default long getMeasurementAggregateMainReportingJobPeriodMs() { 438 return MEASUREMENT_AGGREGATE_MAIN_REPORTING_JOB_PERIOD_MS; 439 } 440 441 /* The default min time period (in millis) between each aggregate fallback reporting job run. */ 442 long MEASUREMENT_AGGREGATE_FALLBACK_REPORTING_JOB_PERIOD_MS = 24 * 60 * 60 * 1000; // 24 hours. 443 444 /** Returns min time period (in millis) between each aggregate fallback job run. */ getMeasurementAggregateFallbackReportingJobPeriodMs()445 default long getMeasurementAggregateFallbackReportingJobPeriodMs() { 446 return MEASUREMENT_AGGREGATE_FALLBACK_REPORTING_JOB_PERIOD_MS; 447 } 448 449 /** 450 * Returns the maximum time in milliseconds allowed for a network call to open its initial 451 * connection during Measurement API calls. 452 */ getMeasurementNetworkConnectTimeoutMs()453 default int getMeasurementNetworkConnectTimeoutMs() { 454 return MEASUREMENT_NETWORK_CONNECT_TIMEOUT_MS; 455 } 456 457 /** 458 * Returns the maximum time in milliseconds allowed for a network call to read a response from a 459 * target server during Measurement API calls. 460 */ getMeasurementNetworkReadTimeoutMs()461 default int getMeasurementNetworkReadTimeoutMs() { 462 return MEASUREMENT_NETWORK_READ_TIMEOUT_MS; 463 } 464 465 long MEASUREMENT_DB_SIZE_LIMIT = (1024 * 1024) * 10; // 10 MBs 466 int MEASUREMENT_NETWORK_CONNECT_TIMEOUT_MS = (int) TimeUnit.SECONDS.toMillis(5); 467 int MEASUREMENT_NETWORK_READ_TIMEOUT_MS = (int) TimeUnit.SECONDS.toMillis(30); 468 int MEASUREMENT_REPORT_RETRY_LIMIT = 3; 469 boolean MEASUREMENT_REPORT_RETRY_LIMIT_ENABLED = true; 470 471 /** 472 * Returns the window that an InputEvent has to be within for the system to register it as a 473 * click. 474 */ 475 long MEASUREMENT_REGISTRATION_INPUT_EVENT_VALID_WINDOW_MS = 60 * 1000; // 1 minute. 476 getMeasurementRegistrationInputEventValidWindowMs()477 default long getMeasurementRegistrationInputEventValidWindowMs() { 478 return MEASUREMENT_REGISTRATION_INPUT_EVENT_VALID_WINDOW_MS; 479 } 480 481 /** Returns whether a click event should be verified before a registration request. */ 482 boolean MEASUREMENT_IS_CLICK_VERIFICATION_ENABLED = true; 483 getMeasurementIsClickVerificationEnabled()484 default boolean getMeasurementIsClickVerificationEnabled() { 485 return MEASUREMENT_IS_CLICK_VERIFICATION_ENABLED; 486 } 487 488 /** Returns whether a click is verified by Input Event. */ 489 boolean MEASUREMENT_IS_CLICK_VERIFIED_BY_INPUT_EVENT = false; 490 getMeasurementIsClickVerifiedByInputEvent()491 default boolean getMeasurementIsClickVerifiedByInputEvent() { 492 return MEASUREMENT_IS_CLICK_VERIFIED_BY_INPUT_EVENT; 493 } 494 495 /** Returns whether measurement click deduplication is enabled. */ getMeasurementIsClickDeduplicationEnabled()496 default boolean getMeasurementIsClickDeduplicationEnabled() { 497 return MEASUREMENT_IS_CLICK_DEDUPLICATION_ENABLED; 498 } 499 500 /** Default whether measurement click deduplication is enabled. */ 501 boolean MEASUREMENT_IS_CLICK_DEDUPLICATION_ENABLED = false; 502 503 /** Returns whether measurement click deduplication is enforced. */ getMeasurementIsClickDeduplicationEnforced()504 default boolean getMeasurementIsClickDeduplicationEnforced() { 505 return MEASUREMENT_IS_CLICK_DEDUPLICATION_ENFORCED; 506 } 507 508 /** Default whether measurement click deduplication is enforced. */ 509 boolean MEASUREMENT_IS_CLICK_DEDUPLICATION_ENFORCED = false; 510 511 /** Returns the number of sources that can be registered with a single click. */ getMeasurementMaxSourcesPerClick()512 default long getMeasurementMaxSourcesPerClick() { 513 return MEASUREMENT_MAX_SOURCES_PER_CLICK; 514 } 515 516 /** Default max number of sources that can be registered with single click. */ 517 long MEASUREMENT_MAX_SOURCES_PER_CLICK = 1; 518 519 /** Returns the DB size limit for measurement. */ getMeasurementDbSizeLimit()520 default long getMeasurementDbSizeLimit() { 521 return MEASUREMENT_DB_SIZE_LIMIT; 522 } 523 524 /** Returns Whether to limit number of Retries for Measurement Reports */ getMeasurementReportingRetryLimitEnabled()525 default boolean getMeasurementReportingRetryLimitEnabled() { 526 return MEASUREMENT_REPORT_RETRY_LIMIT_ENABLED; 527 } 528 529 /** Returns Maximum number of Retries for Measurement Reportss */ getMeasurementReportingRetryLimit()530 default int getMeasurementReportingRetryLimit() { 531 return MEASUREMENT_REPORT_RETRY_LIMIT; 532 } 533 534 /** Measurement manifest file url, used for MDD download. */ 535 String MEASUREMENT_MANIFEST_FILE_URL = 536 "https://www.gstatic.com/mdi-serving/rubidium-adservices-adtech-enrollment/8409" 537 + "/61e771d6656d87e705d99f3e80d95011ae295d82"; // Generated on 2025-01-07 538 539 /** Measurement manifest file url. */ getMeasurementManifestFileUrl()540 default String getMeasurementManifestFileUrl() { 541 return MEASUREMENT_MANIFEST_FILE_URL; 542 } 543 544 boolean MEASUREMENT_ENABLE_XNA = false; 545 546 /** Returns whether XNA should be used for eligible sources. */ getMeasurementEnableXNA()547 default boolean getMeasurementEnableXNA() { 548 return MEASUREMENT_ENABLE_XNA; 549 } 550 551 boolean MEASUREMENT_ENABLE_SHARED_SOURCE_DEBUG_KEY = true; 552 553 /** Enable/disable shared_debug_key processing from source RBR. */ getMeasurementEnableSharedSourceDebugKey()554 default boolean getMeasurementEnableSharedSourceDebugKey() { 555 return MEASUREMENT_ENABLE_SHARED_SOURCE_DEBUG_KEY; 556 } 557 558 boolean MEASUREMENT_ENABLE_SHARED_FILTER_DATA_KEYS_XNA = true; 559 560 /** Enable/disable shared_filter_data_keys processing from source RBR. */ getMeasurementEnableSharedFilterDataKeysXNA()561 default boolean getMeasurementEnableSharedFilterDataKeysXNA() { 562 return MEASUREMENT_ENABLE_SHARED_FILTER_DATA_KEYS_XNA; 563 } 564 565 boolean MEASUREMENT_ENABLE_DEBUG_REPORT = true; 566 567 /** Returns whether verbose debug report generation is enabled. */ getMeasurementEnableDebugReport()568 default boolean getMeasurementEnableDebugReport() { 569 return MEASUREMENT_ENABLE_DEBUG_REPORT; 570 } 571 572 boolean MEASUREMENT_ENABLE_SOURCE_DEBUG_REPORT = true; 573 574 /** Returns whether source debug report generation is enabled. */ getMeasurementEnableSourceDebugReport()575 default boolean getMeasurementEnableSourceDebugReport() { 576 return MEASUREMENT_ENABLE_SOURCE_DEBUG_REPORT; 577 } 578 579 boolean MEASUREMENT_ENABLE_TRIGGER_DEBUG_REPORT = true; 580 581 /** Returns whether trigger debug report generation is enabled. */ getMeasurementEnableTriggerDebugReport()582 default boolean getMeasurementEnableTriggerDebugReport() { 583 return MEASUREMENT_ENABLE_TRIGGER_DEBUG_REPORT; 584 } 585 586 /** Default value for whether header error debug report is enabled. */ 587 @FeatureFlag boolean MEASUREMENT_ENABLE_HEADER_ERROR_DEBUG_REPORT = false; 588 589 /** Returns whether header error debug report generation is enabled. */ getMeasurementEnableHeaderErrorDebugReport()590 default boolean getMeasurementEnableHeaderErrorDebugReport() { 591 return MEASUREMENT_ENABLE_HEADER_ERROR_DEBUG_REPORT; 592 } 593 594 long MEASUREMENT_DATA_EXPIRY_WINDOW_MS = TimeUnit.DAYS.toMillis(37); 595 596 /** Returns the data expiry window in milliseconds. */ getMeasurementDataExpiryWindowMs()597 default long getMeasurementDataExpiryWindowMs() { 598 return MEASUREMENT_DATA_EXPIRY_WINDOW_MS; 599 } 600 601 int MEASUREMENT_MAX_REGISTRATION_REDIRECTS = 20; 602 603 /** Returns the number of maximum registration redirects allowed. */ getMeasurementMaxRegistrationRedirects()604 default int getMeasurementMaxRegistrationRedirects() { 605 return MEASUREMENT_MAX_REGISTRATION_REDIRECTS; 606 } 607 608 int MEASUREMENT_MAX_REGISTRATIONS_PER_JOB_INVOCATION = 100; 609 610 /** Returns the number of maximum registration per job invocation. */ getMeasurementMaxRegistrationsPerJobInvocation()611 default int getMeasurementMaxRegistrationsPerJobInvocation() { 612 return MEASUREMENT_MAX_REGISTRATIONS_PER_JOB_INVOCATION; 613 } 614 615 int MEASUREMENT_MAX_RETRIES_PER_REGISTRATION_REQUEST = 5; 616 617 /** Returns the number of maximum retires per registration request. */ getMeasurementMaxRetriesPerRegistrationRequest()618 default int getMeasurementMaxRetriesPerRegistrationRequest() { 619 return MEASUREMENT_MAX_RETRIES_PER_REGISTRATION_REQUEST; 620 } 621 622 long DEFAULT_MEASUREMENT_ASYNC_REGISTRATION_JOB_TRIGGER_MIN_DELAY_MS = 623 TimeUnit.MINUTES.toMillis(2); 624 625 /** 626 * Returns the minimum delay (in milliseconds) in job triggering after a registration request is 627 * received. 628 */ getMeasurementAsyncRegistrationJobTriggerMinDelayMs()629 default long getMeasurementAsyncRegistrationJobTriggerMinDelayMs() { 630 return DEFAULT_MEASUREMENT_ASYNC_REGISTRATION_JOB_TRIGGER_MIN_DELAY_MS; 631 } 632 633 long DEFAULT_MEASUREMENT_ASYNC_REGISTRATION_JOB_TRIGGER_MAX_DELAY_MS = 634 TimeUnit.MINUTES.toMillis(5); 635 636 /** 637 * Returns the maximum delay (in milliseconds) in job triggering after a registration request is 638 * received. 639 */ getMeasurementAsyncRegistrationJobTriggerMaxDelayMs()640 default long getMeasurementAsyncRegistrationJobTriggerMaxDelayMs() { 641 return DEFAULT_MEASUREMENT_ASYNC_REGISTRATION_JOB_TRIGGER_MAX_DELAY_MS; 642 } 643 644 int DEFAULT_MEASUREMENT_MAX_ATTRIBUTIONS_PER_INVOCATION = 100; 645 646 /** Max number of {@link Trigger} to process per job for {@link AttributionJobService} */ getMeasurementMaxAttributionsPerInvocation()647 default int getMeasurementMaxAttributionsPerInvocation() { 648 return DEFAULT_MEASUREMENT_MAX_ATTRIBUTIONS_PER_INVOCATION; 649 } 650 651 long DEFAULT_MEASUREMENT_MAX_EVENT_REPORT_UPLOAD_RETRY_WINDOW_MS = TimeUnit.DAYS.toMillis(28); 652 653 /** Maximum event report upload retry window. */ getMeasurementMaxEventReportUploadRetryWindowMs()654 default long getMeasurementMaxEventReportUploadRetryWindowMs() { 655 return DEFAULT_MEASUREMENT_MAX_EVENT_REPORT_UPLOAD_RETRY_WINDOW_MS; 656 } 657 658 long DEFAULT_MEASUREMENT_MAX_AGGREGATE_REPORT_UPLOAD_RETRY_WINDOW_MS = 659 TimeUnit.DAYS.toMillis(28); 660 661 /** Maximum aggregate report upload retry window. */ getMeasurementMaxAggregateReportUploadRetryWindowMs()662 default long getMeasurementMaxAggregateReportUploadRetryWindowMs() { 663 return DEFAULT_MEASUREMENT_MAX_AGGREGATE_REPORT_UPLOAD_RETRY_WINDOW_MS; 664 } 665 666 long DEFAULT_MEASUREMENT_MAX_DELAYED_SOURCE_REGISTRATION_WINDOW = TimeUnit.MINUTES.toMillis(2); 667 668 /** Maximum window for a delayed source to be considered valid instead of missed. */ getMeasurementMaxDelayedSourceRegistrationWindow()669 default long getMeasurementMaxDelayedSourceRegistrationWindow() { 670 return DEFAULT_MEASUREMENT_MAX_DELAYED_SOURCE_REGISTRATION_WINDOW; 671 } 672 673 int DEFAULT_MEASUREMENT_MAX_BYTES_PER_ATTRIBUTION_FILTER_STRING = 25; 674 675 /** Maximum number of bytes allowed in an attribution filter string. */ getMeasurementMaxBytesPerAttributionFilterString()676 default int getMeasurementMaxBytesPerAttributionFilterString() { 677 return DEFAULT_MEASUREMENT_MAX_BYTES_PER_ATTRIBUTION_FILTER_STRING; 678 } 679 680 int DEFAULT_MEASUREMENT_MAX_FILTER_MAPS_PER_FILTER_SET = 20; 681 682 /** Maximum number of filter maps allowed in an attribution filter set. */ getMeasurementMaxFilterMapsPerFilterSet()683 default int getMeasurementMaxFilterMapsPerFilterSet() { 684 return DEFAULT_MEASUREMENT_MAX_FILTER_MAPS_PER_FILTER_SET; 685 } 686 687 int DEFAULT_MEASUREMENT_MAX_VALUES_PER_ATTRIBUTION_FILTER = 50; 688 689 /** Maximum number of values allowed in an attribution filter. */ getMeasurementMaxValuesPerAttributionFilter()690 default int getMeasurementMaxValuesPerAttributionFilter() { 691 return DEFAULT_MEASUREMENT_MAX_VALUES_PER_ATTRIBUTION_FILTER; 692 } 693 694 int DEFAULT_MEASUREMENT_MAX_ATTRIBUTION_FILTERS = 50; 695 696 /** Maximum number of attribution filters allowed for a source. */ getMeasurementMaxAttributionFilters()697 default int getMeasurementMaxAttributionFilters() { 698 return DEFAULT_MEASUREMENT_MAX_ATTRIBUTION_FILTERS; 699 } 700 701 int DEFAULT_MEASUREMENT_MAX_BYTES_PER_ATTRIBUTION_AGGREGATE_KEY_ID = 25; 702 703 /** Maximum number of bytes allowed in an aggregate key ID. */ getMeasurementMaxBytesPerAttributionAggregateKeyId()704 default int getMeasurementMaxBytesPerAttributionAggregateKeyId() { 705 return DEFAULT_MEASUREMENT_MAX_BYTES_PER_ATTRIBUTION_AGGREGATE_KEY_ID; 706 } 707 708 int DEFAULT_MEASUREMENT_MAX_AGGREGATE_DEDUPLICATION_KEYS_PER_REGISTRATION = 50; 709 710 /** Maximum number of aggregate deduplication keys allowed during trigger registration. */ getMeasurementMaxAggregateDeduplicationKeysPerRegistration()711 default int getMeasurementMaxAggregateDeduplicationKeysPerRegistration() { 712 return DEFAULT_MEASUREMENT_MAX_AGGREGATE_DEDUPLICATION_KEYS_PER_REGISTRATION; 713 } 714 715 @FeatureFlag(LEGACY_KILL_SWITCH_RAMPED_UP) 716 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 717 boolean MEASUREMENT_ATTRIBUTION_FALLBACK_JOB_KILL_SWITCH = false; 718 719 /** Returns the feature flag for Attribution Fallback Job . */ getMeasurementAttributionFallbackJobEnabled()720 default boolean getMeasurementAttributionFallbackJobEnabled() { 721 return getMeasurementEnabled() && !MEASUREMENT_ATTRIBUTION_FALLBACK_JOB_KILL_SWITCH; 722 } 723 724 long MEASUREMENT_ATTRIBUTION_FALLBACK_JOB_PERIOD_MS = TimeUnit.HOURS.toMillis(1); 725 726 /** Returns the job period in millis for Attribution Fallback Job . */ getMeasurementAttributionFallbackJobPeriodMs()727 default long getMeasurementAttributionFallbackJobPeriodMs() { 728 return MEASUREMENT_ATTRIBUTION_FALLBACK_JOB_PERIOD_MS; 729 } 730 731 int MEASUREMENT_MAX_EVENT_ATTRIBUTION_PER_RATE_LIMIT_WINDOW = 100; 732 733 /** 734 * Returns maximum event attributions per rate limit window. Rate limit unit: (Source Site, 735 * Destination Site, Reporting Site, Window). 736 */ getMeasurementMaxEventAttributionPerRateLimitWindow()737 default int getMeasurementMaxEventAttributionPerRateLimitWindow() { 738 return MEASUREMENT_MAX_EVENT_ATTRIBUTION_PER_RATE_LIMIT_WINDOW; 739 } 740 741 int MEASUREMENT_MAX_AGGREGATE_ATTRIBUTION_PER_RATE_LIMIT_WINDOW = 100; 742 743 /** 744 * Returns maximum aggregate attributions per rate limit window. Rate limit unit: (Source Site, 745 * Destination Site, Reporting Site, Window). 746 */ getMeasurementMaxAggregateAttributionPerRateLimitWindow()747 default int getMeasurementMaxAggregateAttributionPerRateLimitWindow() { 748 return MEASUREMENT_MAX_AGGREGATE_ATTRIBUTION_PER_RATE_LIMIT_WINDOW; 749 } 750 751 int MEASUREMENT_MAX_DISTINCT_REPORTING_ORIGINS_IN_ATTRIBUTION = 10; 752 753 /** 754 * Returns max distinct reporting origins for attribution per { Advertiser X Publisher X 755 * TimePeriod }. 756 */ getMeasurementMaxDistinctReportingOriginsInAttribution()757 default int getMeasurementMaxDistinctReportingOriginsInAttribution() { 758 return MEASUREMENT_MAX_DISTINCT_REPORTING_ORIGINS_IN_ATTRIBUTION; 759 } 760 761 int MEASUREMENT_MAX_DISTINCT_DESTINATIONS_IN_ACTIVE_SOURCE = 100; 762 763 /** 764 * Returns max distinct advertisers with pending impressions per { Publisher X Enrollment X 765 * TimePeriod }. 766 */ getMeasurementMaxDistinctDestinationsInActiveSource()767 default int getMeasurementMaxDistinctDestinationsInActiveSource() { 768 return MEASUREMENT_MAX_DISTINCT_DESTINATIONS_IN_ACTIVE_SOURCE; 769 } 770 771 int MEASUREMENT_MAX_REPORTING_ORIGINS_PER_SOURCE_REPORTING_SITE_PER_WINDOW = 1; 772 773 /** 774 * Returns the maximum number of reporting origins per source site, reporting site, 775 * reporting-origin-update-window counted per source registration. 776 */ getMeasurementMaxReportingOriginsPerSourceReportingSitePerWindow()777 default int getMeasurementMaxReportingOriginsPerSourceReportingSitePerWindow() { 778 return MEASUREMENT_MAX_REPORTING_ORIGINS_PER_SOURCE_REPORTING_SITE_PER_WINDOW; 779 } 780 781 int MEASUREMENT_MAX_DISTINCT_REP_ORIG_PER_PUBLISHER_X_DEST_IN_SOURCE = 100; 782 783 /** 784 * Max distinct reporting origins with source registration per { Publisher X Advertiser X 785 * TimePeriod }. 786 */ getMeasurementMaxDistinctRepOrigPerPublXDestInSource()787 default int getMeasurementMaxDistinctRepOrigPerPublXDestInSource() { 788 return MEASUREMENT_MAX_DISTINCT_REP_ORIG_PER_PUBLISHER_X_DEST_IN_SOURCE; 789 } 790 791 boolean MEASUREMENT_ENABLE_DESTINATION_RATE_LIMIT = true; 792 793 /** Returns {@code true} if Measurement destination rate limit is enabled. */ getMeasurementEnableDestinationRateLimit()794 default boolean getMeasurementEnableDestinationRateLimit() { 795 return MEASUREMENT_ENABLE_DESTINATION_RATE_LIMIT; 796 } 797 798 int MEASUREMENT_MAX_DESTINATIONS_PER_PUBLISHER_PER_RATE_LIMIT_WINDOW = 50; 799 800 /** 801 * Returns the maximum number of distinct destination sites per source site per rate limit 802 * window. 803 */ getMeasurementMaxDestinationsPerPublisherPerRateLimitWindow()804 default int getMeasurementMaxDestinationsPerPublisherPerRateLimitWindow() { 805 return MEASUREMENT_MAX_DESTINATIONS_PER_PUBLISHER_PER_RATE_LIMIT_WINDOW; 806 } 807 808 int MEASUREMENT_MAX_DEST_PER_PUBLISHER_X_ENROLLMENT_PER_RATE_LIMIT_WINDOW = 200; 809 810 /** 811 * Returns the maximum number of distinct destination sites per source site X enrollment per 812 * minute rate limit window. 813 */ getMeasurementMaxDestPerPublisherXEnrollmentPerRateLimitWindow()814 default int getMeasurementMaxDestPerPublisherXEnrollmentPerRateLimitWindow() { 815 return MEASUREMENT_MAX_DEST_PER_PUBLISHER_X_ENROLLMENT_PER_RATE_LIMIT_WINDOW; 816 } 817 818 @ConfigFlag long MEASUREMENT_DESTINATION_RATE_LIMIT_WINDOW = TimeUnit.MINUTES.toMillis(1); 819 820 /** Returns the duration that controls the rate-limiting window for destinations per minute. */ getMeasurementDestinationRateLimitWindow()821 default long getMeasurementDestinationRateLimitWindow() { 822 return MEASUREMENT_DESTINATION_RATE_LIMIT_WINDOW; 823 } 824 825 /** 826 * Returns the maximum number of distinct destination sites per source site X enrollment per day 827 * rate limit. 828 */ 829 @ConfigFlag int MEASUREMENT_DESTINATION_PER_DAY_RATE_LIMIT = 100; 830 getMeasurementDestinationPerDayRateLimit()831 default int getMeasurementDestinationPerDayRateLimit() { 832 return MEASUREMENT_DESTINATION_PER_DAY_RATE_LIMIT; 833 } 834 835 @FeatureFlag boolean MEASUREMENT_ENABLE_DESTINATION_PER_DAY_RATE_LIMIT_WINDOW = false; 836 837 /** Returns true, if rate-limiting window for destinations per day is enabled. */ getMeasurementEnableDestinationPerDayRateLimitWindow()838 default boolean getMeasurementEnableDestinationPerDayRateLimitWindow() { 839 return MEASUREMENT_ENABLE_DESTINATION_PER_DAY_RATE_LIMIT_WINDOW; 840 } 841 842 @ConfigFlag 843 long MEASUREMENT_DESTINATION_PER_DAY_RATE_LIMIT_WINDOW_IN_MS = TimeUnit.DAYS.toMillis(1); 844 845 /** Returns the duration that controls the per day rate-limiting window for destinations. */ getMeasurementDestinationPerDayRateLimitWindowInMs()846 default long getMeasurementDestinationPerDayRateLimitWindowInMs() { 847 return MEASUREMENT_DESTINATION_PER_DAY_RATE_LIMIT_WINDOW_IN_MS; 848 } 849 850 float MEASUREMENT_FLEX_API_MAX_INFORMATION_GAIN_EVENT = 6.5F; 851 852 /** Returns max information gain in Flexible Event API for Event sources */ getMeasurementFlexApiMaxInformationGainEvent()853 default float getMeasurementFlexApiMaxInformationGainEvent() { 854 return MEASUREMENT_FLEX_API_MAX_INFORMATION_GAIN_EVENT; 855 } 856 857 float MEASUREMENT_FLEX_API_MAX_INFORMATION_GAIN_NAVIGATION = 11.5F; 858 859 /** Returns max information gain in Flexible Event API for Navigation sources */ getMeasurementFlexApiMaxInformationGainNavigation()860 default float getMeasurementFlexApiMaxInformationGainNavigation() { 861 return MEASUREMENT_FLEX_API_MAX_INFORMATION_GAIN_NAVIGATION; 862 } 863 864 float MEASUREMENT_FLEX_API_MAX_INFORMATION_GAIN_DUAL_DESTINATION_EVENT = 6.5F; 865 866 /** Returns max information gain for Flexible Event, dual destination Event sources */ getMeasurementFlexApiMaxInformationGainDualDestinationEvent()867 default float getMeasurementFlexApiMaxInformationGainDualDestinationEvent() { 868 return MEASUREMENT_FLEX_API_MAX_INFORMATION_GAIN_DUAL_DESTINATION_EVENT; 869 } 870 871 float MEASUREMENT_FLEX_API_MAX_INFORMATION_GAIN_DUAL_DESTINATION_NAVIGATION = 11.5F; 872 873 /** Returns max information gain for Flexible Event, dual destination Navigation sources */ getMeasurementFlexApiMaxInformationGainDualDestinationNavigation()874 default float getMeasurementFlexApiMaxInformationGainDualDestinationNavigation() { 875 return MEASUREMENT_FLEX_API_MAX_INFORMATION_GAIN_DUAL_DESTINATION_NAVIGATION; 876 } 877 878 @ConfigFlag float MEASUREMENT_ATTRIBUTION_SCOPE_MAX_INFO_GAIN_NAVIGATION = 11.55F; 879 880 /** Returns max information gain for navigation sources with attribution scopes. */ getMeasurementAttributionScopeMaxInfoGainNavigation()881 default float getMeasurementAttributionScopeMaxInfoGainNavigation() { 882 return MEASUREMENT_ATTRIBUTION_SCOPE_MAX_INFO_GAIN_NAVIGATION; 883 } 884 885 @ConfigFlag 886 float MEASUREMENT_ATTRIBUTION_SCOPE_MAX_INFO_GAIN_DUAL_DESTINATION_NAVIGATION = 11.55F; 887 888 /** 889 * Returns max information gain for navigation sources with dual destination and attribution 890 * scopes. 891 */ getMeasurementAttributionScopeMaxInfoGainDualDestinationNavigation()892 default float getMeasurementAttributionScopeMaxInfoGainDualDestinationNavigation() { 893 return MEASUREMENT_ATTRIBUTION_SCOPE_MAX_INFO_GAIN_DUAL_DESTINATION_NAVIGATION; 894 } 895 896 @ConfigFlag float MEASUREMENT_ATTRIBUTION_SCOPE_MAX_INFO_GAIN_EVENT = 6.5F; 897 898 /** Returns max information gain for event sources with attribution scopes. */ getMeasurementAttributionScopeMaxInfoGainEvent()899 default float getMeasurementAttributionScopeMaxInfoGainEvent() { 900 return MEASUREMENT_ATTRIBUTION_SCOPE_MAX_INFO_GAIN_EVENT; 901 } 902 903 @ConfigFlag float MEASUREMENT_ATTRIBUTION_SCOPE_MAX_INFO_GAIN_DUAL_DESTINATION_EVENT = 6.5F; 904 905 /** 906 * Returns max information gain for event sources with dual destination and attribution scopes. 907 */ getMeasurementAttributionScopeMaxInfoGainDualDestinationEvent()908 default float getMeasurementAttributionScopeMaxInfoGainDualDestinationEvent() { 909 return MEASUREMENT_ATTRIBUTION_SCOPE_MAX_INFO_GAIN_DUAL_DESTINATION_EVENT; 910 } 911 912 @FeatureFlag boolean MEASUREMENT_ENABLE_FAKE_REPORT_TRIGGER_TIME = false; 913 914 /** Returns true if fake report trigger time is enabled. */ getMeasurementEnableFakeReportTriggerTime()915 default boolean getMeasurementEnableFakeReportTriggerTime() { 916 return MEASUREMENT_ENABLE_FAKE_REPORT_TRIGGER_TIME; 917 } 918 919 long MEASUREMENT_MAX_REPORT_STATES_PER_SOURCE_REGISTRATION = (1L << 32) - 1L; 920 921 /** Returns max repot states per source registration */ getMeasurementMaxReportStatesPerSourceRegistration()922 default long getMeasurementMaxReportStatesPerSourceRegistration() { 923 return MEASUREMENT_MAX_REPORT_STATES_PER_SOURCE_REGISTRATION; 924 } 925 926 int MEASUREMENT_FLEX_API_MAX_EVENT_REPORTS = 20; 927 928 /** Returns max event reports in Flexible Event API */ getMeasurementFlexApiMaxEventReports()929 default int getMeasurementFlexApiMaxEventReports() { 930 return MEASUREMENT_FLEX_API_MAX_EVENT_REPORTS; 931 } 932 933 int MEASUREMENT_FLEX_API_MAX_EVENT_REPORT_WINDOWS = 5; 934 935 /** Returns max event report windows in Flexible Event API */ getMeasurementFlexApiMaxEventReportWindows()936 default int getMeasurementFlexApiMaxEventReportWindows() { 937 return MEASUREMENT_FLEX_API_MAX_EVENT_REPORT_WINDOWS; 938 } 939 940 int MEASUREMENT_FLEX_API_MAX_TRIGGER_DATA_CARDINALITY = 32; 941 942 /** Returns max trigger data cardinality in Flexible Event API */ getMeasurementFlexApiMaxTriggerDataCardinality()943 default int getMeasurementFlexApiMaxTriggerDataCardinality() { 944 return MEASUREMENT_FLEX_API_MAX_TRIGGER_DATA_CARDINALITY; 945 } 946 947 long MEASUREMENT_MINIMUM_EVENT_REPORT_WINDOW_IN_SECONDS = TimeUnit.HOURS.toSeconds(1); 948 949 /** Returns minimum event report window */ getMeasurementMinimumEventReportWindowInSeconds()950 default long getMeasurementMinimumEventReportWindowInSeconds() { 951 return MEASUREMENT_MINIMUM_EVENT_REPORT_WINDOW_IN_SECONDS; 952 } 953 954 long MEASUREMENT_MINIMUM_AGGREGATABLE_REPORT_WINDOW_IN_SECONDS = TimeUnit.HOURS.toSeconds(1); 955 956 /** Returns minimum aggregatable report window */ getMeasurementMinimumAggregatableReportWindowInSeconds()957 default long getMeasurementMinimumAggregatableReportWindowInSeconds() { 958 return MEASUREMENT_MINIMUM_AGGREGATABLE_REPORT_WINDOW_IN_SECONDS; 959 } 960 961 boolean MEASUREMENT_ENABLE_LOOKBACK_WINDOW_FILTER = false; 962 963 /** Returns true if lookback window filter is enabled else false. */ getMeasurementEnableLookbackWindowFilter()964 default boolean getMeasurementEnableLookbackWindowFilter() { 965 return MEASUREMENT_ENABLE_LOOKBACK_WINDOW_FILTER; 966 } 967 968 /** Default FLEDGE app package name logging flag. */ 969 boolean FLEDGE_APP_PACKAGE_NAME_LOGGING_ENABLED = false; 970 971 /** Returns whether FLEDGE app package name logging is enabled. */ getFledgeAppPackageNameLoggingEnabled()972 default boolean getFledgeAppPackageNameLoggingEnabled() { 973 return FLEDGE_APP_PACKAGE_NAME_LOGGING_ENABLED; 974 } 975 976 long FLEDGE_CUSTOM_AUDIENCE_MAX_COUNT = 4000L; 977 long FLEDGE_CUSTOM_AUDIENCE_PER_APP_MAX_COUNT = 1000L; 978 long FLEDGE_CUSTOM_AUDIENCE_MAX_OWNER_COUNT = 1000L; 979 @ConfigFlag long FLEDGE_CUSTOM_AUDIENCE_PER_BUYER_MAX_COUNT = 4000L; 980 long FLEDGE_CUSTOM_AUDIENCE_DEFAULT_EXPIRE_IN_MS = 60L * 24L * 60L * 60L * 1000L; // 60 days 981 long FLEDGE_CUSTOM_AUDIENCE_MAX_ACTIVATION_DELAY_IN_MS = 982 60L * 24L * 60L * 60L * 1000L; // 60 days 983 long FLEDGE_CUSTOM_AUDIENCE_MAX_EXPIRE_IN_MS = 60L * 24L * 60L * 60L * 1000L; // 60 days 984 int FLEDGE_CUSTOM_AUDIENCE_MAX_NAME_SIZE_B = 200; 985 int FLEDGE_CUSTOM_AUDIENCE_MAX_DAILY_UPDATE_URI_SIZE_B = 400; 986 int FLEDGE_CUSTOM_AUDIENCE_MAX_BIDDING_LOGIC_URI_SIZE_B = 400; 987 int FLEDGE_CUSTOM_AUDIENCE_MAX_USER_BIDDING_SIGNALS_SIZE_B = 10 * 1024; // 10 KiB 988 int FLEDGE_CUSTOM_AUDIENCE_MAX_TRUSTED_BIDDING_DATA_SIZE_B = 10 * 1024; // 10 KiB 989 int FLEDGE_CUSTOM_AUDIENCE_MAX_ADS_SIZE_B = 10 * 1024; // 10 KiB 990 int FLEDGE_CUSTOM_AUDIENCE_MAX_NUM_ADS = 100; 991 // Keeping TTL as long as expiry, could be reduced later as we get more fresh CAs with adoption 992 long FLEDGE_CUSTOM_AUDIENCE_ACTIVE_TIME_WINDOW_MS = 60 * 24 * 60L * 60L * 1000; // 60 days 993 long FLEDGE_ENCRYPTION_KEY_MAX_AGE_SECONDS = TimeUnit.DAYS.toSeconds(14); 994 long FLEDGE_FETCH_CUSTOM_AUDIENCE_MIN_RETRY_AFTER_VALUE_MS = 30 * 1000; // 30 seconds 995 long FLEDGE_FETCH_CUSTOM_AUDIENCE_MAX_RETRY_AFTER_VALUE_MS = 996 24 * 60 * 60 * 1000; // 24 hours in ms 997 998 @FeatureFlag boolean ENABLE_CUSTOM_AUDIENCE_COMPONENT_ADS = false; 999 @FeatureFlag boolean ENABLE_PAS_COMPONENT_ADS = false; 1000 @ConfigFlag int MAX_COMPONENT_ADS_PER_CUSTOM_AUDIENCE = 40; 1001 @ConfigFlag int COMPONENT_AD_RENDER_ID_MAX_LENGTH_BYTES = 12; 1002 1003 /** Returns true if the component ads feature is enabled for custom audiences. */ getEnableCustomAudienceComponentAds()1004 default boolean getEnableCustomAudienceComponentAds() { 1005 return ENABLE_CUSTOM_AUDIENCE_COMPONENT_ADS; 1006 } 1007 1008 /** Returns true if the component ads feature is enabled for protected app signals. */ getEnablePasComponentAds()1009 default boolean getEnablePasComponentAds() { 1010 return ENABLE_PAS_COMPONENT_ADS; 1011 } 1012 1013 /** Returns the maximum number of component ads per custom audience. */ getMaxComponentAdsPerCustomAudience()1014 default int getMaxComponentAdsPerCustomAudience() { 1015 return MAX_COMPONENT_ADS_PER_CUSTOM_AUDIENCE; 1016 } 1017 1018 /** Returns the maximum length of component ad render ids in bytes. */ getComponentAdRenderIdMaxLengthBytes()1019 default int getComponentAdRenderIdMaxLengthBytes() { 1020 return COMPONENT_AD_RENDER_ID_MAX_LENGTH_BYTES; 1021 } 1022 1023 /** 1024 * Returns the minimum number of milliseconds before the same fetch CA request can be retried. 1025 */ getFledgeFetchCustomAudienceMinRetryAfterValueMs()1026 default long getFledgeFetchCustomAudienceMinRetryAfterValueMs() { 1027 return FLEDGE_FETCH_CUSTOM_AUDIENCE_MIN_RETRY_AFTER_VALUE_MS; 1028 } 1029 1030 /** 1031 * Returns the maximum number of milliseconds before the same fetch CA request can be retried. 1032 */ getFledgeFetchCustomAudienceMaxRetryAfterValueMs()1033 default long getFledgeFetchCustomAudienceMaxRetryAfterValueMs() { 1034 return FLEDGE_FETCH_CUSTOM_AUDIENCE_MAX_RETRY_AFTER_VALUE_MS; 1035 } 1036 1037 /** Returns the maximum number of custom audience can stay in the storage. */ getFledgeCustomAudienceMaxCount()1038 default long getFledgeCustomAudienceMaxCount() { 1039 return FLEDGE_CUSTOM_AUDIENCE_MAX_COUNT; 1040 } 1041 1042 /** Returns the maximum number of custom audience an app can create. */ getFledgeCustomAudiencePerAppMaxCount()1043 default long getFledgeCustomAudiencePerAppMaxCount() { 1044 return FLEDGE_CUSTOM_AUDIENCE_PER_APP_MAX_COUNT; 1045 } 1046 1047 /** Returns the maximum number of apps can have access to custom audience. */ getFledgeCustomAudienceMaxOwnerCount()1048 default long getFledgeCustomAudienceMaxOwnerCount() { 1049 return FLEDGE_CUSTOM_AUDIENCE_MAX_OWNER_COUNT; 1050 } 1051 1052 /** Returns the maximum number of custom audiences per buyer ad tech. */ getFledgeCustomAudiencePerBuyerMaxCount()1053 default long getFledgeCustomAudiencePerBuyerMaxCount() { 1054 return FLEDGE_CUSTOM_AUDIENCE_PER_BUYER_MAX_COUNT; 1055 } 1056 1057 /** 1058 * Returns the default amount of time in milliseconds a custom audience object will live before 1059 * being expiring and being removed 1060 */ getFledgeCustomAudienceDefaultExpireInMs()1061 default long getFledgeCustomAudienceDefaultExpireInMs() { 1062 return FLEDGE_CUSTOM_AUDIENCE_DEFAULT_EXPIRE_IN_MS; 1063 } 1064 1065 /** 1066 * Returns the maximum permitted difference in milliseconds between the custom audience object's 1067 * creation time and its activation time 1068 */ getFledgeCustomAudienceMaxActivationDelayInMs()1069 default long getFledgeCustomAudienceMaxActivationDelayInMs() { 1070 return FLEDGE_CUSTOM_AUDIENCE_MAX_ACTIVATION_DELAY_IN_MS; 1071 } 1072 1073 /** 1074 * Returns the maximum permitted difference in milliseconds between the custom audience object's 1075 * activation time and its expiration time 1076 */ getFledgeCustomAudienceMaxExpireInMs()1077 default long getFledgeCustomAudienceMaxExpireInMs() { 1078 return FLEDGE_CUSTOM_AUDIENCE_MAX_EXPIRE_IN_MS; 1079 } 1080 1081 /** Returns the maximum size in bytes allowed for name in each FLEDGE custom audience. */ getFledgeCustomAudienceMaxNameSizeB()1082 default int getFledgeCustomAudienceMaxNameSizeB() { 1083 return FLEDGE_CUSTOM_AUDIENCE_MAX_NAME_SIZE_B; 1084 } 1085 1086 /** 1087 * Returns the maximum size in bytes allowed for daily update uri in each FLEDGE custom 1088 * audience. 1089 */ getFledgeCustomAudienceMaxDailyUpdateUriSizeB()1090 default int getFledgeCustomAudienceMaxDailyUpdateUriSizeB() { 1091 return FLEDGE_CUSTOM_AUDIENCE_MAX_DAILY_UPDATE_URI_SIZE_B; 1092 } 1093 1094 /** 1095 * Returns the maximum size in bytes allowed for bidding logic uri in each FLEDGE custom 1096 * audience. 1097 */ getFledgeCustomAudienceMaxBiddingLogicUriSizeB()1098 default int getFledgeCustomAudienceMaxBiddingLogicUriSizeB() { 1099 return FLEDGE_CUSTOM_AUDIENCE_MAX_BIDDING_LOGIC_URI_SIZE_B; 1100 } 1101 1102 /** 1103 * Returns the maximum size in bytes allowed for user bidding signals in each FLEDGE custom 1104 * audience. 1105 */ getFledgeCustomAudienceMaxUserBiddingSignalsSizeB()1106 default int getFledgeCustomAudienceMaxUserBiddingSignalsSizeB() { 1107 return FLEDGE_CUSTOM_AUDIENCE_MAX_USER_BIDDING_SIGNALS_SIZE_B; 1108 } 1109 1110 /** 1111 * Returns the maximum size in bytes allowed for trusted bidding data in each FLEDGE custom 1112 * audience. 1113 */ getFledgeCustomAudienceMaxTrustedBiddingDataSizeB()1114 default int getFledgeCustomAudienceMaxTrustedBiddingDataSizeB() { 1115 return FLEDGE_CUSTOM_AUDIENCE_MAX_TRUSTED_BIDDING_DATA_SIZE_B; 1116 } 1117 1118 /** Returns the maximum size in bytes allowed for ads in each FLEDGE custom audience. */ getFledgeCustomAudienceMaxAdsSizeB()1119 default int getFledgeCustomAudienceMaxAdsSizeB() { 1120 return FLEDGE_CUSTOM_AUDIENCE_MAX_ADS_SIZE_B; 1121 } 1122 1123 /** Returns the maximum allowed number of ads per FLEDGE custom audience. */ getFledgeCustomAudienceMaxNumAds()1124 default int getFledgeCustomAudienceMaxNumAds() { 1125 return FLEDGE_CUSTOM_AUDIENCE_MAX_NUM_ADS; 1126 } 1127 1128 /** 1129 * Returns the time window that defines how long after a successful update a custom audience can 1130 * participate in ad selection. 1131 */ getFledgeCustomAudienceActiveTimeWindowInMs()1132 default long getFledgeCustomAudienceActiveTimeWindowInMs() { 1133 return FLEDGE_CUSTOM_AUDIENCE_ACTIVE_TIME_WINDOW_MS; 1134 } 1135 1136 int FLEDGE_FETCH_CUSTOM_AUDIENCE_MAX_USER_BIDDING_SIGNALS_SIZE_B = 8 * 1024; // 8 KiB 1137 int FLEDGE_FETCH_CUSTOM_AUDIENCE_MAX_REQUEST_CUSTOM_HEADER_SIZE_B = 8 * 1024; // 8 KiB 1138 int FLEDGE_FETCH_CUSTOM_AUDIENCE_MAX_CUSTOM_AUDIENCE_SIZE_B = 8 * 1024; // 8 KiB 1139 1140 /** 1141 * Returns the maximum size in bytes allowed for user bidding signals in each 1142 * fetchAndJoinCustomAudience request. 1143 */ getFledgeFetchCustomAudienceMaxUserBiddingSignalsSizeB()1144 default int getFledgeFetchCustomAudienceMaxUserBiddingSignalsSizeB() { 1145 return FLEDGE_FETCH_CUSTOM_AUDIENCE_MAX_USER_BIDDING_SIGNALS_SIZE_B; 1146 } 1147 1148 /** 1149 * Returns the maximum size in bytes allowed for the request custom header derived from each 1150 * fetchAndJoinCustomAudience request. 1151 */ getFledgeFetchCustomAudienceMaxRequestCustomHeaderSizeB()1152 default int getFledgeFetchCustomAudienceMaxRequestCustomHeaderSizeB() { 1153 return FLEDGE_FETCH_CUSTOM_AUDIENCE_MAX_REQUEST_CUSTOM_HEADER_SIZE_B; 1154 } 1155 1156 /** 1157 * Returns the maximum size in bytes for the fused custom audience allowed to be persisted by 1158 * the fetchAndJoinCustomAudience API. 1159 */ getFledgeFetchCustomAudienceMaxCustomAudienceSizeB()1160 default int getFledgeFetchCustomAudienceMaxCustomAudienceSizeB() { 1161 return FLEDGE_FETCH_CUSTOM_AUDIENCE_MAX_CUSTOM_AUDIENCE_SIZE_B; 1162 } 1163 1164 boolean FLEDGE_BACKGROUND_FETCH_ENABLED = true; 1165 long FLEDGE_BACKGROUND_FETCH_JOB_PERIOD_MS = 4L * 60L * 60L * 1000L; // 4 hours 1166 long FLEDGE_BACKGROUND_FETCH_JOB_FLEX_MS = 30L * 60L * 1000L; // 30 minutes 1167 long FLEDGE_BACKGROUND_FETCH_JOB_MAX_RUNTIME_MS = 10L * 60L * 1000L; // 5 minutes 1168 long FLEDGE_BACKGROUND_FETCH_MAX_NUM_UPDATED = 1000; 1169 int FLEDGE_BACKGROUND_FETCH_THREAD_POOL_SIZE = 8; 1170 long FLEDGE_BACKGROUND_FETCH_ELIGIBLE_UPDATE_BASE_INTERVAL_S = 24L * 60L * 60L; // 24 hours 1171 int FLEDGE_BACKGROUND_FETCH_NETWORK_CONNECT_TIMEOUT_MS = 5 * 1000; // 5 seconds 1172 int FLEDGE_BACKGROUND_FETCH_NETWORK_READ_TIMEOUT_MS = 30 * 1000; // 30 seconds 1173 int FLEDGE_BACKGROUND_FETCH_MAX_RESPONSE_SIZE_B = 10 * 1024; // 10 KiB 1174 boolean FLEDGE_HTTP_CACHE_ENABLE = true; 1175 boolean FLEDGE_HTTP_CACHE_ENABLE_JS_CACHING = true; 1176 long FLEDGE_HTTP_CACHE_DEFAULT_MAX_AGE_SECONDS = 2 * 24 * 60 * 60; // 2 days 1177 long FLEDGE_HTTP_CACHE_MAX_ENTRIES = 100; 1178 boolean FLEDGE_ON_DEVICE_AUCTION_SHOULD_USE_UNIFIED_TABLES = false; 1179 1180 /** Returns {@code true} if the on device auction should use the unified flow tables */ getFledgeOnDeviceAuctionShouldUseUnifiedTables()1181 default boolean getFledgeOnDeviceAuctionShouldUseUnifiedTables() { 1182 return FLEDGE_ON_DEVICE_AUCTION_SHOULD_USE_UNIFIED_TABLES; 1183 } 1184 1185 /** Returns {@code true} if the FLEDGE Background Fetch is enabled. */ getFledgeBackgroundFetchEnabled()1186 default boolean getFledgeBackgroundFetchEnabled() { 1187 return FLEDGE_BACKGROUND_FETCH_ENABLED; 1188 } 1189 1190 /** 1191 * Returns the best effort max time (in milliseconds) between each FLEDGE Background Fetch job 1192 * run. 1193 */ getFledgeBackgroundFetchJobPeriodMs()1194 default long getFledgeBackgroundFetchJobPeriodMs() { 1195 return FLEDGE_BACKGROUND_FETCH_JOB_PERIOD_MS; 1196 } 1197 1198 /** 1199 * Returns the amount of flex (in milliseconds) around the end of each period to run each FLEDGE 1200 * Background Fetch job. 1201 */ getFledgeBackgroundFetchJobFlexMs()1202 default long getFledgeBackgroundFetchJobFlexMs() { 1203 return FLEDGE_BACKGROUND_FETCH_JOB_FLEX_MS; 1204 } 1205 1206 /** 1207 * Returns the maximum amount of time (in milliseconds) each FLEDGE Background Fetch job is 1208 * allowed to run. 1209 */ getFledgeBackgroundFetchJobMaxRuntimeMs()1210 default long getFledgeBackgroundFetchJobMaxRuntimeMs() { 1211 return FLEDGE_BACKGROUND_FETCH_JOB_MAX_RUNTIME_MS; 1212 } 1213 1214 /** 1215 * Returns the maximum number of custom audiences updated in a single FLEDGE background fetch 1216 * job. 1217 */ getFledgeBackgroundFetchMaxNumUpdated()1218 default long getFledgeBackgroundFetchMaxNumUpdated() { 1219 return FLEDGE_BACKGROUND_FETCH_MAX_NUM_UPDATED; 1220 } 1221 1222 /** 1223 * Returns the maximum thread pool size to draw workers from in a single FLEDGE background fetch 1224 * job. 1225 */ getFledgeBackgroundFetchThreadPoolSize()1226 default int getFledgeBackgroundFetchThreadPoolSize() { 1227 return FLEDGE_BACKGROUND_FETCH_THREAD_POOL_SIZE; 1228 } 1229 1230 /** 1231 * Returns the base interval in seconds after a successful FLEDGE background fetch job after 1232 * which a custom audience is next eligible to be updated. 1233 */ getFledgeBackgroundFetchEligibleUpdateBaseIntervalS()1234 default long getFledgeBackgroundFetchEligibleUpdateBaseIntervalS() { 1235 return FLEDGE_BACKGROUND_FETCH_ELIGIBLE_UPDATE_BASE_INTERVAL_S; 1236 } 1237 1238 /** 1239 * Returns the maximum time in milliseconds allowed for a network call to open its initial 1240 * connection during the FLEDGE background fetch. 1241 */ getFledgeBackgroundFetchNetworkConnectTimeoutMs()1242 default int getFledgeBackgroundFetchNetworkConnectTimeoutMs() { 1243 return FLEDGE_BACKGROUND_FETCH_NETWORK_CONNECT_TIMEOUT_MS; 1244 } 1245 1246 /** 1247 * Returns the maximum time in milliseconds allowed for a network call to read a response from a 1248 * target server during the FLEDGE background fetch. 1249 */ getFledgeBackgroundFetchNetworkReadTimeoutMs()1250 default int getFledgeBackgroundFetchNetworkReadTimeoutMs() { 1251 return FLEDGE_BACKGROUND_FETCH_NETWORK_READ_TIMEOUT_MS; 1252 } 1253 1254 /** 1255 * Returns the maximum size in bytes of a single custom audience update response during the 1256 * FLEDGE background fetch. 1257 */ getFledgeBackgroundFetchMaxResponseSizeB()1258 default int getFledgeBackgroundFetchMaxResponseSizeB() { 1259 return FLEDGE_BACKGROUND_FETCH_MAX_RESPONSE_SIZE_B; 1260 } 1261 1262 /** 1263 * Returns boolean, if the caching is enabled for {@link 1264 * com.android.adservices.service.common.cache.FledgeHttpCache} 1265 */ getFledgeHttpCachingEnabled()1266 default boolean getFledgeHttpCachingEnabled() { 1267 return FLEDGE_HTTP_CACHE_ENABLE; 1268 } 1269 1270 /** Returns boolean, if the caching is enabled for JS for bidding and scoring */ getFledgeHttpJsCachingEnabled()1271 default boolean getFledgeHttpJsCachingEnabled() { 1272 return FLEDGE_HTTP_CACHE_ENABLE_JS_CACHING; 1273 } 1274 1275 /** Returns max number of entries that should be persisted in cache */ getFledgeHttpCacheMaxEntries()1276 default long getFledgeHttpCacheMaxEntries() { 1277 return FLEDGE_HTTP_CACHE_MAX_ENTRIES; 1278 } 1279 1280 /** Returns the default max age of entries in cache */ getFledgeHttpCacheMaxAgeSeconds()1281 default long getFledgeHttpCacheMaxAgeSeconds() { 1282 return FLEDGE_HTTP_CACHE_DEFAULT_MAX_AGE_SECONDS; 1283 } 1284 1285 boolean PROTECTED_SIGNALS_PERIODIC_ENCODING_ENABLED = true; 1286 long PROTECTED_SIGNALS_PERIODIC_ENCODING_JOB_PERIOD_MS = 1L * 60L * 60L * 1000L; // 1 hour 1287 long PROTECTED_SIGNALS_PERIODIC_ENCODING_JOB_FLEX_MS = 5L * 60L * 1000L; // 5 minutes 1288 int PROTECTED_SIGNALS_ENCODED_PAYLOAD_MAX_SIZE_BYTES = (int) (1.5 * 1024); // 1.5 KB 1289 int PROTECTED_SIGNALS_FETCH_SIGNAL_UPDATES_MAX_SIZE_BYTES = (int) (10 * 1024); 1290 int PROTECTED_SIGNALS_MAX_JS_FAILURE_EXECUTION_ON_CERTAIN_VERSION_BEFORE_STOP = 3; 1291 long PROTECTED_SIGNALS_ENCODER_REFRESH_WINDOW_SECONDS = 24L * 60L * 60L; // 1 day 1292 int PROTECTED_SIGNALS_MAX_SIGNAL_SIZE_PER_BUYER_BYTES = 10 * 1024; 1293 int PROTECTED_SIGNALS_MAX_SIGNAL_SIZE_PER_BUYER_WITH_OVERSUBSCIPTION_BYTES = 15 * 1024; 1294 1295 /** Returns {@code true} feature flag if Periodic encoding of Protected Signals is enabled. */ getProtectedSignalsPeriodicEncodingEnabled()1296 default boolean getProtectedSignalsPeriodicEncodingEnabled() { 1297 return PROTECTED_SIGNALS_PERIODIC_ENCODING_ENABLED; 1298 } 1299 1300 /** Returns period of running periodic encoding in milliseconds */ getProtectedSignalPeriodicEncodingJobPeriodMs()1301 default long getProtectedSignalPeriodicEncodingJobPeriodMs() { 1302 return PROTECTED_SIGNALS_PERIODIC_ENCODING_JOB_PERIOD_MS; 1303 } 1304 1305 /** Returns the flexible period of running periodic encoding in milliseconds */ getProtectedSignalsPeriodicEncodingJobFlexMs()1306 default long getProtectedSignalsPeriodicEncodingJobFlexMs() { 1307 return PROTECTED_SIGNALS_PERIODIC_ENCODING_JOB_FLEX_MS; 1308 } 1309 1310 /** Returns the max size in bytes for encoded payload */ getProtectedSignalsEncodedPayloadMaxSizeBytes()1311 default int getProtectedSignalsEncodedPayloadMaxSizeBytes() { 1312 return PROTECTED_SIGNALS_ENCODED_PAYLOAD_MAX_SIZE_BYTES; 1313 } 1314 1315 /** Returns the maximum size of the signal update payload. */ getProtectedSignalsFetchSignalUpdatesMaxSizeBytes()1316 default int getProtectedSignalsFetchSignalUpdatesMaxSizeBytes() { 1317 return PROTECTED_SIGNALS_FETCH_SIGNAL_UPDATES_MAX_SIZE_BYTES; 1318 } 1319 1320 /** Returns the maximum number of continues JS failure before we stop executing the JS. */ getProtectedSignalsMaxJsFailureExecutionOnCertainVersionBeforeStop()1321 default int getProtectedSignalsMaxJsFailureExecutionOnCertainVersionBeforeStop() { 1322 return PROTECTED_SIGNALS_MAX_JS_FAILURE_EXECUTION_ON_CERTAIN_VERSION_BEFORE_STOP; 1323 } 1324 1325 /** Returns the maximum time window beyond which encoder logic should be refreshed */ getProtectedSignalsEncoderRefreshWindowSeconds()1326 default long getProtectedSignalsEncoderRefreshWindowSeconds() { 1327 return PROTECTED_SIGNALS_ENCODER_REFRESH_WINDOW_SECONDS; 1328 } 1329 1330 /** Returns the maximum size of signals in storage per buyer. */ getProtectedSignalsMaxSignalSizePerBuyerBytes()1331 default int getProtectedSignalsMaxSignalSizePerBuyerBytes() { 1332 return PROTECTED_SIGNALS_MAX_SIGNAL_SIZE_PER_BUYER_BYTES; 1333 } 1334 1335 /** 1336 * Returns the maximum size of signals in the storage per buyer with a graceful oversubscription 1337 * policy. 1338 */ getProtectedSignalsMaxSignalSizePerBuyerWithOversubsciptionBytes()1339 default int getProtectedSignalsMaxSignalSizePerBuyerWithOversubsciptionBytes() { 1340 return PROTECTED_SIGNALS_MAX_SIGNAL_SIZE_PER_BUYER_WITH_OVERSUBSCIPTION_BYTES; 1341 } 1342 1343 @FeatureFlag boolean PROTECTED_SIGNALS_ENABLE_PRIORITIZED_EVICTION = false; 1344 1345 /** Returns {@code true} feature flag if Protected Signals `prioritized` eviction is enabled. */ getProtectedSignalsEnablePrioritizedEviction()1346 default boolean getProtectedSignalsEnablePrioritizedEviction() { 1347 return PROTECTED_SIGNALS_ENABLE_PRIORITIZED_EVICTION; 1348 } 1349 1350 @ConfigFlag int PROTECTED_SIGNALS_UPDATE_SCHEMA_VERSION = 0; 1351 1352 /** Returns the update schema version to request when downloading signal updates. */ getProtectedSignalsUpdateSchemaVersion()1353 default int getProtectedSignalsUpdateSchemaVersion() { 1354 return PROTECTED_SIGNALS_UPDATE_SCHEMA_VERSION; 1355 } 1356 1357 @FeatureFlag boolean FLEDGE_ENABLE_FORCED_ENCODING_AFTER_SIGNALS_UPDATE = false; 1358 1359 @ConfigFlag 1360 long FLEDGE_FORCED_ENCODING_AFTER_SIGNALS_UPDATE_COOLDOWN_SECONDS = 4L * 60L * 60L; // 4 hours 1361 1362 /** 1363 * Returns {@code true} if forced encoding directly after a call to updateSignals() is enabled. 1364 */ getFledgeEnableForcedEncodingAfterSignalsUpdate()1365 default boolean getFledgeEnableForcedEncodingAfterSignalsUpdate() { 1366 return FLEDGE_ENABLE_FORCED_ENCODING_AFTER_SIGNALS_UPDATE; 1367 } 1368 1369 /** 1370 * Returns the cooldown period in seconds after any signals encoding during which forced 1371 * encoding directly after a call to updateSignals() will not occur. 1372 */ getFledgeForcedEncodingAfterSignalsUpdateCooldownSeconds()1373 default long getFledgeForcedEncodingAfterSignalsUpdateCooldownSeconds() { 1374 return FLEDGE_FORCED_ENCODING_AFTER_SIGNALS_UPDATE_COOLDOWN_SECONDS; 1375 } 1376 1377 int FLEDGE_AD_COUNTER_HISTOGRAM_ABSOLUTE_MAX_TOTAL_EVENT_COUNT = 10_000; 1378 int FLEDGE_AD_COUNTER_HISTOGRAM_LOWER_MAX_TOTAL_EVENT_COUNT = 9_500; 1379 int FLEDGE_AD_COUNTER_HISTOGRAM_ABSOLUTE_MAX_PER_BUYER_EVENT_COUNT = 1_000; 1380 int FLEDGE_AD_COUNTER_HISTOGRAM_LOWER_MAX_PER_BUYER_EVENT_COUNT = 900; 1381 1382 /** Returns the maximum allowed number of events in the entire frequency cap histogram table. */ getFledgeAdCounterHistogramAbsoluteMaxTotalEventCount()1383 default int getFledgeAdCounterHistogramAbsoluteMaxTotalEventCount() { 1384 return FLEDGE_AD_COUNTER_HISTOGRAM_ABSOLUTE_MAX_TOTAL_EVENT_COUNT; 1385 } 1386 1387 /** 1388 * Returns the number of events that the entire frequency cap histogram table should be trimmed 1389 * to, if there are too many entries. 1390 */ getFledgeAdCounterHistogramLowerMaxTotalEventCount()1391 default int getFledgeAdCounterHistogramLowerMaxTotalEventCount() { 1392 return FLEDGE_AD_COUNTER_HISTOGRAM_LOWER_MAX_TOTAL_EVENT_COUNT; 1393 } 1394 1395 /** 1396 * Returns the maximum allowed number of events per buyer in the frequency cap histogram table. 1397 */ getFledgeAdCounterHistogramAbsoluteMaxPerBuyerEventCount()1398 default int getFledgeAdCounterHistogramAbsoluteMaxPerBuyerEventCount() { 1399 return FLEDGE_AD_COUNTER_HISTOGRAM_ABSOLUTE_MAX_PER_BUYER_EVENT_COUNT; 1400 } 1401 1402 /** 1403 * Returns the number of events for a single buyer that the frequency cap histogram table should 1404 * be trimmed to, if there are too many entries for that buyer. 1405 */ getFledgeAdCounterHistogramLowerMaxPerBuyerEventCount()1406 default int getFledgeAdCounterHistogramLowerMaxPerBuyerEventCount() { 1407 return FLEDGE_AD_COUNTER_HISTOGRAM_LOWER_MAX_PER_BUYER_EVENT_COUNT; 1408 } 1409 1410 int FLEDGE_AD_SELECTION_MAX_CONCURRENT_BIDDING_COUNT = 6; 1411 1412 /** Returns the number of CA that can be bid in parallel for one Ad Selection */ getAdSelectionMaxConcurrentBiddingCount()1413 default int getAdSelectionMaxConcurrentBiddingCount() { 1414 return FLEDGE_AD_SELECTION_MAX_CONCURRENT_BIDDING_COUNT; 1415 } 1416 1417 // TODO(b/240647148): Limits are increased temporarily, re-evaluate these numbers after 1418 // getting real world data from telemetry & set accurately scoped timeout 1419 long FLEDGE_AD_SELECTION_BIDDING_TIMEOUT_PER_CA_MS = 5000; 1420 long FLEDGE_AD_SELECTION_BIDDING_TIMEOUT_PER_BUYER_MS = 10000; 1421 long FLEDGE_AD_SELECTION_SCORING_TIMEOUT_MS = 5000; 1422 long FLEDGE_AD_SELECTION_SELECTING_OUTCOME_TIMEOUT_MS = 5000; 1423 // For *on device* ad selection. 1424 long FLEDGE_AD_SELECTION_OVERALL_TIMEOUT_MS = 10000; 1425 long FLEDGE_AD_SELECTION_FROM_OUTCOMES_OVERALL_TIMEOUT_MS = 20_000; 1426 long FLEDGE_AD_SELECTION_OFF_DEVICE_OVERALL_TIMEOUT_MS = 10_000; 1427 long FLEDGE_AD_SELECTION_BIDDING_LOGIC_JS_VERSION = 2L; 1428 1429 long FLEDGE_REPORT_IMPRESSION_OVERALL_TIMEOUT_MS = 2000; 1430 1431 // RegisterAdBeacon Constants 1432 long FLEDGE_REPORT_IMPRESSION_MAX_REGISTERED_AD_BEACONS_TOTAL_COUNT = 1000; // Num entries 1433 long FLEDGE_REPORT_IMPRESSION_MAX_REGISTERED_AD_BEACONS_PER_AD_TECH_COUNT = 10; // Num entries 1434 long FLEDGE_REPORT_IMPRESSION_REGISTERED_AD_BEACONS_MAX_INTERACTION_KEY_SIZE_B = 1435 20 * 2; // Num characters * 2 bytes per char in UTF-8 1436 long FLEDGE_REPORT_IMPRESSION_MAX_INTERACTION_REPORTING_URI_SIZE_B = 400; 1437 1438 /** Returns the timeout constant in milliseconds that limits the bidding per CA */ getAdSelectionBiddingTimeoutPerCaMs()1439 default long getAdSelectionBiddingTimeoutPerCaMs() { 1440 return FLEDGE_AD_SELECTION_BIDDING_TIMEOUT_PER_CA_MS; 1441 } 1442 1443 /** Returns the timeout constant in milliseconds that limits the bidding per Buyer */ getAdSelectionBiddingTimeoutPerBuyerMs()1444 default long getAdSelectionBiddingTimeoutPerBuyerMs() { 1445 return FLEDGE_AD_SELECTION_BIDDING_TIMEOUT_PER_BUYER_MS; 1446 } 1447 1448 /** Returns the timeout constant in milliseconds that limits the scoring */ getAdSelectionScoringTimeoutMs()1449 default long getAdSelectionScoringTimeoutMs() { 1450 return FLEDGE_AD_SELECTION_SCORING_TIMEOUT_MS; 1451 } 1452 1453 /** 1454 * Returns the timeout constant in milliseconds that limits the {@link 1455 * com.android.adservices.service.adselection.AdOutcomeSelectorImpl#runAdOutcomeSelector} 1456 */ getAdSelectionSelectingOutcomeTimeoutMs()1457 default long getAdSelectionSelectingOutcomeTimeoutMs() { 1458 return FLEDGE_AD_SELECTION_SELECTING_OUTCOME_TIMEOUT_MS; 1459 } 1460 1461 /** 1462 * Returns the timeout constant in milliseconds that limits the overall *on device* ad selection 1463 * orchestration. 1464 */ getAdSelectionOverallTimeoutMs()1465 default long getAdSelectionOverallTimeoutMs() { 1466 return FLEDGE_AD_SELECTION_OVERALL_TIMEOUT_MS; 1467 } 1468 1469 /** 1470 * Returns the timeout constant in milliseconds that limits the overall *on device* ad selection 1471 * from outcomes orchestration. 1472 */ getAdSelectionFromOutcomesOverallTimeoutMs()1473 default long getAdSelectionFromOutcomesOverallTimeoutMs() { 1474 return FLEDGE_AD_SELECTION_FROM_OUTCOMES_OVERALL_TIMEOUT_MS; 1475 } 1476 1477 /** 1478 * Returns the timeout constant in milliseconds that limits the overall off device ad selection 1479 * orchestration. 1480 */ getAdSelectionOffDeviceOverallTimeoutMs()1481 default long getAdSelectionOffDeviceOverallTimeoutMs() { 1482 return FLEDGE_AD_SELECTION_OFF_DEVICE_OVERALL_TIMEOUT_MS; 1483 } 1484 1485 /** Returns the default JS version for running bidding. */ getFledgeAdSelectionBiddingLogicJsVersion()1486 default long getFledgeAdSelectionBiddingLogicJsVersion() { 1487 return FLEDGE_AD_SELECTION_BIDDING_LOGIC_JS_VERSION; 1488 } 1489 1490 /** 1491 * Returns the timeout constant in milliseconds that limits the overall impression reporting 1492 * execution 1493 */ getReportImpressionOverallTimeoutMs()1494 default long getReportImpressionOverallTimeoutMs() { 1495 return FLEDGE_REPORT_IMPRESSION_OVERALL_TIMEOUT_MS; 1496 } 1497 1498 /** 1499 * Returns the maximum number of {@link 1500 * com.android.adservices.data.adselection.DBRegisteredAdInteraction} that can be in the {@code 1501 * registered_ad_interactions} database at any one time. 1502 */ getFledgeReportImpressionMaxRegisteredAdBeaconsTotalCount()1503 default long getFledgeReportImpressionMaxRegisteredAdBeaconsTotalCount() { 1504 return FLEDGE_REPORT_IMPRESSION_MAX_REGISTERED_AD_BEACONS_TOTAL_COUNT; 1505 } 1506 1507 /** 1508 * Returns the maximum number of {@link 1509 * com.android.adservices.data.adselection.DBRegisteredAdInteraction} that an ad-tech can 1510 * register in one call to {@code reportImpression}. 1511 */ getFledgeReportImpressionMaxRegisteredAdBeaconsPerAdTechCount()1512 default long getFledgeReportImpressionMaxRegisteredAdBeaconsPerAdTechCount() { 1513 return FLEDGE_REPORT_IMPRESSION_MAX_REGISTERED_AD_BEACONS_PER_AD_TECH_COUNT; 1514 } 1515 1516 /** 1517 * Returns the maximum size in bytes of {@link 1518 * com.android.adservices.data.adselection.DBRegisteredAdInteraction#getInteractionKey()} 1519 */ getFledgeReportImpressionRegisteredAdBeaconsMaxInteractionKeySizeB()1520 default long getFledgeReportImpressionRegisteredAdBeaconsMaxInteractionKeySizeB() { 1521 return FLEDGE_REPORT_IMPRESSION_REGISTERED_AD_BEACONS_MAX_INTERACTION_KEY_SIZE_B; 1522 } 1523 1524 /** 1525 * Returns the maximum size in bytes of {@link 1526 * com.android.adservices.data.adselection.DBRegisteredAdInteraction#getInteractionReportingUri()} 1527 */ getFledgeReportImpressionMaxInteractionReportingUriSizeB()1528 default long getFledgeReportImpressionMaxInteractionReportingUriSizeB() { 1529 return FLEDGE_REPORT_IMPRESSION_MAX_INTERACTION_REPORTING_URI_SIZE_B; 1530 } 1531 1532 // 24 hours in seconds 1533 long FLEDGE_AD_SELECTION_EXPIRATION_WINDOW_S = 60 * 60 * 24; 1534 1535 /** 1536 * Returns the amount of time in seconds after which ad selection data is considered expired. 1537 */ getAdSelectionExpirationWindowS()1538 default long getAdSelectionExpirationWindowS() { 1539 return FLEDGE_AD_SELECTION_EXPIRATION_WINDOW_S; 1540 } 1541 1542 // Filtering feature flag disabled by default 1543 boolean FLEDGE_APP_INSTALL_FILTERING_ENABLED = false; 1544 1545 /** Returns {@code true} if app install filtering of ads during ad selection is enabled. */ getFledgeAppInstallFilteringEnabled()1546 default boolean getFledgeAppInstallFilteringEnabled() { 1547 return FLEDGE_APP_INSTALL_FILTERING_ENABLED; 1548 } 1549 1550 // Filtering feature flag disabled by default 1551 boolean FLEDGE_FREQUENCY_CAP_FILTERING_ENABLED = false; 1552 1553 /** Returns {@code true} if frequency cap filtering of ads during ad selection is enabled. */ getFledgeFrequencyCapFilteringEnabled()1554 default boolean getFledgeFrequencyCapFilteringEnabled() { 1555 return FLEDGE_FREQUENCY_CAP_FILTERING_ENABLED; 1556 } 1557 1558 boolean FLEDGE_AD_SELECTION_CONTEXTUAL_ADS_ENABLED = false; 1559 1560 /** Returns {@code true} if negative filtering of ads during ad selection is enabled. */ getFledgeAdSelectionContextualAdsEnabled()1561 default boolean getFledgeAdSelectionContextualAdsEnabled() { 1562 return FLEDGE_AD_SELECTION_CONTEXTUAL_ADS_ENABLED; 1563 } 1564 1565 boolean FLEDGE_AD_SELECTION_CONTEXTUAL_ADS_METRICS_ENABLED = false; 1566 1567 /** Returns {@code true} if contextual ads signing metrics collection is enabled */ getFledgeAdSelectionContextualAdsMetricsEnabled()1568 default boolean getFledgeAdSelectionContextualAdsMetricsEnabled() { 1569 return FLEDGE_AD_SELECTION_CONTEXTUAL_ADS_METRICS_ENABLED; 1570 } 1571 1572 boolean FLEDGE_APP_INSTALL_FILTERING_METRICS_ENABLED = false; 1573 1574 /** Returns {@code true} if App Install Filtering metrics is enabled. */ getFledgeAppInstallFilteringMetricsEnabled()1575 default boolean getFledgeAppInstallFilteringMetricsEnabled() { 1576 return FLEDGE_APP_INSTALL_FILTERING_METRICS_ENABLED; 1577 } 1578 1579 boolean FLEDGE_FREQUENCY_CAP_FILTERING_METRICS_ENABLED = false; 1580 1581 /** Returns {@code true} if Frequency Cap Filtering metrics is enabled. */ getFledgeFrequencyCapFilteringMetricsEnabled()1582 default boolean getFledgeFrequencyCapFilteringMetricsEnabled() { 1583 return FLEDGE_FREQUENCY_CAP_FILTERING_METRICS_ENABLED; 1584 } 1585 1586 // Enable FLEDGE fetchAndJoinCustomAudience API. 1587 boolean FLEDGE_FETCH_CUSTOM_AUDIENCE_ENABLED = false; 1588 1589 /** Returns {@code true} if FLEDGE fetchAndJoinCustomAudience API is enabled. */ getFledgeFetchCustomAudienceEnabled()1590 default boolean getFledgeFetchCustomAudienceEnabled() { 1591 return FLEDGE_FETCH_CUSTOM_AUDIENCE_ENABLED; 1592 } 1593 1594 /** Flags related to Delayed Custom Audience Updates */ 1595 1596 // Enable scheduleCustomAudienceUpdateApi() 1597 boolean FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_ENABLED = false; 1598 1599 @FeatureFlag 1600 boolean FLEDGE_ENABLE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_ADDITIONAL_SCHEDULE_REQUESTS = false; 1601 1602 long FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_JOB_PERIOD_MS = 1L * 60L * 60L * 1000L; // 1 hour 1603 long FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_JOB_FLEX_MS = 5L * 60L * 1000L; // 5 minutes 1604 int FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_MIN_DELAY_MINS_OVERRIDE = 30; 1605 1606 @ConfigFlag int FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_MAX_BYTES = 100 * 1024; 1607 1608 @ConfigFlag 1609 int FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_BACKGROUND_JOB_REQUIRED_NETWORK_TYPE = 1610 JobInfo.NETWORK_TYPE_UNMETERED; 1611 getFledgeScheduleCustomAudienceUpdateBackgroundJobRequiredNetworkType()1612 default int getFledgeScheduleCustomAudienceUpdateBackgroundJobRequiredNetworkType() { 1613 return FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_BACKGROUND_JOB_REQUIRED_NETWORK_TYPE; 1614 } 1615 getFledgeScheduleCustomAudienceUpdateEnabled()1616 default boolean getFledgeScheduleCustomAudienceUpdateEnabled() { 1617 return !getGlobalKillSwitch() && FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_ENABLED; 1618 } 1619 getFledgeEnableScheduleCustomAudienceUpdateAdditionalScheduleRequests()1620 default boolean getFledgeEnableScheduleCustomAudienceUpdateAdditionalScheduleRequests() { 1621 return getFledgeScheduleCustomAudienceUpdateEnabled() 1622 && FLEDGE_ENABLE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_ADDITIONAL_SCHEDULE_REQUESTS; 1623 } 1624 getFledgeScheduleCustomAudienceUpdateJobPeriodMs()1625 default long getFledgeScheduleCustomAudienceUpdateJobPeriodMs() { 1626 return FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_JOB_PERIOD_MS; 1627 } 1628 getFledgeScheduleCustomAudienceUpdateJobFlexMs()1629 default long getFledgeScheduleCustomAudienceUpdateJobFlexMs() { 1630 return FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_JOB_FLEX_MS; 1631 } 1632 getFledgeScheduleCustomAudienceMinDelayMinsOverride()1633 default int getFledgeScheduleCustomAudienceMinDelayMinsOverride() { 1634 return FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_MIN_DELAY_MINS_OVERRIDE; 1635 } 1636 getFledgeScheduleCustomAudienceUpdateMaxBytes()1637 default int getFledgeScheduleCustomAudienceUpdateMaxBytes() { 1638 return FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_MAX_BYTES; 1639 } 1640 1641 boolean FLEDGE_AD_SELECTION_PREBUILT_URI_ENABLED = false; 1642 1643 /** Returns whether to call trusted servers for off device ad selection. */ getFledgeAdSelectionPrebuiltUriEnabled()1644 default boolean getFledgeAdSelectionPrebuiltUriEnabled() { 1645 return FLEDGE_AD_SELECTION_PREBUILT_URI_ENABLED; 1646 } 1647 1648 boolean FLEDGE_AUCTION_SERVER_ENABLED = false; 1649 1650 /** Returns whether to enable server auction support in post-auction APIs. */ getFledgeAuctionServerEnabled()1651 default boolean getFledgeAuctionServerEnabled() { 1652 return FLEDGE_AUCTION_SERVER_ENABLED; 1653 } 1654 1655 boolean FLEDGE_AUCTION_SERVER_ENABLED_FOR_REPORT_IMPRESSION = true; 1656 1657 /** Returns whether to enable server auction support in report impression. */ getFledgeAuctionServerEnabledForReportImpression()1658 default boolean getFledgeAuctionServerEnabledForReportImpression() { 1659 return getFledgeAuctionServerEnabled() 1660 && FLEDGE_AUCTION_SERVER_ENABLED_FOR_REPORT_IMPRESSION; 1661 } 1662 1663 boolean FLEDGE_AUCTION_SERVER_ENABLED_FOR_REPORT_EVENT = true; 1664 1665 /** Returns whether to enable server auction support in report event API. */ getFledgeAuctionServerEnabledForReportEvent()1666 default boolean getFledgeAuctionServerEnabledForReportEvent() { 1667 return getFledgeAuctionServerEnabled() && FLEDGE_AUCTION_SERVER_ENABLED_FOR_REPORT_EVENT; 1668 } 1669 1670 boolean FLEDGE_AUCTION_SERVER_ENABLED_FOR_UPDATE_HISTOGRAM = true; 1671 1672 /** Returns whether to enable server auction support in update histogram API. */ getFledgeAuctionServerEnabledForUpdateHistogram()1673 default boolean getFledgeAuctionServerEnabledForUpdateHistogram() { 1674 return getFledgeAuctionServerEnabled() 1675 && FLEDGE_AUCTION_SERVER_ENABLED_FOR_UPDATE_HISTOGRAM; 1676 } 1677 1678 boolean FLEDGE_AUCTION_SERVER_ENABLED_FOR_SELECT_ADS_MEDIATION = true; 1679 1680 /** Returns whether to enable server auction support in select ads mediation API. */ getFledgeAuctionServerEnabledForSelectAdsMediation()1681 default boolean getFledgeAuctionServerEnabledForSelectAdsMediation() { 1682 return getFledgeAuctionServerEnabled() 1683 && FLEDGE_AUCTION_SERVER_ENABLED_FOR_SELECT_ADS_MEDIATION; 1684 } 1685 1686 boolean FLEDGE_AUCTION_SERVER_ENABLE_AD_FILTER_IN_GET_AD_SELECTION_DATA = true; 1687 1688 /** Returns whether to enable ad filtering in get ad selection data API. */ getFledgeAuctionServerEnableAdFilterInGetAdSelectionData()1689 default boolean getFledgeAuctionServerEnableAdFilterInGetAdSelectionData() { 1690 return FLEDGE_AUCTION_SERVER_ENABLE_AD_FILTER_IN_GET_AD_SELECTION_DATA; 1691 } 1692 1693 boolean FLEDGE_AUCTION_SERVER_MEDIA_TYPE_CHANGE_ENABLED = false; 1694 1695 /** Returns whether to use the server auction media type. */ getFledgeAuctionServerMediaTypeChangeEnabled()1696 default boolean getFledgeAuctionServerMediaTypeChangeEnabled() { 1697 return FLEDGE_AUCTION_SERVER_MEDIA_TYPE_CHANGE_ENABLED; 1698 } 1699 1700 ImmutableList<Integer> FLEDGE_AUCTION_SERVER_PAYLOAD_BUCKET_SIZES = 1701 ImmutableList.of(0, 1024, 2048, 4096, 8192, 16384, 32768, 65536); 1702 1703 /** Returns available bucket sizes for auction server payloads. */ getFledgeAuctionServerPayloadBucketSizes()1704 default ImmutableList<Integer> getFledgeAuctionServerPayloadBucketSizes() { 1705 return FLEDGE_AUCTION_SERVER_PAYLOAD_BUCKET_SIZES; 1706 } 1707 1708 // TODO(b/291680065): Remove when owner field is returned from B&A 1709 boolean FLEDGE_AUCTION_SERVER_FORCE_SEARCH_WHEN_OWNER_IS_ABSENT_ENABLED = false; 1710 1711 /** 1712 * Returns true if forcing {@link 1713 * android.adservices.adselection.AdSelectionManager#persistAdSelectionResult} to continue when 1714 * owner is null, otherwise false. 1715 */ getFledgeAuctionServerForceSearchWhenOwnerIsAbsentEnabled()1716 default boolean getFledgeAuctionServerForceSearchWhenOwnerIsAbsentEnabled() { 1717 return FLEDGE_AUCTION_SERVER_FORCE_SEARCH_WHEN_OWNER_IS_ABSENT_ENABLED; 1718 } 1719 1720 boolean FLEDGE_EVENT_LEVEL_DEBUG_REPORTING_ENABLED = false; 1721 1722 /** Returns whether to call remote URLs for debug reporting. */ getFledgeEventLevelDebugReportingEnabled()1723 default boolean getFledgeEventLevelDebugReportingEnabled() { 1724 return FLEDGE_EVENT_LEVEL_DEBUG_REPORTING_ENABLED; 1725 } 1726 1727 boolean FLEDGE_EVENT_LEVEL_DEBUG_REPORT_SEND_IMMEDIATELY = false; 1728 1729 /** Returns whether to call remote URLs for debug reporting. */ getFledgeEventLevelDebugReportSendImmediately()1730 default boolean getFledgeEventLevelDebugReportSendImmediately() { 1731 return FLEDGE_EVENT_LEVEL_DEBUG_REPORT_SEND_IMMEDIATELY; 1732 } 1733 1734 int FLEDGE_EVENT_LEVEL_DEBUG_REPORTING_BATCH_DELAY_SECONDS = 60 * 15; 1735 1736 /** Returns minimum number of seconds between debug report batch. */ getFledgeEventLevelDebugReportingBatchDelaySeconds()1737 default int getFledgeEventLevelDebugReportingBatchDelaySeconds() { 1738 return FLEDGE_EVENT_LEVEL_DEBUG_REPORTING_BATCH_DELAY_SECONDS; 1739 } 1740 1741 int FLEDGE_EVENT_LEVEL_DEBUG_REPORTING_MAX_ITEMS_PER_BATCH = 1000; 1742 1743 /** Returns maximum number of items in a debug report batch. */ getFledgeEventLevelDebugReportingMaxItemsPerBatch()1744 default int getFledgeEventLevelDebugReportingMaxItemsPerBatch() { 1745 return FLEDGE_EVENT_LEVEL_DEBUG_REPORTING_MAX_ITEMS_PER_BATCH; 1746 } 1747 1748 int FLEDGE_DEBUG_REPORT_SENDER_JOB_NETWORK_CONNECT_TIMEOUT_MS = 5 * 1000; // 5 seconds 1749 1750 /** 1751 * Returns the maximum time in milliseconds allowed for a network call to open its initial 1752 * connection during the FLEDGE debug report sender job. 1753 */ getFledgeDebugReportSenderJobNetworkConnectionTimeoutMs()1754 default int getFledgeDebugReportSenderJobNetworkConnectionTimeoutMs() { 1755 return FLEDGE_DEBUG_REPORT_SENDER_JOB_NETWORK_CONNECT_TIMEOUT_MS; 1756 } 1757 1758 int FLEDGE_DEBUG_REPORT_SENDER_JOB_NETWORK_READ_TIMEOUT_MS = 30 * 1000; // 30 seconds 1759 1760 /** 1761 * Returns the maximum time in milliseconds allowed for a network call to read a response from a 1762 * target server during the FLEDGE debug report sender job. 1763 */ getFledgeDebugReportSenderJobNetworkReadTimeoutMs()1764 default int getFledgeDebugReportSenderJobNetworkReadTimeoutMs() { 1765 return FLEDGE_DEBUG_REPORT_SENDER_JOB_NETWORK_READ_TIMEOUT_MS; 1766 } 1767 1768 long FLEDGE_DEBUG_REPORT_SENDER_JOB_MAX_RUNTIME_MS = 10L * 60L * 1000L; // 5 minutes 1769 1770 /** 1771 * Returns the maximum amount of time (in milliseconds) each FLEDGE debug report sender job is 1772 * allowed to run. 1773 */ getFledgeDebugReportSenderJobMaxRuntimeMs()1774 default long getFledgeDebugReportSenderJobMaxRuntimeMs() { 1775 return FLEDGE_DEBUG_REPORT_SENDER_JOB_MAX_RUNTIME_MS; 1776 } 1777 1778 long FLEDGE_DEBUG_REPORT_SENDER_JOB_PERIOD_MS = TimeUnit.MINUTES.toMillis(10); 1779 1780 /** 1781 * Returns the best effort max time (in milliseconds) between each FLEDGE debug report sender 1782 * job run. 1783 */ getFledgeDebugReportSenderJobPeriodMs()1784 default long getFledgeDebugReportSenderJobPeriodMs() { 1785 return FLEDGE_DEBUG_REPORT_SENDER_JOB_PERIOD_MS; 1786 } 1787 1788 long FLEDGE_DEBUG_REPORT_SENDER_JOB_FLEX_MS = TimeUnit.MINUTES.toMillis(2); 1789 1790 /** 1791 * Returns the amount of flex (in milliseconds) around the end of each period to run each FLEDGE 1792 * debug report sender job. 1793 */ getFledgeDebugReportSenderJobFlexMs()1794 default long getFledgeDebugReportSenderJobFlexMs() { 1795 return FLEDGE_DEBUG_REPORT_SENDER_JOB_FLEX_MS; 1796 } 1797 1798 boolean FLEDGE_AD_SELECTION_OFF_DEVICE_REQUEST_COMPRESSION_ENABLED = true; 1799 1800 /** Returns whether to compress requests sent off device for ad selection. */ getAdSelectionOffDeviceRequestCompressionEnabled()1801 default boolean getAdSelectionOffDeviceRequestCompressionEnabled() { 1802 return FLEDGE_AD_SELECTION_OFF_DEVICE_REQUEST_COMPRESSION_ENABLED; 1803 } 1804 1805 /** The server uses the following version numbers: 1. Brotli : 1 2. Gzip : 2 */ 1806 int FLEDGE_AUCTION_SERVER_COMPRESSION_ALGORITHM_VERSION = 2; 1807 1808 /** Returns the compression algorithm version */ getFledgeAuctionServerCompressionAlgorithmVersion()1809 default int getFledgeAuctionServerCompressionAlgorithmVersion() { 1810 return FLEDGE_AUCTION_SERVER_COMPRESSION_ALGORITHM_VERSION; 1811 } 1812 1813 String FLEDGE_AUCTION_SERVER_AUCTION_KEY_FETCH_URI = 1814 "https://publickeyservice.pa.gcp.privacysandboxservices.com/" 1815 + ".well-known/protected-auction/v1/public-keys"; 1816 1817 /** Returns Uri to fetch auction encryption key for fledge ad selection. */ getFledgeAuctionServerAuctionKeyFetchUri()1818 default String getFledgeAuctionServerAuctionKeyFetchUri() { 1819 return FLEDGE_AUCTION_SERVER_AUCTION_KEY_FETCH_URI; 1820 } 1821 1822 boolean FLEDGE_AUCTION_SERVER_REFRESH_EXPIRED_KEYS_DURING_AUCTION = false; 1823 getFledgeAuctionServerRefreshExpiredKeysDuringAuction()1824 default boolean getFledgeAuctionServerRefreshExpiredKeysDuringAuction() { 1825 return FLEDGE_AUCTION_SERVER_REFRESH_EXPIRED_KEYS_DURING_AUCTION; 1826 } 1827 1828 /** Default value of the url to fetch keys for KAnon encryption */ 1829 String FLEDGE_AUCTION_SERVER_JOIN_KEY_FETCH_URI = ""; 1830 1831 /** Returns Uri to fetch join encryption key for fledge ad selection. */ getFledgeAuctionServerJoinKeyFetchUri()1832 default String getFledgeAuctionServerJoinKeyFetchUri() { 1833 return FLEDGE_AUCTION_SERVER_JOIN_KEY_FETCH_URI; 1834 } 1835 1836 int FLEDGE_AUCTION_SERVER_AUCTION_KEY_SHARDING = 5; 1837 1838 /** Returns Shard count for using auction key for fledge ad selection. */ getFledgeAuctionServerAuctionKeySharding()1839 default int getFledgeAuctionServerAuctionKeySharding() { 1840 return FLEDGE_AUCTION_SERVER_AUCTION_KEY_SHARDING; 1841 } 1842 1843 long FLEDGE_AUCTION_SERVER_ENCRYPTION_KEY_MAX_AGE_SECONDS = TimeUnit.DAYS.toSeconds(14); 1844 getFledgeAuctionServerEncryptionKeyMaxAgeSeconds()1845 default long getFledgeAuctionServerEncryptionKeyMaxAgeSeconds() { 1846 return FLEDGE_AUCTION_SERVER_ENCRYPTION_KEY_MAX_AGE_SECONDS; 1847 } 1848 1849 int FLEDGE_AUCTION_SERVER_ENCRYPTION_ALGORITHM_KDF_ID = 0x0001; 1850 getFledgeAuctionServerEncryptionAlgorithmKdfId()1851 default int getFledgeAuctionServerEncryptionAlgorithmKdfId() { 1852 return FLEDGE_AUCTION_SERVER_ENCRYPTION_ALGORITHM_KDF_ID; 1853 } 1854 1855 int FLEDGE_AUCTION_SERVER_ENCRYPTION_ALGORITHM_KEM_ID = 0x0020; 1856 getFledgeAuctionServerEncryptionAlgorithmKemId()1857 default int getFledgeAuctionServerEncryptionAlgorithmKemId() { 1858 return FLEDGE_AUCTION_SERVER_ENCRYPTION_ALGORITHM_KEM_ID; 1859 } 1860 1861 int FLEDGE_AUCTION_SERVER_ENCRYPTION_ALGORITHM_AEAD_ID = 0x0002; 1862 getFledgeAuctionServerEncryptionAlgorithmAeadId()1863 default int getFledgeAuctionServerEncryptionAlgorithmAeadId() { 1864 return FLEDGE_AUCTION_SERVER_ENCRYPTION_ALGORITHM_AEAD_ID; 1865 } 1866 1867 int FLEDGE_AUCTION_SERVER_PAYLOAD_FORMAT_VERSION = 0; 1868 1869 /** Returns the payload formatter version */ getFledgeAuctionServerPayloadFormatVersion()1870 default int getFledgeAuctionServerPayloadFormatVersion() { 1871 return FLEDGE_AUCTION_SERVER_PAYLOAD_FORMAT_VERSION; 1872 } 1873 1874 long FLEDGE_AUCTION_SERVER_AUCTION_KEY_FETCH_TIMEOUT_MS = 3000; 1875 getFledgeAuctionServerAuctionKeyFetchTimeoutMs()1876 default long getFledgeAuctionServerAuctionKeyFetchTimeoutMs() { 1877 return FLEDGE_AUCTION_SERVER_AUCTION_KEY_FETCH_TIMEOUT_MS; 1878 } 1879 1880 long FLEDGE_AUCTION_SERVER_OVERALL_TIMEOUT_MS = 5000; 1881 getFledgeAuctionServerOverallTimeoutMs()1882 default long getFledgeAuctionServerOverallTimeoutMs() { 1883 return FLEDGE_AUCTION_SERVER_OVERALL_TIMEOUT_MS; 1884 } 1885 1886 boolean FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_JOB_ENABLED = false; 1887 1888 /** Returns whether to run periodic job to fetch encryption keys. */ getFledgeAuctionServerBackgroundKeyFetchJobEnabled()1889 default boolean getFledgeAuctionServerBackgroundKeyFetchJobEnabled() { 1890 return FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_JOB_ENABLED; 1891 } 1892 1893 int FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_NETWORK_CONNECT_TIMEOUT_MS = 1894 5 * 1000; // 5 seconds 1895 1896 /** 1897 * Returns the maximum time in milliseconds allowed for a network call to open its initial 1898 * connection during the FLEDGE encryption key fetch. 1899 */ getFledgeAuctionServerBackgroundKeyFetchNetworkConnectTimeoutMs()1900 default int getFledgeAuctionServerBackgroundKeyFetchNetworkConnectTimeoutMs() { 1901 return FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_NETWORK_CONNECT_TIMEOUT_MS; 1902 } 1903 1904 int FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_NETWORK_READ_TIMEOUT_MS = 1905 30 * 1000; // 30 seconds 1906 1907 /** 1908 * Returns the maximum time in milliseconds allowed for a network call to read a response from a 1909 * target server during the FLEDGE encryption key fetch. 1910 */ getFledgeAuctionServerBackgroundKeyFetchNetworkReadTimeoutMs()1911 default int getFledgeAuctionServerBackgroundKeyFetchNetworkReadTimeoutMs() { 1912 return FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_NETWORK_READ_TIMEOUT_MS; 1913 } 1914 1915 int FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_MAX_RESPONSE_SIZE_B = 2 * 1024; // 2 KiB 1916 1917 /** 1918 * Returns the maximum size in bytes of a single key fetch response during the FLEDGE encryption 1919 * key fetch. 1920 */ getFledgeAuctionServerBackgroundKeyFetchMaxResponseSizeB()1921 default int getFledgeAuctionServerBackgroundKeyFetchMaxResponseSizeB() { 1922 return FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_MAX_RESPONSE_SIZE_B; 1923 } 1924 1925 boolean FLEDGE_AUCTION_SERVER_BACKGROUND_AUCTION_KEY_FETCH_ENABLED = false; 1926 1927 /** Returns whether to run periodic job to fetch AUCTION keys. */ getFledgeAuctionServerBackgroundAuctionKeyFetchEnabled()1928 default boolean getFledgeAuctionServerBackgroundAuctionKeyFetchEnabled() { 1929 return getFledgeAuctionServerBackgroundKeyFetchJobEnabled() 1930 && FLEDGE_AUCTION_SERVER_BACKGROUND_AUCTION_KEY_FETCH_ENABLED; 1931 } 1932 1933 boolean FLEDGE_AUCTION_SERVER_BACKGROUND_JOIN_KEY_FETCH_ENABLED = false; 1934 1935 /** Returns whether to run periodic job to fetch JOIN keys. */ getFledgeAuctionServerBackgroundJoinKeyFetchEnabled()1936 default boolean getFledgeAuctionServerBackgroundJoinKeyFetchEnabled() { 1937 return getFledgeAuctionServerBackgroundKeyFetchJobEnabled() 1938 && FLEDGE_AUCTION_SERVER_BACKGROUND_JOIN_KEY_FETCH_ENABLED; 1939 } 1940 1941 long FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_MAX_RUNTIME_MS = TimeUnit.MINUTES.toMillis(5); 1942 1943 /** 1944 * Returns the maximum amount of time (in milliseconds) each Ad selection Background key Fetch 1945 * job is allowed to run. 1946 */ getFledgeAuctionServerBackgroundKeyFetchJobMaxRuntimeMs()1947 default long getFledgeAuctionServerBackgroundKeyFetchJobMaxRuntimeMs() { 1948 return FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_MAX_RUNTIME_MS; 1949 } 1950 1951 long FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_JOB_PERIOD_MS = TimeUnit.HOURS.toMillis(24); 1952 1953 /** 1954 * Returns the best effort max time (in milliseconds) between each Background Key Fetch job run. 1955 */ getFledgeAuctionServerBackgroundKeyFetchJobPeriodMs()1956 default long getFledgeAuctionServerBackgroundKeyFetchJobPeriodMs() { 1957 return FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_JOB_PERIOD_MS; 1958 } 1959 1960 long FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_JOB_FLEX_MS = TimeUnit.HOURS.toMillis(2); 1961 1962 /** 1963 * Returns the amount of flex (in milliseconds) around the end of each period to run each 1964 * Background Key Fetch job. 1965 */ getFledgeAuctionServerBackgroundKeyFetchJobFlexMs()1966 default long getFledgeAuctionServerBackgroundKeyFetchJobFlexMs() { 1967 return FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_JOB_FLEX_MS; 1968 } 1969 1970 boolean FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_ON_EMPTY_DB_AND_IN_ADVANCE_ENABLED = false; 1971 1972 /** 1973 * Returns whether that the periodic job to fetch encryption keys should force refresh if the 1974 * database is empty or if the keys are within 1975 * FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_IN_ADVANCE_INTERVAL_MS to expire. 1976 */ getFledgeAuctionServerBackgroundKeyFetchOnEmptyDbAndInAdvanceEnabled()1977 default boolean getFledgeAuctionServerBackgroundKeyFetchOnEmptyDbAndInAdvanceEnabled() { 1978 return getFledgeAuctionServerBackgroundKeyFetchJobEnabled() 1979 && FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_ON_EMPTY_DB_AND_IN_ADVANCE_ENABLED; 1980 } 1981 1982 long FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_IN_ADVANCE_INTERVAL_MS = 1983 TimeUnit.HOURS.toMillis(24); 1984 1985 /** 1986 * Returns the interval at which a key is considered to be almost expired and preventive 1987 * refreshed 1988 */ getFledgeAuctionServerBackgroundKeyFetchInAdvanceIntervalMs()1989 default long getFledgeAuctionServerBackgroundKeyFetchInAdvanceIntervalMs() { 1990 return FLEDGE_AUCTION_SERVER_BACKGROUND_KEY_FETCH_IN_ADVANCE_INTERVAL_MS; 1991 } 1992 1993 boolean FLEDGE_AUCTION_SERVER_ENABLE_DEBUG_REPORTING = true; 1994 getFledgeAuctionServerEnableDebugReporting()1995 default boolean getFledgeAuctionServerEnableDebugReporting() { 1996 return FLEDGE_AUCTION_SERVER_ENABLE_DEBUG_REPORTING; 1997 } 1998 1999 long DEFAULT_AUCTION_SERVER_AD_ID_FETCHER_TIMEOUT_MS = 20; 2000 2001 /** 2002 * Returns configured timeout value for {@link 2003 * com.android.adservices.service.adselection.AdIdFetcher} logic for server auctions. 2004 * 2005 * <p>The intended goal is to override this value for tests. 2006 * 2007 * <p>Returns Timeout in mills. 2008 */ getFledgeAuctionServerAdIdFetcherTimeoutMs()2009 default long getFledgeAuctionServerAdIdFetcherTimeoutMs() { 2010 return DEFAULT_AUCTION_SERVER_AD_ID_FETCHER_TIMEOUT_MS; 2011 } 2012 2013 /** Default value for feature flag for PAS unlimited egress in Server auctions. */ 2014 boolean DEFAULT_FLEDGE_AUCTION_SERVER_ENABLE_PAS_UNLIMITED_EGRESS = false; 2015 2016 /** 2017 * @return feature flag to enable PAS unlimited egress in Server auctions 2018 */ getFledgeAuctionServerEnablePasUnlimitedEgress()2019 default boolean getFledgeAuctionServerEnablePasUnlimitedEgress() { 2020 return DEFAULT_FLEDGE_AUCTION_SERVER_ENABLE_PAS_UNLIMITED_EGRESS; 2021 } 2022 2023 boolean FLEDGE_AUCTION_SERVER_AD_RENDER_ID_ENABLED = false; 2024 long FLEDGE_AUCTION_SERVER_AD_RENDER_ID_MAX_LENGTH = 12L; 2025 2026 /** Returns whether ad render id is enabled. */ getFledgeAuctionServerAdRenderIdEnabled()2027 default boolean getFledgeAuctionServerAdRenderIdEnabled() { 2028 return FLEDGE_AUCTION_SERVER_AD_RENDER_ID_ENABLED; 2029 } 2030 2031 /** Returns the max length of Ad Render Id. */ getFledgeAuctionServerAdRenderIdMaxLength()2032 default long getFledgeAuctionServerAdRenderIdMaxLength() { 2033 return FLEDGE_AUCTION_SERVER_AD_RENDER_ID_MAX_LENGTH; 2034 } 2035 2036 boolean FLEDGE_AUCTION_SERVER_REQUEST_FLAGS_ENABLED = false; 2037 2038 /** Returns whether the server auction request flags are enabled */ getFledgeAuctionServerRequestFlagsEnabled()2039 default boolean getFledgeAuctionServerRequestFlagsEnabled() { 2040 return FLEDGE_AUCTION_SERVER_REQUEST_FLAGS_ENABLED; 2041 } 2042 2043 boolean FLEDGE_AUCTION_SERVER_OMIT_ADS_ENABLED = false; 2044 2045 /** Returns whether the omit-ads flag is enabled for the server auction. */ getFledgeAuctionServerOmitAdsEnabled()2046 default boolean getFledgeAuctionServerOmitAdsEnabled() { 2047 return FLEDGE_AUCTION_SERVER_OMIT_ADS_ENABLED; 2048 } 2049 2050 String FLEDGE_AUCTION_SERVER_COORDINATOR_URL_ALLOWLIST = 2051 "https://publickeyservice.pa.gcp.privacysandboxservices.com/.well-known/" 2052 + "protected-auction/v1/public-keys," 2053 + "https://publickeyservice.pa.aws.privacysandboxservices.com/.well-known/" 2054 + "protected-auction/v1/public-keys"; 2055 getFledgeAuctionServerCoordinatorUrlAllowlist()2056 default String getFledgeAuctionServerCoordinatorUrlAllowlist() { 2057 return FLEDGE_AUCTION_SERVER_COORDINATOR_URL_ALLOWLIST; 2058 } 2059 2060 @FeatureFlag 2061 boolean FLEDGE_AUCTION_SERVER_GET_AD_SELECTION_DATA_PAYLOAD_METRICS_ENABLED = false; 2062 2063 /** Returns whether the fledge GetAdSelectionData payload metrics are enabled. */ getFledgeAuctionServerGetAdSelectionDataPayloadMetricsEnabled()2064 default boolean getFledgeAuctionServerGetAdSelectionDataPayloadMetricsEnabled() { 2065 return FLEDGE_AUCTION_SERVER_GET_AD_SELECTION_DATA_PAYLOAD_METRICS_ENABLED; 2066 } 2067 2068 @FeatureFlag boolean FLEDGE_GET_AD_SELECTION_DATA_SELLER_CONFIGURATION_ENABLED = false; 2069 2070 /** Returns whether the seller configuration feature for getAdSelectionData is enabled. */ getFledgeGetAdSelectionDataSellerConfigurationEnabled()2071 default boolean getFledgeGetAdSelectionDataSellerConfigurationEnabled() { 2072 return FLEDGE_GET_AD_SELECTION_DATA_SELLER_CONFIGURATION_ENABLED; 2073 } 2074 2075 @ConfigFlag int FLEDGE_GET_AD_SELECTION_DATA_BUYER_INPUT_CREATOR_VERSION = 0; 2076 2077 /** Returns the getAdSelectionData data buyer input creator version */ getFledgeGetAdSelectionDataBuyerInputCreatorVersion()2078 default int getFledgeGetAdSelectionDataBuyerInputCreatorVersion() { 2079 return FLEDGE_GET_AD_SELECTION_DATA_BUYER_INPUT_CREATOR_VERSION; 2080 } 2081 2082 @ConfigFlag int FLEDGE_GET_AD_SELECTION_DATA_MAX_NUM_ENTIRE_PAYLOAD_COMPRESSIONS = 5; 2083 2084 /** 2085 * Returns the maximum number of times we can re-compress the entire payload during 2086 * getAdSelectionData payload optimization. 2087 */ getFledgeGetAdSelectionDataMaxNumEntirePayloadCompressions()2088 default int getFledgeGetAdSelectionDataMaxNumEntirePayloadCompressions() { 2089 return FLEDGE_GET_AD_SELECTION_DATA_MAX_NUM_ENTIRE_PAYLOAD_COMPRESSIONS; 2090 } 2091 2092 @FeatureFlag boolean FLEDGE_GET_AD_SELECTION_DATA_DESERIALIZE_ONLY_AD_RENDER_IDS = false; 2093 2094 /** 2095 * Returns whether querying custom audiences from the DB, for the getAdSelectionData API, will 2096 * deserialize only ad render ids or the entire ad. When enabled, the DB query will only 2097 * deserialize ad render ids. 2098 */ getFledgeGetAdSelectionDataDeserializeOnlyAdRenderIds()2099 default boolean getFledgeGetAdSelectionDataDeserializeOnlyAdRenderIds() { 2100 return FLEDGE_GET_AD_SELECTION_DATA_DESERIALIZE_ONLY_AD_RENDER_IDS; 2101 } 2102 2103 // Protected signals cleanup feature flag disabled by default 2104 boolean PROTECTED_SIGNALS_CLEANUP_ENABLED = false; 2105 2106 /** Returns {@code true} if protected signals cleanup is enabled. */ getProtectedSignalsCleanupEnabled()2107 default boolean getProtectedSignalsCleanupEnabled() { 2108 return PROTECTED_SIGNALS_CLEANUP_ENABLED; 2109 } 2110 2111 boolean ADSERVICES_ENABLED = false; 2112 getAdServicesEnabled()2113 default boolean getAdServicesEnabled() { 2114 return ADSERVICES_ENABLED; 2115 } 2116 2117 /** 2118 * The number of epoch to look back to do garbage collection for old epoch data. Assume current 2119 * Epoch is T, then any epoch data of (T-NUMBER_OF_EPOCHS_TO_KEEP_IN_HISTORY-1) (inclusive) 2120 * should be erased 2121 */ 2122 int NUMBER_OF_EPOCHS_TO_KEEP_IN_HISTORY = TOPICS_NUMBER_OF_LOOK_BACK_EPOCHS; 2123 2124 /* 2125 * Return the number of epochs to keep in the history 2126 */ getNumberOfEpochsToKeepInHistory()2127 default int getNumberOfEpochsToKeepInHistory() { 2128 return NUMBER_OF_EPOCHS_TO_KEEP_IN_HISTORY; 2129 } 2130 2131 /** Downloader Connection Timeout in Milliseconds. */ 2132 int DOWNLOADER_CONNECTION_TIMEOUT_MS = 10 * 1000; // 10 seconds. 2133 2134 /* 2135 * Return the Downloader Connection Timeout in Milliseconds. 2136 */ getDownloaderConnectionTimeoutMs()2137 default int getDownloaderConnectionTimeoutMs() { 2138 return DOWNLOADER_CONNECTION_TIMEOUT_MS; 2139 } 2140 2141 /** Downloader Read Timeout in Milliseconds. */ 2142 int DOWNLOADER_READ_TIMEOUT_MS = 10 * 1000; // 10 seconds. 2143 2144 /** Returns the Downloader Read Timeout in Milliseconds. */ getDownloaderReadTimeoutMs()2145 default int getDownloaderReadTimeoutMs() { 2146 return DOWNLOADER_READ_TIMEOUT_MS; 2147 } 2148 2149 /** Downloader max download threads. */ 2150 int DOWNLOADER_MAX_DOWNLOAD_THREADS = 2; 2151 2152 /** Returns the Downloader Read Timeout in Milliseconds. */ getDownloaderMaxDownloadThreads()2153 default int getDownloaderMaxDownloadThreads() { 2154 return DOWNLOADER_MAX_DOWNLOAD_THREADS; 2155 } 2156 2157 /** MDD Topics API Classifier Manifest Url. Topics classifier v2-3. Build_id = 1467. */ 2158 String MDD_TOPICS_CLASSIFIER_MANIFEST_FILE_URL = 2159 "https://www.gstatic.com/mdi-serving/rubidium-adservices-topics-classifier/1467" 2160 + "/80c34503413cea9ea44cbe94cd38dabc44ea8d70"; 2161 getMddTopicsClassifierManifestFileUrl()2162 default String getMddTopicsClassifierManifestFileUrl() { 2163 return MDD_TOPICS_CLASSIFIER_MANIFEST_FILE_URL; 2164 } 2165 2166 boolean CONSENT_MANAGER_LAZY_ENABLE_MODE = true; 2167 getConsentManagerLazyEnableMode()2168 default boolean getConsentManagerLazyEnableMode() { 2169 return CONSENT_MANAGER_LAZY_ENABLE_MODE; 2170 } 2171 2172 boolean CONSENT_ALREADY_INTERACTED_FIX_ENABLE = true; 2173 getConsentAlreadyInteractedEnableMode()2174 default boolean getConsentAlreadyInteractedEnableMode() { 2175 return CONSENT_ALREADY_INTERACTED_FIX_ENABLE; 2176 } 2177 2178 long CONSENT_NOTIFICATION_INTERVAL_BEGIN_MS = 2179 /* hours */ 9 * /* minutes */ 60 * /* seconds */ 60 * /* milliseconds */ 1000; // 9 AM 2180 getConsentNotificationIntervalBeginMs()2181 default long getConsentNotificationIntervalBeginMs() { 2182 return CONSENT_NOTIFICATION_INTERVAL_BEGIN_MS; 2183 } 2184 2185 long CONSENT_NOTIFICATION_INTERVAL_END_MS = 2186 /* hours */ 17 * /* minutes */ 60 * /* seconds */ 60 * /* milliseconds */ 1000; // 5 PM 2187 getConsentNotificationIntervalEndMs()2188 default long getConsentNotificationIntervalEndMs() { 2189 return CONSENT_NOTIFICATION_INTERVAL_END_MS; 2190 } 2191 2192 long CONSENT_NOTIFICATION_MINIMAL_DELAY_BEFORE_INTERVAL_ENDS = 2193 /* minutes */ 60 * /* seconds */ 60 * /* milliseconds */ 1000; // 1 hour 2194 getConsentNotificationMinimalDelayBeforeIntervalEnds()2195 default long getConsentNotificationMinimalDelayBeforeIntervalEnds() { 2196 return CONSENT_NOTIFICATION_MINIMAL_DELAY_BEFORE_INTERVAL_ENDS; 2197 } 2198 2199 /** Available sources of truth to get consent for PPAPI. */ 2200 @IntDef( 2201 flag = true, 2202 value = { 2203 SYSTEM_SERVER_ONLY, 2204 PPAPI_ONLY, 2205 PPAPI_AND_SYSTEM_SERVER, 2206 APPSEARCH_ONLY, 2207 }) 2208 @Retention(RetentionPolicy.SOURCE) 2209 @interface ConsentSourceOfTruth {} 2210 2211 /** Write and read consent from system server only. */ 2212 int SYSTEM_SERVER_ONLY = FlagsConstants.SYSTEM_SERVER_ONLY; 2213 2214 /** Write and read consent from PPAPI only */ 2215 int PPAPI_ONLY = FlagsConstants.PPAPI_ONLY; 2216 2217 /** Write consent to both PPAPI and system server. Read consent from system server only. */ 2218 int PPAPI_AND_SYSTEM_SERVER = FlagsConstants.PPAPI_AND_SYSTEM_SERVER; 2219 2220 /** 2221 * Write consent data to AppSearch only. To store consent data in AppSearch the flag 2222 * enable_appsearch_consent_data must also be true. This ensures that both writes and reads can 2223 * happen to/from AppSearch. The writes are done by code on S-, while reads are done from code 2224 * running on S- for all consent requests and on T+ once after OTA. 2225 */ 2226 int APPSEARCH_ONLY = FlagsConstants.APPSEARCH_ONLY; 2227 2228 /** 2229 * Consent source of truth intended to be used by default. On S devices, there is no AdServices 2230 * code running in the system server, so the default for those is PPAPI_ONLY. 2231 */ 2232 @ConsentSourceOfTruth 2233 int DEFAULT_CONSENT_SOURCE_OF_TRUTH = 2234 SdkLevel.isAtLeastT() ? PPAPI_AND_SYSTEM_SERVER : APPSEARCH_ONLY; 2235 2236 /** Returns the consent source of truth currently used for PPAPI. */ 2237 @ConsentSourceOfTruth getConsentSourceOfTruth()2238 default int getConsentSourceOfTruth() { 2239 return DEFAULT_CONSENT_SOURCE_OF_TRUTH; 2240 } 2241 2242 /** 2243 * Blocked topics source of truth intended to be used by default. On S- devices, there is no 2244 * AdServices code running in the system server, so the default for those is PPAPI_ONLY. 2245 */ 2246 @ConsentSourceOfTruth 2247 int DEFAULT_BLOCKED_TOPICS_SOURCE_OF_TRUTH = 2248 SdkLevel.isAtLeastT() ? PPAPI_AND_SYSTEM_SERVER : APPSEARCH_ONLY; 2249 2250 /** Returns the blocked topics source of truth currently used for PPAPI */ 2251 @ConsentSourceOfTruth getBlockedTopicsSourceOfTruth()2252 default int getBlockedTopicsSourceOfTruth() { 2253 return DEFAULT_BLOCKED_TOPICS_SOURCE_OF_TRUTH; 2254 } 2255 2256 /** 2257 * The debug and release SHA certificates of the AdServices APK. This is required when writing 2258 * consent data to AppSearch in order to allow reads from T+ APK. This is a comma separated 2259 * list. 2260 */ 2261 String ADSERVICES_APK_SHA_CERTIFICATE = 2262 "686d5c450e00ebe600f979300a29234644eade42f24ede07a073f2bc6b94a3a2," // debug 2263 + "80f8fbb9a026807f58d98dbc28bf70724d8f66bbfcec997c6bdc0102c3230dee"; // release 2264 2265 /** Only App signatures belonging to this Allow List can use PP APIs. */ getAdservicesApkShaCertificate()2266 default String getAdservicesApkShaCertificate() { 2267 return ADSERVICES_APK_SHA_CERTIFICATE; 2268 } 2269 2270 // Group of All Killswitches 2271 2272 /** 2273 * Global PP API Kill Switch. This overrides all other killswitches. The default value is false 2274 * which means the PP API is enabled. This flag is used for emergency turning off the whole PP 2275 * API. 2276 */ 2277 // Starting M-2023-05, global kill switch is enabled in the binary. Prior to this (namely in 2278 // M-2022-11), the value of this flag in the binary was false. 2279 @FeatureFlag(LEGACY_KILL_SWITCH_GLOBAL) 2280 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2281 boolean GLOBAL_KILL_SWITCH = true; 2282 getGlobalKillSwitch()2283 default boolean getGlobalKillSwitch() { 2284 return GLOBAL_KILL_SWITCH; 2285 } 2286 2287 // MEASUREMENT Killswitches 2288 2289 /** 2290 * Measurement Kill Switch. This overrides all specific measurement kill switch. The default 2291 * value is {@code false} which means that Measurement is enabled. 2292 * 2293 * <p>This flag is used for emergency turning off the whole Measurement API. 2294 */ 2295 @FeatureFlag(LEGACY_KILL_SWITCH_RAMPED_UP) 2296 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2297 boolean MEASUREMENT_KILL_SWITCH = false; 2298 2299 /** 2300 * @deprecated - TODO(b/325074749): remove once all methods that call it are unit-tested and 2301 * changed to use !getMeasurementEnabled() 2302 */ 2303 @Deprecated 2304 @VisibleForTesting getLegacyMeasurementKillSwitch()2305 default boolean getLegacyMeasurementKillSwitch() { 2306 return getGlobalKillSwitch() || MEASUREMENT_KILL_SWITCH; 2307 } 2308 2309 /** 2310 * Returns whether the Global Measurement feature is enabled. Measurement will be disabled if 2311 * either the Global Kill Switch or the Measurement Kill Switch value is {@code true}. 2312 */ getMeasurementEnabled()2313 default boolean getMeasurementEnabled() { 2314 return getGlobalKillSwitch() ? false : !MEASUREMENT_KILL_SWITCH; 2315 } 2316 2317 /** 2318 * Measurement API Delete Registrations Kill Switch. The default value is false which means 2319 * Delete Registrations API is enabled. This flag is used for emergency turning off the Delete 2320 * Registrations API. 2321 */ 2322 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2323 boolean MEASUREMENT_API_DELETE_REGISTRATIONS_KILL_SWITCH = false; 2324 2325 /** 2326 * Returns the kill switch value for Measurement API Delete Registrations. The API will be 2327 * disabled if either the Global Kill Switch, Measurement Kill Switch, or the Measurement API 2328 * Delete Registration Kill Switch value is true. 2329 */ getMeasurementApiDeleteRegistrationsKillSwitch()2330 default boolean getMeasurementApiDeleteRegistrationsKillSwitch() { 2331 return getLegacyMeasurementKillSwitch() || MEASUREMENT_API_DELETE_REGISTRATIONS_KILL_SWITCH; 2332 } 2333 2334 /** 2335 * Measurement API Status Kill Switch. The default value is false which means Status API is 2336 * enabled. This flag is used for emergency turning off the Status API. 2337 */ 2338 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2339 boolean MEASUREMENT_API_STATUS_KILL_SWITCH = false; 2340 2341 /** 2342 * Returns the kill switch value for Measurement API Status. The API will be disabled if either 2343 * the Global Kill Switch, Measurement Kill Switch, or the Measurement API Status Kill Switch 2344 * value is true. 2345 */ getMeasurementApiStatusKillSwitch()2346 default boolean getMeasurementApiStatusKillSwitch() { 2347 return getLegacyMeasurementKillSwitch() || MEASUREMENT_API_STATUS_KILL_SWITCH; 2348 } 2349 2350 /** 2351 * Measurement API Register Source Kill Switch. The default value is false which means Register 2352 * Source API is enabled. This flag is used for emergency turning off the Register Source API. 2353 */ 2354 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2355 boolean MEASUREMENT_API_REGISTER_SOURCE_KILL_SWITCH = false; 2356 2357 /** 2358 * Returns the kill switch value for Measurement API Register Source. The API will be disabled 2359 * if either the Global Kill Switch, Measurement Kill Switch, or the Measurement API Register 2360 * Source Kill Switch value is true. 2361 */ getMeasurementApiRegisterSourceKillSwitch()2362 default boolean getMeasurementApiRegisterSourceKillSwitch() { 2363 return getLegacyMeasurementKillSwitch() || MEASUREMENT_API_REGISTER_SOURCE_KILL_SWITCH; 2364 } 2365 2366 /** 2367 * Measurement API Register Trigger Kill Switch. The default value is false which means Register 2368 * Trigger API is enabled. This flag is used for emergency turning off the Register Trigger API. 2369 */ 2370 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2371 boolean MEASUREMENT_API_REGISTER_TRIGGER_KILL_SWITCH = false; 2372 2373 /** 2374 * Returns the kill switch value for Measurement API Register Trigger. The API will be disabled 2375 * if either the Global Kill Switch, Measurement Kill Switch, or the Measurement API Register 2376 * Trigger Kill Switch value is true. 2377 */ getMeasurementApiRegisterTriggerKillSwitch()2378 default boolean getMeasurementApiRegisterTriggerKillSwitch() { 2379 return getLegacyMeasurementKillSwitch() || MEASUREMENT_API_REGISTER_TRIGGER_KILL_SWITCH; 2380 } 2381 2382 /** 2383 * Measurement API Register Web Source Kill Switch. The default value is false which means 2384 * Register Web Source API is enabled. This flag is used for emergency turning off the Register 2385 * Web Source API. 2386 */ 2387 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2388 boolean MEASUREMENT_API_REGISTER_WEB_SOURCE_KILL_SWITCH = false; 2389 2390 /** 2391 * Returns the kill switch value for Measurement API Register Web Source. The API will be 2392 * disabled if either the Global Kill Switch, Measurement Kill Switch, or the Measurement API 2393 * Register Web Source Kill Switch value is true. 2394 */ getMeasurementApiRegisterWebSourceKillSwitch()2395 default boolean getMeasurementApiRegisterWebSourceKillSwitch() { 2396 return getLegacyMeasurementKillSwitch() || MEASUREMENT_API_REGISTER_WEB_SOURCE_KILL_SWITCH; 2397 } 2398 2399 /** 2400 * Measurement API Register Sources Kill Switch. The default value is false which means Register 2401 * Sources API is enabled. This flag is used for emergency turning off the Register Sources API. 2402 */ 2403 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2404 boolean MEASUREMENT_API_REGISTER_SOURCES_KILL_SWITCH = false; 2405 2406 /** 2407 * Returns the kill switch value for Measurement API Register Sources. The API will be disabled 2408 * if either the Global Kill Switch, Measurement Kill Switch, or the Measurement API Register 2409 * Sources Kill Switch value is true. 2410 */ getMeasurementApiRegisterSourcesKillSwitch()2411 default boolean getMeasurementApiRegisterSourcesKillSwitch() { 2412 return getLegacyMeasurementKillSwitch() || MEASUREMENT_API_REGISTER_SOURCES_KILL_SWITCH; 2413 } 2414 2415 /** 2416 * Measurement API Register Web Trigger Kill Switch. The default value is false which means 2417 * Register Web Trigger API is enabled. This flag is used for emergency turning off the Register 2418 * Web Trigger API. 2419 */ 2420 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2421 boolean MEASUREMENT_API_REGISTER_WEB_TRIGGER_KILL_SWITCH = false; 2422 2423 /** 2424 * Returns the kill switch value for Measurement API Register Web Trigger. The API will be 2425 * disabled if either the Global Kill Switch, Measurement Kill Switch, or the Measurement API 2426 * Register Web Trigger Kill Switch value is true. 2427 */ getMeasurementApiRegisterWebTriggerKillSwitch()2428 default boolean getMeasurementApiRegisterWebTriggerKillSwitch() { 2429 return getLegacyMeasurementKillSwitch() || MEASUREMENT_API_REGISTER_WEB_TRIGGER_KILL_SWITCH; 2430 } 2431 2432 /** 2433 * Measurement Job Aggregate Fallback Reporting Kill Switch. The default value is false which 2434 * means Aggregate Fallback Reporting Job is enabled. This flag is used for emergency turning 2435 * off the Aggregate Fallback Reporting Job. 2436 */ 2437 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2438 boolean MEASUREMENT_JOB_AGGREGATE_FALLBACK_REPORTING_KILL_SWITCH = false; 2439 2440 /** 2441 * Returns the kill switch value for Measurement Job Aggregate Fallback Reporting. The API will 2442 * be disabled if either the Global Kill Switch, Measurement Kill Switch, or the Measurement Job 2443 * Aggregate Fallback Reporting Kill Switch value is true. 2444 */ getMeasurementJobAggregateFallbackReportingKillSwitch()2445 default boolean getMeasurementJobAggregateFallbackReportingKillSwitch() { 2446 return getLegacyMeasurementKillSwitch() 2447 || MEASUREMENT_JOB_AGGREGATE_FALLBACK_REPORTING_KILL_SWITCH; 2448 } 2449 2450 /** 2451 * Measurement Job Aggregate Reporting Kill Switch. The default value is false which means 2452 * Aggregate Reporting Job is enabled. This flag is used for emergency turning off the Aggregate 2453 * Reporting Job. 2454 */ 2455 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2456 boolean MEASUREMENT_JOB_AGGREGATE_REPORTING_KILL_SWITCH = false; 2457 2458 /** 2459 * Returns the kill switch value for Measurement Job Aggregate Reporting. The API will be 2460 * disabled if either the Global Kill Switch, Measurement Kill Switch, or the Measurement Job 2461 * Aggregate Reporting Kill Switch value is true. 2462 */ getMeasurementJobAggregateReportingKillSwitch()2463 default boolean getMeasurementJobAggregateReportingKillSwitch() { 2464 return getLegacyMeasurementKillSwitch() || MEASUREMENT_JOB_AGGREGATE_REPORTING_KILL_SWITCH; 2465 } 2466 2467 /** 2468 * Measurement Immediate Aggregate Reporting Job Kill Switch. The default value is true which 2469 * means Immediate Aggregate Reporting Job is disabled. This flag is used for emergency turning 2470 * off of the Immediate Aggregate Reporting Job. 2471 */ 2472 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2473 boolean MEASUREMENT_JOB_IMMEDIATE_AGGREGATE_REPORTING_KILL_SWITCH = true; 2474 2475 /** 2476 * Returns the kill switch value for Measurement Immediate Aggregate Reporting Job. The API will 2477 * be disabled if either the Global Kill Switch, Measurement Kill Switch, or the Measurement Job 2478 * Immediate Aggregate Reporting Kill Switch value is true. 2479 */ getMeasurementJobImmediateAggregateReportingKillSwitch()2480 default boolean getMeasurementJobImmediateAggregateReportingKillSwitch() { 2481 return !getMeasurementEnabled() 2482 || MEASUREMENT_JOB_IMMEDIATE_AGGREGATE_REPORTING_KILL_SWITCH; 2483 } 2484 2485 /** 2486 * Measurement Job Attribution Kill Switch. The default value is false which means Attribution 2487 * Job is enabled. This flag is used for emergency turning off the Attribution Job. 2488 */ 2489 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2490 boolean MEASUREMENT_JOB_ATTRIBUTION_KILL_SWITCH = false; 2491 2492 /** 2493 * Returns the kill switch value for Measurement Job Attribution. The API will be disabled if 2494 * either the Global Kill Switch, Measurement Kill Switch, or the Measurement Job Attribution 2495 * Kill Switch value is true. 2496 */ getMeasurementJobAttributionKillSwitch()2497 default boolean getMeasurementJobAttributionKillSwitch() { 2498 return getLegacyMeasurementKillSwitch() || MEASUREMENT_JOB_ATTRIBUTION_KILL_SWITCH; 2499 } 2500 2501 /** 2502 * Measurement Job Delete Expired Kill Switch. The default value is false which means Delete 2503 * Expired Job is enabled. This flag is used for emergency turning off the Delete Expired Job. 2504 */ 2505 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2506 boolean MEASUREMENT_JOB_DELETE_EXPIRED_KILL_SWITCH = false; 2507 2508 /** 2509 * Returns the kill switch value for Measurement Job Delete Expired. The API will be disabled if 2510 * either the Global Kill Switch, Measurement Kill Switch, or the Measurement Job Delete Expired 2511 * Kill Switch value is true. 2512 */ getMeasurementJobDeleteExpiredKillSwitch()2513 default boolean getMeasurementJobDeleteExpiredKillSwitch() { 2514 return getLegacyMeasurementKillSwitch() || MEASUREMENT_JOB_DELETE_EXPIRED_KILL_SWITCH; 2515 } 2516 2517 /** 2518 * Measurement Job Delete Uninstalled Kill Switch. The default value is false which means Delete 2519 * Uninstalled Job is enabled. This flag is used for emergency turning off the Delete 2520 * Uninstalled Job. 2521 */ 2522 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2523 boolean MEASUREMENT_JOB_DELETE_UNINSTALLED_KILL_SWITCH = false; 2524 2525 /** 2526 * Returns the kill switch value for Measurement Job Delete Uninstalled. The API will be 2527 * disabled if either the Global Kill Switch, Measurement Kill Switch, or the Measurement Job 2528 * Delete Uninstalled Kill Switch value is true. 2529 */ getMeasurementJobDeleteUninstalledKillSwitch()2530 default boolean getMeasurementJobDeleteUninstalledKillSwitch() { 2531 return getLegacyMeasurementKillSwitch() || MEASUREMENT_JOB_DELETE_UNINSTALLED_KILL_SWITCH; 2532 } 2533 2534 /** 2535 * Measurement Job Event Fallback Reporting Kill Switch. The default value is false which means 2536 * Event Fallback Reporting Job is enabled. This flag is used for emergency turning off the 2537 * Event Fallback Reporting Job. 2538 */ 2539 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2540 boolean MEASUREMENT_JOB_EVENT_FALLBACK_REPORTING_KILL_SWITCH = false; 2541 2542 /** 2543 * Returns the kill switch value for Measurement Job Event Fallback Reporting. The API will be 2544 * disabled if either the Global Kill Switch, Measurement Kill Switch, or the Measurement Job 2545 * Event Fallback Reporting Kill Switch value is true. 2546 */ getMeasurementJobEventFallbackReportingKillSwitch()2547 default boolean getMeasurementJobEventFallbackReportingKillSwitch() { 2548 return getLegacyMeasurementKillSwitch() 2549 || MEASUREMENT_JOB_EVENT_FALLBACK_REPORTING_KILL_SWITCH; 2550 } 2551 2552 /** 2553 * Measurement Job Event Reporting Kill Switch. The default value is false which means Event 2554 * Reporting Job is enabled. This flag is used for emergency turning off the Event Reporting 2555 * Job. 2556 */ 2557 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2558 boolean MEASUREMENT_JOB_EVENT_REPORTING_KILL_SWITCH = false; 2559 2560 /** 2561 * Returns the kill switch value for Measurement Job Event Reporting. The API will be disabled 2562 * if either the Global Kill Switch, Measurement Kill Switch, or the Measurement Job Event 2563 * Reporting Kill Switch value is true. 2564 */ getMeasurementJobEventReportingKillSwitch()2565 default boolean getMeasurementJobEventReportingKillSwitch() { 2566 return getLegacyMeasurementKillSwitch() || MEASUREMENT_JOB_EVENT_REPORTING_KILL_SWITCH; 2567 } 2568 2569 /** 2570 * Measurement Job Debug Reporting Kill Switch. The default value is false which means Debug 2571 * Reporting Job is enabled. This flag is used for emergency turning off the Debug Reporting 2572 * Job. 2573 */ 2574 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2575 boolean MEASUREMENT_JOB_DEBUG_REPORTING_KILL_SWITCH = false; 2576 2577 /** 2578 * Returns the kill switch value for Measurement Job Debug Reporting. The Job will be disabled 2579 * if either the Global Kill Switch, Measurement Kill Switch, or the Measurement Job Debug 2580 * Reporting Kill Switch value is true. 2581 */ getMeasurementJobDebugReportingKillSwitch()2582 default boolean getMeasurementJobDebugReportingKillSwitch() { 2583 return getLegacyMeasurementKillSwitch() || MEASUREMENT_JOB_DEBUG_REPORTING_KILL_SWITCH; 2584 } 2585 2586 /** 2587 * Measurement Debug Reporting Fallback Job kill Switch. The default value is false which means 2588 * the job is enabled. This flag is used for emergency turning off the Debug Reporting Fallback 2589 * Job. 2590 */ 2591 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2592 boolean MEASUREMENT_DEBUG_REPORTING_FALLBACK_JOB_KILL_SWITCH = false; 2593 2594 /** 2595 * Returns the kill switch value for the Measurement Debug Reporting Fallback Job. The API will 2596 * be disabled if either the Global Kill Switch, Measurement Kill Switch, or the Measurement 2597 * Debug Reporting Fallback Job kill switch value is true. 2598 */ getMeasurementDebugReportingFallbackJobKillSwitch()2599 default boolean getMeasurementDebugReportingFallbackJobKillSwitch() { 2600 return getLegacyMeasurementKillSwitch() 2601 || MEASUREMENT_DEBUG_REPORTING_FALLBACK_JOB_KILL_SWITCH; 2602 } 2603 2604 /** 2605 * Measurement Verbose Debug Reporting Fallback Job kill Switch. The default value is false 2606 * which means the job is enabled. This flag is used for emergency turning off the Verbose Debug 2607 * Reporting Fallback Job. 2608 */ 2609 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2610 boolean MEASUREMENT_VERBOSE_DEBUG_REPORTING_FALLBACK_JOB_KILL_SWITCH = false; 2611 2612 /** 2613 * Returns the kill switch value for the Measurement Debug Reporting Fallback Job. The API will 2614 * be disabled if either the Global Kill Switch, Measurement Kill Switch, or the Measurement 2615 * Debug Reporting Fallback Job kill switch value is true. 2616 */ getMeasurementVerboseDebugReportingFallbackJobKillSwitch()2617 default boolean getMeasurementVerboseDebugReportingFallbackJobKillSwitch() { 2618 return getLegacyMeasurementKillSwitch() 2619 || MEASUREMENT_VERBOSE_DEBUG_REPORTING_FALLBACK_JOB_KILL_SWITCH; 2620 } 2621 2622 /** 2623 * Returns the job period in millis for the Measurement Verbose Debug Reporting Fallback Job. 2624 */ 2625 long MEASUREMENT_VERBOSE_DEBUG_REPORTING_FALLBACK_JOB_PERIOD_MS = TimeUnit.HOURS.toMillis(1); 2626 2627 /** 2628 * Returns the job period in millis for the Measurement Verbose Debug Reporting Fallback Job. 2629 */ getMeasurementVerboseDebugReportingFallbackJobPeriodMs()2630 default long getMeasurementVerboseDebugReportingFallbackJobPeriodMs() { 2631 return MEASUREMENT_VERBOSE_DEBUG_REPORTING_FALLBACK_JOB_PERIOD_MS; 2632 } 2633 2634 /** Returns the job period in millis for the Measurement Debug Reporting Fallback Job. */ 2635 long MEASUREMENT_DEBUG_REPORTING_FALLBACK_JOB_PERIOD_MS = TimeUnit.HOURS.toMillis(1); 2636 2637 /** Returns the job period in millis for the Measurement Debug Reporting Fallback Job. */ getMeasurementDebugReportingFallbackJobPeriodMs()2638 default long getMeasurementDebugReportingFallbackJobPeriodMs() { 2639 return MEASUREMENT_DEBUG_REPORTING_FALLBACK_JOB_PERIOD_MS; 2640 } 2641 2642 /* 2643 * Measurement Job Verbose Debug Reporting Kill Switch. The default value is false which means 2644 * the Verbose Debug Reporting Job is enabled. This flag is used for emergency turning off the 2645 * Verbose Debug Reporting Job. 2646 */ 2647 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2648 boolean MEASUREMENT_JOB_VERBOSE_DEBUG_REPORTING_KILL_SWITCH = false; 2649 2650 /** 2651 * Returns the kill switch value for Measurement Job Verbose Debug Reporting. The Job will be 2652 * disabled if either the Global Kill Switch, Measurement Kill Switch, or the Measurement Job 2653 * Verbose Debug Reporting Kill Switch value is true. 2654 */ getMeasurementJobVerboseDebugReportingKillSwitch()2655 default boolean getMeasurementJobVerboseDebugReportingKillSwitch() { 2656 return getLegacyMeasurementKillSwitch() 2657 || MEASUREMENT_JOB_VERBOSE_DEBUG_REPORTING_KILL_SWITCH; 2658 } 2659 2660 /** 2661 * Measurement Broadcast Receiver Install Attribution Kill Switch. The default value is false 2662 * which means Install Attribution is enabled. This flag is used for emergency turning off 2663 * Install Attribution Broadcast Receiver. 2664 */ 2665 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2666 boolean MEASUREMENT_RECEIVER_INSTALL_ATTRIBUTION_KILL_SWITCH = false; 2667 2668 /** 2669 * Returns the kill switch value for Measurement Broadcast Receiver Install Attribution. The 2670 * Broadcast Receiver will be disabled if either the Global Kill Switch, Measurement Kill Switch 2671 * or the Measurement Kill Switch value is true. 2672 */ getMeasurementReceiverInstallAttributionKillSwitch()2673 default boolean getMeasurementReceiverInstallAttributionKillSwitch() { 2674 return getLegacyMeasurementKillSwitch() 2675 || MEASUREMENT_RECEIVER_INSTALL_ATTRIBUTION_KILL_SWITCH; 2676 } 2677 2678 /** 2679 * Measurement Broadcast Receiver Delete Packages Kill Switch. The default value is false which 2680 * means Delete Packages is enabled. This flag is used for emergency turning off Delete Packages 2681 * Broadcast Receiver. 2682 */ 2683 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2684 boolean MEASUREMENT_RECEIVER_DELETE_PACKAGES_KILL_SWITCH = false; 2685 2686 /** 2687 * Returns the kill switch value for Measurement Broadcast Receiver Delete Packages. The 2688 * Broadcast Receiver will be disabled if either the Global Kill Switch, Measurement Kill Switch 2689 * or the Measurement Kill Switch value is true. 2690 */ getMeasurementReceiverDeletePackagesKillSwitch()2691 default boolean getMeasurementReceiverDeletePackagesKillSwitch() { 2692 return getLegacyMeasurementKillSwitch() || MEASUREMENT_RECEIVER_DELETE_PACKAGES_KILL_SWITCH; 2693 } 2694 2695 /** 2696 * Measurement Rollback Kill Switch. The default value is false which means the rollback 2697 * handling on measurement service start is enabled. This flag is used for emergency turning off 2698 * measurement rollback data deletion handling. 2699 */ 2700 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2701 boolean MEASUREMENT_ROLLBACK_DELETION_KILL_SWITCH = false; 2702 2703 /** 2704 * Returns the kill switch value for Measurement rollback deletion handling. The rollback 2705 * deletion handling will be disabled if the Global Kill Switch, Measurement Kill Switch or the 2706 * Measurement rollback deletion Kill Switch value is true. 2707 */ getMeasurementRollbackDeletionKillSwitch()2708 default boolean getMeasurementRollbackDeletionKillSwitch() { 2709 return getLegacyMeasurementKillSwitch() || MEASUREMENT_ROLLBACK_DELETION_KILL_SWITCH; 2710 } 2711 2712 /** 2713 * Kill Switch for storing Measurement Rollback data in App Search for Android S. The default 2714 * value is false which means storing the rollback handling data in App Search is enabled. This 2715 * flag is used for emergency turning off measurement rollback data deletion handling on Android 2716 * S. 2717 */ 2718 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2719 boolean MEASUREMENT_ROLLBACK_DELETION_APP_SEARCH_KILL_SWITCH = false; 2720 2721 /** 2722 * Returns the kill switch value for storing Measurement rollback deletion handling data in App 2723 * Search. The rollback deletion handling on Android S will be disabled if this kill switch 2724 * value is true. 2725 */ getMeasurementRollbackDeletionAppSearchKillSwitch()2726 default boolean getMeasurementRollbackDeletionAppSearchKillSwitch() { 2727 return MEASUREMENT_ROLLBACK_DELETION_APP_SEARCH_KILL_SWITCH; 2728 } 2729 2730 // ADID Killswitch. 2731 /** 2732 * AdId API Kill Switch. The default value is false which means the AdId API is enabled. This 2733 * flag is used for emergency turning off the AdId API. 2734 */ 2735 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2736 boolean ADID_KILL_SWITCH = false; // By default, the AdId API is enabled. 2737 2738 /** Gets the state of adId kill switch. */ getAdIdKillSwitch()2739 default boolean getAdIdKillSwitch() { 2740 return ADID_KILL_SWITCH; 2741 } 2742 2743 // APPSETID Killswitch. 2744 /** 2745 * AppSetId API Kill Switch. The default value is false which means the AppSetId API is enabled. 2746 * This flag is used for emergency turning off the AppSetId API. 2747 */ 2748 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2749 boolean APPSETID_KILL_SWITCH = false; // By default, the AppSetId API is enabled. 2750 2751 /** Gets the state of the global and appSetId kill switch. */ getAppSetIdKillSwitch()2752 default boolean getAppSetIdKillSwitch() { 2753 return APPSETID_KILL_SWITCH; 2754 } 2755 2756 // TOPICS Killswitches 2757 2758 /** 2759 * Topics API Kill Switch. The default value is {@code true} which means the Topics API is 2760 * disabled. 2761 * 2762 * <p>This flag is used for emergency turning off the Topics API. 2763 */ 2764 @FeatureFlag(LEGACY_KILL_SWITCH) 2765 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2766 boolean TOPICS_KILL_SWITCH = true; 2767 2768 /** Returns value of Topics API kill switch */ getTopicsKillSwitch()2769 default boolean getTopicsKillSwitch() { 2770 return getGlobalKillSwitch() || TOPICS_KILL_SWITCH; 2771 } 2772 2773 /** 2774 * Topics on-device classifier Kill Switch. The default value is false which means the on-device 2775 * classifier in enabled. This flag is used for emergency turning off the on-device classifier. 2776 */ 2777 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2778 boolean TOPICS_ON_DEVICE_CLASSIFIER_KILL_SWITCH = false; 2779 2780 /** Returns value of Topics on-device classifier kill switch. */ getTopicsOnDeviceClassifierKillSwitch()2781 default boolean getTopicsOnDeviceClassifierKillSwitch() { 2782 return TOPICS_ON_DEVICE_CLASSIFIER_KILL_SWITCH; 2783 } 2784 2785 // MDD Killswitches 2786 2787 /** 2788 * MDD Background Task Kill Switch. The default value is false which means the MDD background 2789 * task is enabled. This flag is used for emergency turning off the MDD background tasks. 2790 */ 2791 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2792 boolean MDD_BACKGROUND_TASK_KILL_SWITCH = false; 2793 2794 /** Returns value of Mdd Background Task kill switch */ getMddBackgroundTaskKillSwitch()2795 default boolean getMddBackgroundTaskKillSwitch() { 2796 return getGlobalKillSwitch() || MDD_BACKGROUND_TASK_KILL_SWITCH; 2797 } 2798 2799 /** 2800 * MDD Logger Kill Switch. The default value is false which means the MDD Logger is enabled. 2801 * This flag is used for emergency turning off the MDD Logger. 2802 */ 2803 @FeatureFlag(LEGACY_KILL_SWITCH_RAMPED_UP) 2804 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2805 boolean MDD_LOGGER_KILL_SWITCH = false; 2806 2807 /** 2808 * Returns whether the MDD Logger feature is enabled. 2809 * 2810 * <p>MDD Logger will be disabled if either the {@link #getGlobalKillSwitch() Global Kill 2811 * Switch} or the {@link #MDD_LOGGER_KILL_SWITCH} value is {@code true}. 2812 */ getMddLoggerEnabled()2813 default boolean getMddLoggerEnabled() { 2814 return getGlobalKillSwitch() ? false : !MDD_LOGGER_KILL_SWITCH; 2815 } 2816 2817 // FLEDGE Kill switches 2818 2819 /** 2820 * Fledge AdSelectionService kill switch. The default value is false which means that 2821 * AdSelectionService is enabled by default. This flag should be should as emergency andon cord. 2822 */ 2823 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2824 boolean FLEDGE_SELECT_ADS_KILL_SWITCH = false; 2825 2826 /** Returns value of Fledge Ad Selection Service API kill switch . */ getFledgeSelectAdsKillSwitch()2827 default boolean getFledgeSelectAdsKillSwitch() { 2828 // Check for global kill switch first, as it should override all other kill switches 2829 return getGlobalKillSwitch() || FLEDGE_SELECT_ADS_KILL_SWITCH; 2830 } 2831 2832 /** 2833 * Fledge Auction Server API Kill switch. The default value is true which means that Auction 2834 * server APIs is disabled by default. 2835 */ 2836 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2837 boolean FLEDGE_AUCTION_SERVER_KILL_SWITCH = true; 2838 2839 /** Returns value of Fledge Auction server API kill switch. */ getFledgeAuctionServerKillSwitch()2840 default boolean getFledgeAuctionServerKillSwitch() { 2841 return getFledgeSelectAdsKillSwitch() || FLEDGE_AUCTION_SERVER_KILL_SWITCH; 2842 } 2843 2844 /** 2845 * Fledge On Device Auction API Kill switch. The default value is false which means that On 2846 * Device Auction APIs is enabled by default. 2847 */ 2848 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2849 boolean FLEDGE_ON_DEVICE_AUCTION_KILL_SWITCH = false; 2850 2851 /** Returns value of On Device Auction API kill switch. */ getFledgeOnDeviceAuctionKillSwitch()2852 default boolean getFledgeOnDeviceAuctionKillSwitch() { 2853 return getFledgeSelectAdsKillSwitch() || FLEDGE_ON_DEVICE_AUCTION_KILL_SWITCH; 2854 } 2855 2856 /** 2857 * Fledge Join Custom Audience API kill switch. The default value is false which means that Join 2858 * Custom Audience API is enabled by default. This flag should be should as emergency andon 2859 * cord. 2860 */ 2861 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2862 boolean FLEDGE_CUSTOM_AUDIENCE_SERVICE_KILL_SWITCH = false; 2863 2864 /** Returns value of Fledge Join Custom Audience API kill switch */ getFledgeCustomAudienceServiceKillSwitch()2865 default boolean getFledgeCustomAudienceServiceKillSwitch() { 2866 // Check for global kill switch first, as it should override all other kill switches 2867 return getGlobalKillSwitch() || FLEDGE_CUSTOM_AUDIENCE_SERVICE_KILL_SWITCH; 2868 } 2869 2870 /** 2871 * Protected signals API feature flag. The default value is {@code false}, which means that 2872 * protected signals is disabled by default. 2873 */ 2874 @FeatureFlag boolean PROTECTED_SIGNALS_ENABLED = false; 2875 2876 /** Returns value of the protected signals feature flag. */ getProtectedSignalsEnabled()2877 default boolean getProtectedSignalsEnabled() { 2878 // Check for global kill switch first, as it should override all other kill switches 2879 return getGlobalKillSwitch() ? false : PROTECTED_SIGNALS_ENABLED; 2880 } 2881 2882 // Encryption key Kill switches 2883 2884 /** 2885 * Encryption key new enrollment fetch kill switch. The default value is false which means 2886 * fetching encryption keys for new enrollments is enabled by default. This flag is used for 2887 * emergency turning off fetching encryption keys for new enrollments. 2888 * 2889 * <p>Set true to disable the function since no adtech actually provide encryption endpoint now. 2890 */ 2891 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2892 boolean ENCRYPTION_KEY_NEW_ENROLLMENT_FETCH_KILL_SWITCH = true; 2893 2894 /** Returns value of encryption key new enrollment fetch job kill switch */ getEncryptionKeyNewEnrollmentFetchKillSwitch()2895 default boolean getEncryptionKeyNewEnrollmentFetchKillSwitch() { 2896 return getGlobalKillSwitch() || ENCRYPTION_KEY_NEW_ENROLLMENT_FETCH_KILL_SWITCH; 2897 } 2898 2899 /** 2900 * Encryption key periodic fetch job kill switch. The default value is false which means 2901 * periodically fetching encryption keys is enabled by default. This flag is used for emergency 2902 * turning off periodically fetching encryption keys. 2903 * 2904 * <p>Set true to disable the function since no adtech actually provide encryption endpoint now. 2905 */ 2906 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 2907 boolean ENCRYPTION_KEY_PERIODIC_FETCH_KILL_SWITCH = true; 2908 2909 /** Returns value of encryption key new enrollment fetch job kill switch */ getEncryptionKeyPeriodicFetchKillSwitch()2910 default boolean getEncryptionKeyPeriodicFetchKillSwitch() { 2911 return getGlobalKillSwitch() || ENCRYPTION_KEY_PERIODIC_FETCH_KILL_SWITCH; 2912 } 2913 2914 int ENCRYPTION_KEY_JOB_REQUIRED_NETWORK_TYPE = JobInfo.NETWORK_TYPE_UNMETERED; 2915 2916 /** Returns the required network type (Wifi) for encryption key fetch job. */ getEncryptionKeyJobRequiredNetworkType()2917 default int getEncryptionKeyJobRequiredNetworkType() { 2918 return ENCRYPTION_KEY_JOB_REQUIRED_NETWORK_TYPE; 2919 } 2920 2921 /* The default time period (in millisecond) between each encryption key job to run. */ 2922 long ENCRYPTION_KEY_JOB_PERIOD_MS = 24 * 60 * 60 * 1000L; // 24 hours. 2923 2924 /** Returns min time period (in millis) between each event fallback reporting job run. */ getEncryptionKeyJobPeriodMs()2925 default long getEncryptionKeyJobPeriodMs() { 2926 return ENCRYPTION_KEY_JOB_PERIOD_MS; 2927 } 2928 2929 /** Feature flag to ramp up mdd based encryption keys. */ 2930 boolean ENABLE_MDD_ENCRYPTION_KEYS = false; 2931 2932 /** Returns value of the feature flag used to determine ramp for mdd based encryption keys. */ getEnableMddEncryptionKeys()2933 default boolean getEnableMddEncryptionKeys() { 2934 return ENABLE_MDD_ENCRYPTION_KEYS; 2935 } 2936 2937 /** Manifest URL for encryption keys file group registered with MDD. */ 2938 String MDD_ENCRYPTION_KEYS_MANIFEST_FILE_URL = 2939 "https://www.gstatic.com/mdi-serving/rubidium-adservices-encryption-keys/4543" 2940 + "/e9d118728752e6a6bfb5d7d8d1520807591f0717"; 2941 2942 /** Returns manifest URL for encryption keys file group registered with MDD. */ getMddEncryptionKeysManifestFileUrl()2943 default String getMddEncryptionKeysManifestFileUrl() { 2944 return MDD_ENCRYPTION_KEYS_MANIFEST_FILE_URL; 2945 } 2946 2947 /** 2948 * Enable Back Compat feature flag. The default value is false which means that all back compat 2949 * related features are disabled by default. This flag would be enabled for R/S during rollout. 2950 */ 2951 @FeatureFlag boolean ENABLE_BACK_COMPAT = false; 2952 2953 /** Returns value of enable Back Compat */ getEnableBackCompat()2954 default boolean getEnableBackCompat() { 2955 return ENABLE_BACK_COMPAT; 2956 } 2957 2958 /** 2959 * Enable Back Compat feature init flag. When enabled, the back compat feature is initialized 2960 * (if it hasn't been initialized already) within the enableAdServices system API. 2961 */ 2962 @FeatureFlag boolean DEFAULT_ENABLE_BACK_COMPAT_INIT = false; 2963 2964 /** Returns value of enable Back Compat */ getEnableBackCompatInit()2965 default boolean getEnableBackCompatInit() { 2966 return DEFAULT_ENABLE_BACK_COMPAT_INIT; 2967 } 2968 2969 /** 2970 * Enable AppSearch read for consent data feature flag. The default value is false which means 2971 * AppSearch is not considered as source of truth after OTA. This flag should be enabled for OTA 2972 * support of consent data on T+ devices. 2973 */ 2974 boolean ENABLE_APPSEARCH_CONSENT_DATA = SdkLevel.isAtLeastS() && !SdkLevel.isAtLeastT(); 2975 2976 /** Returns value of enable appsearch consent data flag */ getEnableAppsearchConsentData()2977 default boolean getEnableAppsearchConsentData() { 2978 return ENABLE_APPSEARCH_CONSENT_DATA; 2979 } 2980 2981 /** Default U18 AppSearch migration feature flag. */ 2982 boolean DEFAULT_ENABLE_U18_APPSEARCH_MIGRATION = false; 2983 2984 /** Returns value of enable U18 appsearch migration flag */ getEnableU18AppsearchMigration()2985 default boolean getEnableU18AppsearchMigration() { 2986 return DEFAULT_ENABLE_U18_APPSEARCH_MIGRATION; 2987 } 2988 2989 /* 2990 * The allow-list for PP APIs. This list has the list of app package names that we allow 2991 * using PP APIs. 2992 * App Package Name that does not belong to this allow-list will not be able to use PP APIs. 2993 * If this list has special value "*", then all package names are allowed. 2994 * There must be not any empty space between comma. 2995 */ 2996 String PPAPI_APP_ALLOW_LIST = 2997 "android.platform.test.scenario," 2998 + "android.adservices.crystalball," 2999 + "com.android.sdksandboxclient," 3000 + "com.example.adservices.samples.adid.app," 3001 + "com.example.adservices.samples.appsetid.app," 3002 + "com.example.adservices.samples.fledge.sampleapp," 3003 + "com.example.adservices.samples.fledge.sampleapp1," 3004 + "com.example.adservices.samples.fledge.sampleapp2," 3005 + "com.example.adservices.samples.fledge.sampleapp3," 3006 + "com.example.adservices.samples.fledge.sampleapp4," 3007 + "com.example.adservices.samples.signals.sampleapp," 3008 + "com.example.measurement.sampleapp," 3009 + "com.example.measurement.sampleapp2"; 3010 3011 /** 3012 * Returns bypass List for PPAPI app signature check. Apps with package name on this list will 3013 * bypass the signature check 3014 */ getPpapiAppAllowList()3015 default String getPpapiAppAllowList() { 3016 return PPAPI_APP_ALLOW_LIST; 3017 } 3018 getPasAppAllowList()3019 default String getPasAppAllowList() { 3020 // default to using the same fixed list as custom audiences 3021 return PPAPI_APP_ALLOW_LIST; 3022 } 3023 3024 String AD_ID_API_APP_BLOCK_LIST = ""; 3025 3026 /** Get the app allow list for the AD ID API. */ getAdIdApiAppBlockList()3027 default String getAdIdApiAppBlockList() { 3028 return AD_ID_API_APP_BLOCK_LIST; 3029 } 3030 3031 /* 3032 * The allow-list for Measurement APIs. This list has the list of app package names that we 3033 * allow using Measurement APIs. Overridden by Block List 3034 */ 3035 String MSMT_API_APP_ALLOW_LIST = 3036 "android.platform.test.scenario," 3037 + "android.adservices.crystalball," 3038 + "com.android.sdksandboxclient," 3039 + "com.example.adservices.samples.adid.app," 3040 + "com.example.adservices.samples.appsetid.app," 3041 + "com.example.adservices.samples.fledge.sampleapp," 3042 + "com.example.adservices.samples.fledge.sampleapp1," 3043 + "com.example.adservices.samples.fledge.sampleapp2," 3044 + "com.example.adservices.samples.fledge.sampleapp3," 3045 + "com.example.adservices.samples.fledge.sampleapp4," 3046 + "com.example.measurement.sampleapp," 3047 + "com.example.measurement.sampleapp2"; 3048 3049 /* 3050 * App Package Name that does not belong to this allow-list will not be able to use Measurement 3051 * APIs. 3052 * If this list has special value "*", then all package names are allowed. 3053 * Block List takes precedence over Allow List. 3054 * There must be not any empty space between comma. 3055 */ getMsmtApiAppAllowList()3056 default String getMsmtApiAppAllowList() { 3057 return MSMT_API_APP_ALLOW_LIST; 3058 } 3059 3060 /* 3061 * The blocklist for Measurement APIs. This list has the list of app package names that we 3062 * do not allow to use Measurement APIs. 3063 */ 3064 String MSMT_API_APP_BLOCK_LIST = ""; 3065 3066 /* 3067 * App Package Name that belong to this blocklist will not be able to use Measurement 3068 * APIs. 3069 * If this list has special value "*", then all package names are blocked. 3070 * Block List takes precedence over Allow List. 3071 * There must be not any empty space between comma. 3072 */ getMsmtApiAppBlockList()3073 default String getMsmtApiAppBlockList() { 3074 return MSMT_API_APP_BLOCK_LIST; 3075 } 3076 3077 /* 3078 * The allow-list for PP APIs. This list has the list of app signatures that we allow 3079 * using PP APIs. App Package signatures that do not belong to this allow-list will not be 3080 * able to use PP APIs, unless the package name of this app is in the bypass list. 3081 * 3082 * If this list has special value "*", then all package signatures are allowed. 3083 * 3084 * There must be not any empty space between comma. 3085 */ 3086 String PPAPI_APP_SIGNATURE_ALLOW_LIST = 3087 // com.android.adservices.tests.cts.endtoendtest 3088 "6cecc50e34ae31bfb5678986d6d6d3736c571ded2f2459527793e1f054eb0c9b," 3089 // com.android.tests.sandbox.topics 3090 + "a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc," 3091 // Topics Sample Apps 3092 // For example, com.example.adservices.samples.topics.sampleapp1 3093 + "301aa3cb081134501c45f1422abc66c24224fd5ded5fdc8f17e697176fd866aa," 3094 // com.android.adservices.tests.cts.topics.testapp1 3095 // android.platform.test.scenario.adservices.GetTopicsApiCall 3096 // Both have [certificate: "platform"] in .bp file 3097 + "c8a2e9bccf597c2fb6dc66bee293fc13f2fc47ec77bc6b2b0d52c11f51192ab8"; 3098 3099 /** Only App signatures belonging to this Allow List can use PP APIs. */ getPpapiAppSignatureAllowList()3100 default String getPpapiAppSignatureAllowList() { 3101 return PPAPI_APP_SIGNATURE_ALLOW_LIST; 3102 } 3103 3104 /** 3105 * The allow list for AppSearch writers. If non-empty, only results written by a package on the 3106 * allow list will be read for consent migration. 3107 */ 3108 String APPSEARCH_WRITER_ALLOW_LIST_OVERRIDE = ""; 3109 3110 /** Only data written by packages in the allow list will be read from AppSearch. */ getAppsearchWriterAllowListOverride()3111 default String getAppsearchWriterAllowListOverride() { 3112 return APPSEARCH_WRITER_ALLOW_LIST_OVERRIDE; 3113 } 3114 3115 /** 3116 * The client app packages that are allowed to invoke web context APIs, i.e. {@link 3117 * android.adservices.measurement.MeasurementManager#registerWebSource} and {@link 3118 * android.adservices.measurement.MeasurementManager#deleteRegistrations}. App packages that do 3119 * not belong to the list will be responded back with an error response. 3120 */ 3121 String WEB_CONTEXT_CLIENT_ALLOW_LIST = ""; 3122 3123 // Rate Limit Flags. 3124 3125 /** 3126 * PP API Rate Limit for each SDK. This is the max allowed QPS for one SDK to one PP API. 3127 * Negative Value means skipping the rate limiting checking. 3128 */ 3129 float SDK_REQUEST_PERMITS_PER_SECOND = 1; // allow max 1 request to any PP API per second. 3130 3131 /** 3132 * PP API Rate Limit for ad id. This is the max allowed QPS for one API client to one PP API. 3133 * Negative Value means skipping the rate limiting checking. 3134 */ 3135 float ADID_REQUEST_PERMITS_PER_SECOND = FlagsConstants.ADID_REQUEST_PERMITS_PER_SECOND; 3136 3137 /** 3138 * PP API Rate Limit for app set id. This is the max allowed QPS for one API client to one PP 3139 * API. Negative Value means skipping the rate limiting checking. 3140 */ 3141 float APPSETID_REQUEST_PERMITS_PER_SECOND = 5; 3142 3143 /** 3144 * PP API Rate Limit for measurement register source. This is the max allowed QPS for one API 3145 * client to one PP API. Negative Value means skipping the rate limiting checking. 3146 */ 3147 float MEASUREMENT_REGISTER_SOURCE_REQUEST_PERMITS_PER_SECOND = 25; 3148 3149 /** 3150 * PP API Rate Limit for measurement register web source. This is the max allowed QPS for one 3151 * API client to one PP API. Negative Value means skipping the rate limiting checking. 3152 */ 3153 float MEASUREMENT_REGISTER_WEB_SOURCE_REQUEST_PERMITS_PER_SECOND = 25; 3154 3155 /** 3156 * PP API Rate Limit for measurement register sources. This is the max allowed QPS for one API 3157 * client to one PP API. Negative Value means skipping the rate limiting checking. 3158 */ 3159 float MEASUREMENT_REGISTER_SOURCES_REQUEST_PERMITS_PER_SECOND = 25; 3160 3161 /** 3162 * PP API Rate Limit for measurement register trigger. This is the max allowed QPS for one API 3163 * client to one PP API. Negative Value means skipping the rate limiting checking. 3164 */ 3165 float MEASUREMENT_REGISTER_TRIGGER_REQUEST_PERMITS_PER_SECOND = 25; 3166 3167 /** 3168 * PP API Rate Limit for measurement register web trigger. This is the max allowed QPS for one 3169 * API client to one PP API. Negative Value means skipping the rate limiting checking. 3170 */ 3171 float MEASUREMENT_REGISTER_WEB_TRIGGER_REQUEST_PERMITS_PER_SECOND = 25; 3172 3173 /** 3174 * PP API Rate Limit for Topics API based on App Package name. This is the max allowed QPS for 3175 * one API client to one PP API. Negative Value means skipping the rate limiting checking. 3176 */ 3177 float TOPICS_API_APP_REQUEST_PERMITS_PER_SECOND = 1; 3178 3179 /** 3180 * PP API Rate Limit for Topics API based on Sdk Name. This is the max allowed QPS for one API 3181 * client to one PP API. Negative Value means skipping the rate limiting checking. 3182 */ 3183 float TOPICS_API_SDK_REQUEST_PERMITS_PER_SECOND = 1; 3184 3185 /* 3186 * PP API Rate Limits for Protected Audience/Protected Signals APIs. These are the max allowed 3187 * QPS for an app to call a single API. A negative value means skipping the rate limiting 3188 * check. 3189 */ 3190 3191 @ConfigFlag float FLEDGE_JOIN_CUSTOM_AUDIENCE_REQUEST_PERMITS_PER_SECOND = 1; 3192 @ConfigFlag float FLEDGE_FETCH_AND_JOIN_CUSTOM_AUDIENCE_REQUEST_PERMITS_PER_SECOND = 1; 3193 @ConfigFlag float FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_REQUEST_PERMITS_PER_SECOND = 1; 3194 @ConfigFlag float FLEDGE_LEAVE_CUSTOM_AUDIENCE_REQUEST_PERMITS_PER_SECOND = 1; 3195 @ConfigFlag float FLEDGE_UPDATE_SIGNALS_REQUEST_PERMITS_PER_SECOND = 1; 3196 @ConfigFlag float FLEDGE_SELECT_ADS_REQUEST_PERMITS_PER_SECOND = 1; 3197 @ConfigFlag float FLEDGE_SELECT_ADS_WITH_OUTCOMES_REQUEST_PERMITS_PER_SECOND = 1; 3198 @ConfigFlag float FLEDGE_GET_AD_SELECTION_DATA_REQUEST_PERMITS_PER_SECOND = 1; 3199 @ConfigFlag float FLEDGE_PERSIST_AD_SELECTION_RESULT_REQUEST_PERMITS_PER_SECOND = 1; 3200 @ConfigFlag float FLEDGE_REPORT_IMPRESSION_REQUEST_PERMITS_PER_SECOND = 1; 3201 float FLEDGE_REPORT_INTERACTION_REQUEST_PERMITS_PER_SECOND = 1; 3202 @ConfigFlag float FLEDGE_SET_APP_INSTALL_ADVERTISERS_REQUEST_PERMITS_PER_SECOND = 1; 3203 @ConfigFlag float FLEDGE_UPDATE_AD_COUNTER_HISTOGRAM_REQUEST_PERMITS_PER_SECOND = 1; 3204 3205 /** Returns the Sdk Request Permits Per Second. */ getSdkRequestPermitsPerSecond()3206 default float getSdkRequestPermitsPerSecond() { 3207 return SDK_REQUEST_PERMITS_PER_SECOND; 3208 } 3209 3210 /** Returns the Ad id Request Permits Per Second. */ getAdIdRequestPermitsPerSecond()3211 default float getAdIdRequestPermitsPerSecond() { 3212 return ADID_REQUEST_PERMITS_PER_SECOND; 3213 } 3214 3215 /** Returns the App Set Ad Request Permits Per Second. */ getAppSetIdRequestPermitsPerSecond()3216 default float getAppSetIdRequestPermitsPerSecond() { 3217 return APPSETID_REQUEST_PERMITS_PER_SECOND; 3218 } 3219 3220 /** Returns the Topics API Based On App Package Name Request Permits Per Second. */ getTopicsApiAppRequestPermitsPerSecond()3221 default float getTopicsApiAppRequestPermitsPerSecond() { 3222 return TOPICS_API_APP_REQUEST_PERMITS_PER_SECOND; 3223 } 3224 3225 /** Returns the Topics API Based On Sdk Name Request Permits Per Second. */ getTopicsApiSdkRequestPermitsPerSecond()3226 default float getTopicsApiSdkRequestPermitsPerSecond() { 3227 return TOPICS_API_SDK_REQUEST_PERMITS_PER_SECOND; 3228 } 3229 3230 /** Returns the Measurement Register Source Request Permits Per Second. */ getMeasurementRegisterSourceRequestPermitsPerSecond()3231 default float getMeasurementRegisterSourceRequestPermitsPerSecond() { 3232 return MEASUREMENT_REGISTER_SOURCE_REQUEST_PERMITS_PER_SECOND; 3233 } 3234 3235 /** Returns the Measurement Register Sources Request Permits Per Second. */ getMeasurementRegisterSourcesRequestPermitsPerSecond()3236 default float getMeasurementRegisterSourcesRequestPermitsPerSecond() { 3237 return MEASUREMENT_REGISTER_SOURCES_REQUEST_PERMITS_PER_SECOND; 3238 } 3239 3240 /** Returns the Measurement Register Web Source Request Permits Per Second. */ getMeasurementRegisterWebSourceRequestPermitsPerSecond()3241 default float getMeasurementRegisterWebSourceRequestPermitsPerSecond() { 3242 return MEASUREMENT_REGISTER_WEB_SOURCE_REQUEST_PERMITS_PER_SECOND; 3243 } 3244 3245 /** Returns the Measurement Register Trigger Request Permits Per Second. */ getMeasurementRegisterTriggerRequestPermitsPerSecond()3246 default float getMeasurementRegisterTriggerRequestPermitsPerSecond() { 3247 return MEASUREMENT_REGISTER_TRIGGER_REQUEST_PERMITS_PER_SECOND; 3248 } 3249 3250 /** Returns the Measurement Register Web Trigger Request Permits Per Second. */ getMeasurementRegisterWebTriggerRequestPermitsPerSecond()3251 default float getMeasurementRegisterWebTriggerRequestPermitsPerSecond() { 3252 return MEASUREMENT_REGISTER_WEB_TRIGGER_REQUEST_PERMITS_PER_SECOND; 3253 } 3254 3255 /** Returns the Protected Audience joinCustomAudience() API max request permits per second. */ getFledgeJoinCustomAudienceRequestPermitsPerSecond()3256 default float getFledgeJoinCustomAudienceRequestPermitsPerSecond() { 3257 return FLEDGE_JOIN_CUSTOM_AUDIENCE_REQUEST_PERMITS_PER_SECOND; 3258 } 3259 3260 /** 3261 * Returns the Protected Audience fetchAndJoinCustomAudience() API max request permits per 3262 * second. 3263 */ getFledgeFetchAndJoinCustomAudienceRequestPermitsPerSecond()3264 default float getFledgeFetchAndJoinCustomAudienceRequestPermitsPerSecond() { 3265 return FLEDGE_FETCH_AND_JOIN_CUSTOM_AUDIENCE_REQUEST_PERMITS_PER_SECOND; 3266 } 3267 3268 /** 3269 * Returns the Protected Audience scheduleCustomAudienceUpdate() API max request permits per 3270 * second. 3271 */ getFledgeScheduleCustomAudienceUpdateRequestPermitsPerSecond()3272 default float getFledgeScheduleCustomAudienceUpdateRequestPermitsPerSecond() { 3273 return FLEDGE_SCHEDULE_CUSTOM_AUDIENCE_UPDATE_REQUEST_PERMITS_PER_SECOND; 3274 } 3275 3276 /** Returns the Protected Audience leaveCustomAudience() API max request permits per second. */ getFledgeLeaveCustomAudienceRequestPermitsPerSecond()3277 default float getFledgeLeaveCustomAudienceRequestPermitsPerSecond() { 3278 return FLEDGE_LEAVE_CUSTOM_AUDIENCE_REQUEST_PERMITS_PER_SECOND; 3279 } 3280 3281 /** Returns the Protected Signals updateSignals() API max request permits per second. */ getFledgeUpdateSignalsRequestPermitsPerSecond()3282 default float getFledgeUpdateSignalsRequestPermitsPerSecond() { 3283 return FLEDGE_UPDATE_SIGNALS_REQUEST_PERMITS_PER_SECOND; 3284 } 3285 3286 /** Returns the Protected Audience selectAds() API max request permits per second. */ getFledgeSelectAdsRequestPermitsPerSecond()3287 default float getFledgeSelectAdsRequestPermitsPerSecond() { 3288 return FLEDGE_SELECT_ADS_REQUEST_PERMITS_PER_SECOND; 3289 } 3290 3291 /** 3292 * Returns the Protected Audience selectAds() with outcomes API max request permits per second. 3293 */ getFledgeSelectAdsWithOutcomesRequestPermitsPerSecond()3294 default float getFledgeSelectAdsWithOutcomesRequestPermitsPerSecond() { 3295 return FLEDGE_SELECT_ADS_WITH_OUTCOMES_REQUEST_PERMITS_PER_SECOND; 3296 } 3297 3298 /** Returns the Protected Audience getAdSelectionData() API max request permits per second. */ getFledgeGetAdSelectionDataRequestPermitsPerSecond()3299 default float getFledgeGetAdSelectionDataRequestPermitsPerSecond() { 3300 return FLEDGE_GET_AD_SELECTION_DATA_REQUEST_PERMITS_PER_SECOND; 3301 } 3302 3303 /** 3304 * Returns the Protected Audience persistAdSelectionResult() API max request permits per second. 3305 */ getFledgePersistAdSelectionResultRequestPermitsPerSecond()3306 default float getFledgePersistAdSelectionResultRequestPermitsPerSecond() { 3307 return FLEDGE_PERSIST_AD_SELECTION_RESULT_REQUEST_PERMITS_PER_SECOND; 3308 } 3309 3310 /** Returns the Protected Audience reportImpression() API max request permits per second. */ getFledgeReportImpressionRequestPermitsPerSecond()3311 default float getFledgeReportImpressionRequestPermitsPerSecond() { 3312 return FLEDGE_REPORT_IMPRESSION_REQUEST_PERMITS_PER_SECOND; 3313 } 3314 3315 /** Returns the Protected Audience reportEvent() API max request permits per second. */ getFledgeReportInteractionRequestPermitsPerSecond()3316 default float getFledgeReportInteractionRequestPermitsPerSecond() { 3317 return FLEDGE_REPORT_INTERACTION_REQUEST_PERMITS_PER_SECOND; 3318 } 3319 3320 /** 3321 * Returns the Protected Audience setAppInstallAdvertisers() API max request permits per second. 3322 */ getFledgeSetAppInstallAdvertisersRequestPermitsPerSecond()3323 default float getFledgeSetAppInstallAdvertisersRequestPermitsPerSecond() { 3324 return FLEDGE_SET_APP_INSTALL_ADVERTISERS_REQUEST_PERMITS_PER_SECOND; 3325 } 3326 3327 /** 3328 * Returns the Protected Audience updateAdCounterHistogram() API max request permits per second. 3329 */ getFledgeUpdateAdCounterHistogramRequestPermitsPerSecond()3330 default float getFledgeUpdateAdCounterHistogramRequestPermitsPerSecond() { 3331 return FLEDGE_UPDATE_AD_COUNTER_HISTOGRAM_REQUEST_PERMITS_PER_SECOND; 3332 } 3333 3334 // Flags for ad tech enrollment enforcement 3335 3336 boolean DISABLE_TOPICS_ENROLLMENT_CHECK = false; 3337 boolean DISABLE_FLEDGE_ENROLLMENT_CHECK = false; 3338 boolean DISABLE_MEASUREMENT_ENROLLMENT_CHECK = false; 3339 boolean ENABLE_ENROLLMENT_TEST_SEED = false; 3340 3341 /** Returns {@code true} if the Topics API should disable the ad tech enrollment check */ isDisableTopicsEnrollmentCheck()3342 default boolean isDisableTopicsEnrollmentCheck() { 3343 return DISABLE_TOPICS_ENROLLMENT_CHECK; 3344 } 3345 3346 /** Returns {@code true} if the FLEDGE APIs should disable the ad tech enrollment check */ getDisableFledgeEnrollmentCheck()3347 default boolean getDisableFledgeEnrollmentCheck() { 3348 return DISABLE_FLEDGE_ENROLLMENT_CHECK; 3349 } 3350 3351 /** Returns {@code true} if the Measurement APIs should disable the ad tech enrollment check */ isDisableMeasurementEnrollmentCheck()3352 default boolean isDisableMeasurementEnrollmentCheck() { 3353 return DISABLE_MEASUREMENT_ENROLLMENT_CHECK; 3354 } 3355 3356 /** 3357 * Returns {@code true} if the Enrollment seed is disabled. (Enrollment seed is only needed for 3358 * testing) 3359 */ isEnableEnrollmentTestSeed()3360 default boolean isEnableEnrollmentTestSeed() { 3361 return ENABLE_ENROLLMENT_TEST_SEED; 3362 } 3363 3364 boolean ENFORCE_FOREGROUND_STATUS_ADID = true; 3365 boolean ENFORCE_FOREGROUND_STATUS_APPSETID = true; 3366 boolean ENFORCE_FOREGROUND_STATUS_FLEDGE_RUN_AD_SELECTION = true; 3367 boolean ENFORCE_FOREGROUND_STATUS_FLEDGE_REPORT_IMPRESSION = true; 3368 boolean ENFORCE_FOREGROUND_STATUS_FLEDGE_REPORT_INTERACTION = true; 3369 boolean ENFORCE_FOREGROUND_STATUS_FLEDGE_OVERRIDES = true; 3370 boolean ENFORCE_FOREGROUND_STATUS_FLEDGE_CUSTOM_AUDIENCE = true; 3371 @ConfigFlag boolean ENFORCE_FOREGROUND_STATUS_FETCH_AND_JOIN_CUSTOM_AUDIENCE = true; 3372 @ConfigFlag boolean ENFORCE_FOREGROUND_STATUS_LEAVE_CUSTOM_AUDIENCE = true; 3373 @ConfigFlag boolean ENFORCE_FOREGROUND_STATUS_SCHEDULE_CUSTOM_AUDIENCE = true; 3374 boolean ENFORCE_FOREGROUND_STATUS_TOPICS = true; 3375 boolean ENFORCE_FOREGROUND_STATUS_SIGNALS = true; 3376 @FeatureFlag boolean ENABLE_GET_BINDING_UID_IMPORTANCE = false; 3377 3378 /** Returns if the feature to use {@code ActivityManager.getBindingUidImportance} is enabled. */ getEnableGetBindingUidImportance()3379 default boolean getEnableGetBindingUidImportance() { 3380 return ENABLE_GET_BINDING_UID_IMPORTANCE; 3381 } 3382 3383 /** 3384 * Returns true if FLEDGE runAdSelection API should require that the caller is running in 3385 * foreground. 3386 */ getEnforceForegroundStatusForFledgeRunAdSelection()3387 default boolean getEnforceForegroundStatusForFledgeRunAdSelection() { 3388 return ENFORCE_FOREGROUND_STATUS_FLEDGE_RUN_AD_SELECTION; 3389 } 3390 3391 /** 3392 * Returns true if FLEDGE reportImpression API should require that the caller is running in 3393 * foreground. 3394 */ getEnforceForegroundStatusForFledgeReportImpression()3395 default boolean getEnforceForegroundStatusForFledgeReportImpression() { 3396 return ENFORCE_FOREGROUND_STATUS_FLEDGE_REPORT_IMPRESSION; 3397 } 3398 3399 /** 3400 * Returns true if FLEDGE reportInteraction API should require that the caller is running in 3401 * foreground. 3402 */ getEnforceForegroundStatusForFledgeReportInteraction()3403 default boolean getEnforceForegroundStatusForFledgeReportInteraction() { 3404 return ENFORCE_FOREGROUND_STATUS_FLEDGE_REPORT_INTERACTION; 3405 } 3406 3407 /** 3408 * Returns true if FLEDGE override API methods (for Custom Audience and Ad Selection) should 3409 * require that the caller is running in foreground. 3410 */ getEnforceForegroundStatusForFledgeOverrides()3411 default boolean getEnforceForegroundStatusForFledgeOverrides() { 3412 return ENFORCE_FOREGROUND_STATUS_FLEDGE_OVERRIDES; 3413 } 3414 3415 /** 3416 * Returns true if FLEDGE Custom Audience API methods should require that the caller is running 3417 * in foreground. 3418 */ getEnforceForegroundStatusForFledgeCustomAudience()3419 default boolean getEnforceForegroundStatusForFledgeCustomAudience() { 3420 return ENFORCE_FOREGROUND_STATUS_FLEDGE_CUSTOM_AUDIENCE; 3421 } 3422 3423 /** 3424 * Returns true if FetchAndJoin Custom Audience API should require that the caller is running in 3425 * foreground. 3426 */ getEnforceForegroundStatusForFetchAndJoinCustomAudience()3427 default boolean getEnforceForegroundStatusForFetchAndJoinCustomAudience() { 3428 return ENFORCE_FOREGROUND_STATUS_FETCH_AND_JOIN_CUSTOM_AUDIENCE; 3429 } 3430 3431 /** 3432 * Returns true if Leave Custom Audience API should require that the caller is running in 3433 * foreground. 3434 */ getEnforceForegroundStatusForLeaveCustomAudience()3435 default boolean getEnforceForegroundStatusForLeaveCustomAudience() { 3436 return ENFORCE_FOREGROUND_STATUS_LEAVE_CUSTOM_AUDIENCE; 3437 } 3438 3439 /** 3440 * Returns true if Schedule Custom Audience API should require that the caller is running in 3441 * foreground. 3442 */ getEnforceForegroundStatusForScheduleCustomAudience()3443 default boolean getEnforceForegroundStatusForScheduleCustomAudience() { 3444 return ENFORCE_FOREGROUND_STATUS_SCHEDULE_CUSTOM_AUDIENCE; 3445 } 3446 3447 boolean MEASUREMENT_ENFORCE_FOREGROUND_STATUS_DELETE_REGISTRATIONS = true; 3448 boolean MEASUREMENT_ENFORCE_FOREGROUND_STATUS_REGISTER_SOURCE = true; 3449 boolean MEASUREMENT_ENFORCE_FOREGROUND_STATUS_REGISTER_TRIGGER = false; 3450 boolean MEASUREMENT_ENFORCE_FOREGROUND_STATUS_REGISTER_WEB_SOURCE = true; 3451 boolean MEASUREMENT_ENFORCE_FOREGROUND_STATUS_REGISTER_WEB_TRIGGER = false; 3452 boolean MEASUREMENT_ENFORCE_FOREGROUND_STATUS_GET_STATUS = false; 3453 boolean MEASUREMENT_ENFORCE_FOREGROUND_STATUS_REGISTER_SOURCES = true; 3454 3455 /** 3456 * Returns true if Measurement Delete Registrations API should require that the calling API is 3457 * running in foreground. 3458 */ getEnforceForegroundStatusForMeasurementDeleteRegistrations()3459 default boolean getEnforceForegroundStatusForMeasurementDeleteRegistrations() { 3460 return MEASUREMENT_ENFORCE_FOREGROUND_STATUS_DELETE_REGISTRATIONS; 3461 } 3462 3463 /** 3464 * Returns true if Measurement Register Source API should require that the calling API is 3465 * running in foreground. 3466 */ getEnforceForegroundStatusForMeasurementRegisterSource()3467 default boolean getEnforceForegroundStatusForMeasurementRegisterSource() { 3468 return MEASUREMENT_ENFORCE_FOREGROUND_STATUS_REGISTER_SOURCE; 3469 } 3470 3471 /** 3472 * Returns true if Measurement Register Trigger API should require that the calling API is 3473 * running in foreground. 3474 */ getEnforceForegroundStatusForMeasurementRegisterTrigger()3475 default boolean getEnforceForegroundStatusForMeasurementRegisterTrigger() { 3476 return MEASUREMENT_ENFORCE_FOREGROUND_STATUS_REGISTER_TRIGGER; 3477 } 3478 3479 /** 3480 * Returns true if Measurement Register Web Source API should require that the calling API is 3481 * running in foreground. 3482 */ getEnforceForegroundStatusForMeasurementRegisterWebSource()3483 default boolean getEnforceForegroundStatusForMeasurementRegisterWebSource() { 3484 return MEASUREMENT_ENFORCE_FOREGROUND_STATUS_REGISTER_WEB_SOURCE; 3485 } 3486 3487 /** 3488 * Returns true if Measurement Register Web Trigger API should require that the calling API is 3489 * running in foreground. 3490 */ getEnforceForegroundStatusForMeasurementRegisterWebTrigger()3491 default boolean getEnforceForegroundStatusForMeasurementRegisterWebTrigger() { 3492 return MEASUREMENT_ENFORCE_FOREGROUND_STATUS_REGISTER_WEB_TRIGGER; 3493 } 3494 3495 /** 3496 * Returns true if Measurement Get Status API should require that the calling API is running in 3497 * foreground. 3498 */ getEnforceForegroundStatusForMeasurementStatus()3499 default boolean getEnforceForegroundStatusForMeasurementStatus() { 3500 return MEASUREMENT_ENFORCE_FOREGROUND_STATUS_GET_STATUS; 3501 } 3502 3503 /** 3504 * Returns true if Measurement Get Status API should require that the calling API is running in 3505 * foreground. 3506 */ getEnforceForegroundStatusForMeasurementRegisterSources()3507 default boolean getEnforceForegroundStatusForMeasurementRegisterSources() { 3508 return MEASUREMENT_ENFORCE_FOREGROUND_STATUS_REGISTER_SOURCES; 3509 } 3510 3511 /** Returns true if Topics API should require that the calling API is running in foreground. */ getEnforceForegroundStatusForTopics()3512 default boolean getEnforceForegroundStatusForTopics() { 3513 return ENFORCE_FOREGROUND_STATUS_TOPICS; 3514 } 3515 3516 /** 3517 * Returns true if Protected Signals API should require that the calling API is running in 3518 * foreground. 3519 */ getEnforceForegroundStatusForSignals()3520 default boolean getEnforceForegroundStatusForSignals() { 3521 return ENFORCE_FOREGROUND_STATUS_SIGNALS; 3522 } 3523 3524 /** Returns true if AdId API should require that the calling API is running in foreground. */ getEnforceForegroundStatusForAdId()3525 default boolean getEnforceForegroundStatusForAdId() { 3526 return ENFORCE_FOREGROUND_STATUS_ADID; 3527 } 3528 3529 int FOREGROUND_STATUS_LEVEL = IMPORTANCE_FOREGROUND_SERVICE; 3530 3531 /** 3532 * Returns true if AppSetId API should require that the calling API is running in foreground. 3533 */ getEnforceForegroundStatusForAppSetId()3534 default boolean getEnforceForegroundStatusForAppSetId() { 3535 return ENFORCE_FOREGROUND_STATUS_APPSETID; 3536 } 3537 3538 /** Returns the importance level to use to check if an application is in foreground. */ getForegroundStatuslLevelForValidation()3539 default int getForegroundStatuslLevelForValidation() { 3540 return FOREGROUND_STATUS_LEVEL; 3541 } 3542 getWebContextClientAppAllowList()3543 default String getWebContextClientAppAllowList() { 3544 return WEB_CONTEXT_CLIENT_ALLOW_LIST; 3545 } 3546 3547 long ISOLATE_MAX_HEAP_SIZE_BYTES = 10 * 1024 * 1024L; // 10 MB 3548 long MAX_RESPONSE_BASED_REGISTRATION_SIZE_BYTES = 16 * 1024; // 16 kB 3549 long MAX_TRIGGER_REGISTRATION_HEADER_SIZE_BYTES = 250 * 1024; // 250 kB 3550 long MAX_ODP_TRIGGER_REGISTRATION_HEADER_SIZE_BYTES = 16 * 1024; // 16 kB 3551 3552 /** Returns max allowed size in bytes for trigger registrations header. */ getMaxTriggerRegistrationHeaderSizeBytes()3553 default long getMaxTriggerRegistrationHeaderSizeBytes() { 3554 return MAX_TRIGGER_REGISTRATION_HEADER_SIZE_BYTES; 3555 } 3556 3557 /** Returns max allowed size in bytes for ODP trigger registrations header. */ getMaxOdpTriggerRegistrationHeaderSizeBytes()3558 default long getMaxOdpTriggerRegistrationHeaderSizeBytes() { 3559 return MAX_ODP_TRIGGER_REGISTRATION_HEADER_SIZE_BYTES; 3560 } 3561 3562 boolean MEASUREMENT_ENABLE_UPDATE_TRIGGER_REGISTRATION_HEADER_LIMIT = false; 3563 3564 /** Returns true when the new trigger registration header size limitation are applied. */ getMeasurementEnableUpdateTriggerHeaderLimit()3565 default boolean getMeasurementEnableUpdateTriggerHeaderLimit() { 3566 return MEASUREMENT_ENABLE_UPDATE_TRIGGER_REGISTRATION_HEADER_LIMIT; 3567 } 3568 3569 /** Returns size in bytes we bound the heap memory for JavaScript isolate */ getIsolateMaxHeapSizeBytes()3570 default long getIsolateMaxHeapSizeBytes() { 3571 return ISOLATE_MAX_HEAP_SIZE_BYTES; 3572 } 3573 3574 /** 3575 * Returns max allowed size in bytes for response based registrations payload of an individual 3576 * source/trigger registration. 3577 */ getMaxResponseBasedRegistrationPayloadSizeBytes()3578 default long getMaxResponseBasedRegistrationPayloadSizeBytes() { 3579 return MAX_RESPONSE_BASED_REGISTRATION_SIZE_BYTES; 3580 } 3581 3582 /** Ui OTA strings group name, used for MDD download. */ 3583 String UI_OTA_STRINGS_GROUP_NAME = "ui-ota-strings"; 3584 3585 /** UI OTA strings group name. */ getUiOtaStringsGroupName()3586 default String getUiOtaStringsGroupName() { 3587 return UI_OTA_STRINGS_GROUP_NAME; 3588 } 3589 3590 /** Ui OTA strings manifest file url, used for MDD download. */ 3591 String UI_OTA_STRINGS_MANIFEST_FILE_URL = 3592 "https://www.gstatic.com/mdi-serving/rubidium-adservices-ui-ota-strings/1341" 3593 + "/95580b00edbd8cbf62bfa0df9ebd79fba1e5b7ca"; 3594 3595 /** UI OTA strings manifest file url. */ getUiOtaStringsManifestFileUrl()3596 default String getUiOtaStringsManifestFileUrl() { 3597 return UI_OTA_STRINGS_MANIFEST_FILE_URL; 3598 } 3599 3600 /** Ui OTA strings feature flag. */ 3601 boolean UI_OTA_STRINGS_FEATURE_ENABLED = false; 3602 3603 /** Returns if UI OTA strings feature is enabled. */ getUiOtaStringsFeatureEnabled()3604 default boolean getUiOtaStringsFeatureEnabled() { 3605 return UI_OTA_STRINGS_FEATURE_ENABLED; 3606 } 3607 3608 /** UI OTA resources manifest file url, used for MDD download. */ 3609 String UI_OTA_RESOURCES_MANIFEST_FILE_URL = ""; 3610 3611 /** UI OTA resources manifest file url. */ getUiOtaResourcesManifestFileUrl()3612 default String getUiOtaResourcesManifestFileUrl() { 3613 return UI_OTA_RESOURCES_MANIFEST_FILE_URL; 3614 } 3615 3616 /** UI OTA resources feature flag. */ 3617 boolean UI_OTA_RESOURCES_FEATURE_ENABLED = false; 3618 3619 /** Returns if UI OTA resources feature is enabled. */ getUiOtaResourcesFeatureEnabled()3620 default boolean getUiOtaResourcesFeatureEnabled() { 3621 return UI_OTA_RESOURCES_FEATURE_ENABLED; 3622 } 3623 3624 /** Deadline for downloading UI OTA strings. */ 3625 long UI_OTA_STRINGS_DOWNLOAD_DEADLINE = 86700000; /* 1 day */ 3626 3627 /** Returns the deadline for downloading UI OTA strings. */ getUiOtaStringsDownloadDeadline()3628 default long getUiOtaStringsDownloadDeadline() { 3629 return UI_OTA_STRINGS_DOWNLOAD_DEADLINE; 3630 } 3631 3632 /** UI Dialogs feature enabled. */ 3633 boolean UI_DIALOGS_FEATURE_ENABLED = false; 3634 3635 /** Returns if the UI Dialogs feature is enabled. */ getUiDialogsFeatureEnabled()3636 default boolean getUiDialogsFeatureEnabled() { 3637 return UI_DIALOGS_FEATURE_ENABLED; 3638 } 3639 3640 /** UI Dialog Fragment feature enabled. */ 3641 boolean UI_DIALOG_FRAGMENT = false; 3642 3643 /** Returns if the UI Dialog Fragment is enabled. */ getUiDialogFragmentEnabled()3644 default boolean getUiDialogFragmentEnabled() { 3645 return UI_DIALOG_FRAGMENT; 3646 } 3647 3648 /** The EEA device region feature is off by default. */ 3649 boolean IS_EEA_DEVICE_FEATURE_ENABLED = false; 3650 3651 /** Returns if the EEA device region feature has been enabled. */ isEeaDeviceFeatureEnabled()3652 default boolean isEeaDeviceFeatureEnabled() { 3653 return IS_EEA_DEVICE_FEATURE_ENABLED; 3654 } 3655 3656 /** Default is that the device is in the EEA region. */ 3657 boolean IS_EEA_DEVICE = true; 3658 3659 /** Returns if device is in the EEA region. */ isEeaDevice()3660 default boolean isEeaDevice() { 3661 return IS_EEA_DEVICE; 3662 } 3663 3664 /** Default is that the ui feature type logging is enabled. */ 3665 boolean UI_FEATURE_TYPE_LOGGING_ENABLED = true; 3666 3667 /** Returns if device is in the EEA region. */ isUiFeatureTypeLoggingEnabled()3668 default boolean isUiFeatureTypeLoggingEnabled() { 3669 return UI_FEATURE_TYPE_LOGGING_ENABLED; 3670 } 3671 3672 /** Default is that the manual interaction feature is enabled. */ 3673 boolean RECORD_MANUAL_INTERACTION_ENABLED = true; 3674 3675 /** Returns if the manual interaction feature is enabled. */ getRecordManualInteractionEnabled()3676 default boolean getRecordManualInteractionEnabled() { 3677 return RECORD_MANUAL_INTERACTION_ENABLED; 3678 } 3679 3680 /** Default is that the notification should be dismissed on click. */ 3681 boolean DEFAULT_NOTIFICATION_DISMISSED_ON_CLICK = true; 3682 3683 /** Determines whether the notification should be dismissed on click. */ getNotificationDismissedOnClick()3684 default boolean getNotificationDismissedOnClick() { 3685 return DEFAULT_NOTIFICATION_DISMISSED_ON_CLICK; 3686 } 3687 3688 /** 3689 * The check activity feature is off by default. When enabled, we check whether all Rubidium 3690 * activities are enabled when we determine whether AdServices is enabled 3691 */ 3692 boolean IS_BACK_COMPACT_ACTIVITY_FEATURE_ENABLED = false; 3693 3694 /** Returns if the check activity feature has been enabled. */ isBackCompatActivityFeatureEnabled()3695 default boolean isBackCompatActivityFeatureEnabled() { 3696 return IS_BACK_COMPACT_ACTIVITY_FEATURE_ENABLED; 3697 } 3698 3699 String UI_EEA_COUNTRIES = 3700 "AT," // Austria 3701 + "BE," // Belgium 3702 + "BG," // Bulgaria 3703 + "HR," // Croatia 3704 + "CY," // Republic of Cyprus 3705 + "CZ," // Czech Republic 3706 + "DK," // Denmark 3707 + "EE," // Estonia 3708 + "FI," // Finland 3709 + "FR," // France 3710 + "DE," // Germany 3711 + "GR," // Greece 3712 + "HU," // Hungary 3713 + "IE," // Ireland 3714 + "IT," // Italy 3715 + "LV," // Latvia 3716 + "LT," // Lithuania 3717 + "LU," // Luxembourg 3718 + "MT," // Malta 3719 + "NL," // Netherlands 3720 + "PL," // Poland 3721 + "PT," // Portugal 3722 + "RO," // Romania 3723 + "SK," // Slovakia 3724 + "SI," // Slovenia 3725 + "ES," // Spain 3726 + "SE," // Sweden 3727 + "IS," // Iceland 3728 + "LI," // Liechtenstein 3729 + "NO," // Norway 3730 + "CH," // Switzerland 3731 + "GB," // Great Britain 3732 + "GI," // Gibraltar 3733 + "GP," // Guadeloupe 3734 + "GG," // Guernsey 3735 + "JE," // Jersey 3736 + "VA," // Vatican City 3737 + "AX," // Åland Islands 3738 + "IC," // Canary Islands 3739 + "EA," // Ceuta & Melilla 3740 + "GF," // French Guiana 3741 + "PF," // French Polynesia 3742 + "TF," // French Southern Territories 3743 + "MQ," // Martinique 3744 + "YT," // Mayotte 3745 + "NC," // New Caledonia 3746 + "RE," // Réunion 3747 + "BL," // St. Barthélemy 3748 + "MF," // St. Martin 3749 + "PM," // St. Pierre & Miquelon 3750 + "SJ," // Svalbard & Jan Mayen 3751 + "WF"; // Wallis & Futuna 3752 3753 /** Returns the list of EEA countries in a String separated by comma */ getUiEeaCountries()3754 default String getUiEeaCountries() { 3755 return UI_EEA_COUNTRIES; 3756 } 3757 3758 /** 3759 * GA UX enabled. It contains features that have to be enabled at the same time: 3760 * 3761 * <ul> 3762 * <li>Updated consent landing page 3763 * <li>Consent per API (instead of aggregated one) 3764 * <li>Separate page to control Measurement API 3765 * </ul> 3766 * 3767 * This flag is set default to true as beta deprecated. 3768 */ 3769 boolean GA_UX_FEATURE_ENABLED = true; 3770 3771 /** Returns if the GA UX feature is enabled. */ getGaUxFeatureEnabled()3772 default boolean getGaUxFeatureEnabled() { 3773 return GA_UX_FEATURE_ENABLED; 3774 } 3775 3776 /** Set the debug UX, which should correspond to the {@link PrivacySandboxUxCollection} enum. */ 3777 String DEBUG_UX = "UNSUPPORTED_UX"; 3778 3779 /** Returns the debug UX. */ getDebugUx()3780 default String getDebugUx() { 3781 return DEBUG_UX; 3782 } 3783 3784 /** add speed bump dialogs when turning on or off the toggle of Topics, apps, measurement */ 3785 boolean TOGGLE_SPEED_BUMP_ENABLED = false; 3786 3787 /** Returns if the toggle speed bump dialog feature is enabled. */ getToggleSpeedBumpEnabled()3788 default boolean getToggleSpeedBumpEnabled() { 3789 return TOGGLE_SPEED_BUMP_ENABLED; 3790 } 3791 3792 long ASYNC_REGISTRATION_JOB_QUEUE_INTERVAL_MS = (int) TimeUnit.HOURS.toMillis(1); 3793 3794 /** Returns the interval in which to run Registration Job Queue Service. */ getAsyncRegistrationJobQueueIntervalMs()3795 default long getAsyncRegistrationJobQueueIntervalMs() { 3796 return ASYNC_REGISTRATION_JOB_QUEUE_INTERVAL_MS; 3797 } 3798 3799 /** 3800 * Registration Job Queue Kill Switch. The default value is false which means Registration Job 3801 * Queue is enabled. This flag is used for emergency shutdown of the Registration Job Queue. 3802 */ 3803 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 3804 boolean MEASUREMENT_REGISTRATION_JOB_QUEUE_KILL_SWITCH = false; 3805 3806 /** 3807 * Returns the kill switch value for Registration Job Queue. The job will be disabled if either 3808 * the Global Kill Switch, Measurement Kill Switch, or the Registration Job Queue Kill Switch 3809 * value is true. 3810 */ getAsyncRegistrationJobQueueKillSwitch()3811 default boolean getAsyncRegistrationJobQueueKillSwitch() { 3812 return getLegacyMeasurementKillSwitch() || MEASUREMENT_REGISTRATION_JOB_QUEUE_KILL_SWITCH; 3813 } 3814 3815 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 3816 boolean MEASUREMENT_REGISTRATION_FALLBACK_JOB_KILL_SWITCH = false; 3817 3818 /** 3819 * Returns the kill switch value for Registration Fallback Job. The Job will be disabled if 3820 * either the Global Kill Switch, Measurement Kill Switch, or the Registration Fallback Job Kill 3821 * Switch value is true. 3822 */ getAsyncRegistrationFallbackJobKillSwitch()3823 default boolean getAsyncRegistrationFallbackJobKillSwitch() { 3824 return getLegacyMeasurementKillSwitch() 3825 || MEASUREMENT_REGISTRATION_FALLBACK_JOB_KILL_SWITCH; 3826 } 3827 3828 /** Returns true if the given enrollmentId is blocked from using PP-API. */ isEnrollmentBlocklisted(String enrollmentId)3829 default boolean isEnrollmentBlocklisted(String enrollmentId) { 3830 return false; 3831 } 3832 3833 /** Returns a list of enrollmentId blocked from using PP-API. */ getEnrollmentBlocklist()3834 default ImmutableList<String> getEnrollmentBlocklist() { 3835 return ImmutableList.of(); 3836 } 3837 3838 long DEFAULT_MEASUREMENT_DEBUG_JOIN_KEY_HASH_LIMIT = 100L; 3839 3840 /** Returns debug keys hash limit. */ getMeasurementDebugJoinKeyHashLimit()3841 default long getMeasurementDebugJoinKeyHashLimit() { 3842 return DEFAULT_MEASUREMENT_DEBUG_JOIN_KEY_HASH_LIMIT; 3843 } 3844 3845 /** Returns the limit to the number of unique AdIDs attempted to match for debug keys. */ 3846 long DEFAULT_MEASUREMENT_PLATFORM_DEBUG_AD_ID_MATCHING_LIMIT = 5L; 3847 getMeasurementPlatformDebugAdIdMatchingLimit()3848 default long getMeasurementPlatformDebugAdIdMatchingLimit() { 3849 return DEFAULT_MEASUREMENT_PLATFORM_DEBUG_AD_ID_MATCHING_LIMIT; 3850 } 3851 3852 /** Default value for the feature to enable AdIDs per device per window. */ 3853 @FeatureFlag boolean DEFAULT_MEASUREMENT_ENABLE_AD_IDS_PER_DEVICE_PER_WINDOW = false; 3854 3855 /** Returns true if the AdIDs per device per window feature is enabled. */ getMeasurementEnableAdIdsPerDevicePerWindow()3856 default boolean getMeasurementEnableAdIdsPerDevicePerWindow() { 3857 return DEFAULT_MEASUREMENT_ENABLE_AD_IDS_PER_DEVICE_PER_WINDOW; 3858 } 3859 3860 /** Default value for the AdIDs per device per window period in milliseconds. */ 3861 @ConfigFlag 3862 long DEFAULT_MEASUREMENT_AD_IDS_PER_DEVICE_PER_WINDOW_PERIOD_MS = TimeUnit.DAYS.toMillis(7); 3863 3864 /** Returns true if the AdIDs per device per window feature is enabled. */ getMeasurementAdIdsPerDevicePerWindowPeriodMs()3865 default long getMeasurementAdIdsPerDevicePerWindowPeriodMs() { 3866 return DEFAULT_MEASUREMENT_AD_IDS_PER_DEVICE_PER_WINDOW_PERIOD_MS; 3867 } 3868 3869 /** Default value for enabling the Count Unique service. */ 3870 @FeatureFlag boolean DEFAULT_MEASUREMENT_ENABLE_COUNT_UNIQUE_SERVICE = false; 3871 3872 /** Returns true if the Count Unique service is enabled. */ getMeasurementEnableCountUniqueService()3873 default boolean getMeasurementEnableCountUniqueService() { 3874 return DEFAULT_MEASUREMENT_ENABLE_COUNT_UNIQUE_SERVICE; 3875 } 3876 3877 /** Default value for enabling the Count Unique reporting job. */ 3878 @FeatureFlag boolean DEFAULT_MEASUREMENT_ENABLE_COUNT_UNIQUE_REPORTING_JOB = false; 3879 3880 /** Returns true if the Count Unique reporting job is enabled. */ getMeasurementEnableCountUniqueReportingJob()3881 default boolean getMeasurementEnableCountUniqueReportingJob() { 3882 return DEFAULT_MEASUREMENT_ENABLE_COUNT_UNIQUE_REPORTING_JOB; 3883 } 3884 3885 /** Default min time period between each execution of the Count Unique reporting job. */ 3886 @ConfigFlag 3887 long DEFAULT_MEASUREMENT_COUNT_UNIQUE_REPORTING_JOB_PERIOD_MS = TimeUnit.HOURS.toMillis(2); 3888 3889 /** 3890 * Returns the default min time period between each execution of the Count Unique reporting job. 3891 */ getMeasurementCountUniqueReportingJobPeriodMs()3892 default long getMeasurementCountUniqueReportingJobPeriodMs() { 3893 return DEFAULT_MEASUREMENT_COUNT_UNIQUE_REPORTING_JOB_PERIOD_MS; 3894 } 3895 3896 /** Default allow list for apps to allow count unique registrations. */ 3897 @ConfigFlag String DEFAULT_MEASUREMENT_COUNT_UNIQUE_APP_ALLOWLIST = ""; 3898 3899 /** Returns the allowlist of apps that allow count unique registrations. */ getMeasurementCountUniqueAppAllowlist()3900 default String getMeasurementCountUniqueAppAllowlist() { 3901 return DEFAULT_MEASUREMENT_COUNT_UNIQUE_APP_ALLOWLIST; 3902 } 3903 3904 /** Default allow list for app signatures to allow count unique registrations. */ 3905 @ConfigFlag String DEFAULT_MEASUREMENT_COUNT_UNIQUE_APP_SIGNATURE_ALLOWLIST = ""; 3906 3907 /** Returns the allowlist of app signatures that allow count unique registrations. */ getMeasurementCountUniqueAppSignatureAllowlist()3908 default String getMeasurementCountUniqueAppSignatureAllowlist() { 3909 return DEFAULT_MEASUREMENT_COUNT_UNIQUE_APP_SIGNATURE_ALLOWLIST; 3910 } 3911 3912 /** Kill switch to guard backward-compatible logging. See go/rbc-ww-logging */ 3913 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 3914 boolean COMPAT_LOGGING_KILL_SWITCH = false; 3915 3916 /** Returns true if backward-compatible logging should be disabled; false otherwise. */ getCompatLoggingKillSwitch()3917 default boolean getCompatLoggingKillSwitch() { 3918 return COMPAT_LOGGING_KILL_SWITCH; 3919 } 3920 3921 /** Kill switch to guard background jobs logging. */ 3922 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 3923 boolean BACKGROUND_JOBS_LOGGING_KILL_SWITCH = true; 3924 3925 /** Returns true if background jobs logging should be disabled; false otherwise */ getBackgroundJobsLoggingKillSwitch()3926 default boolean getBackgroundJobsLoggingKillSwitch() { 3927 return BACKGROUND_JOBS_LOGGING_KILL_SWITCH; 3928 } 3929 3930 // New Feature Flags 3931 boolean FLEDGE_REGISTER_AD_BEACON_ENABLED = false; 3932 boolean FLEDGE_CPC_BILLING_ENABLED = false; 3933 boolean FLEDGE_DATA_VERSION_HEADER_ENABLED = false; 3934 3935 /** Returns whether the {@code registerAdBeacon} feature is enabled. */ getFledgeRegisterAdBeaconEnabled()3936 default boolean getFledgeRegisterAdBeaconEnabled() { 3937 return FLEDGE_REGISTER_AD_BEACON_ENABLED; 3938 } 3939 3940 /** Returns whether the CPC billing feature is enabled. */ getFledgeCpcBillingEnabled()3941 default boolean getFledgeCpcBillingEnabled() { 3942 return FLEDGE_CPC_BILLING_ENABLED; 3943 } 3944 3945 /** Returns whether the data version header feature is enabled. */ getFledgeDataVersionHeaderEnabled()3946 default boolean getFledgeDataVersionHeaderEnabled() { 3947 return FLEDGE_DATA_VERSION_HEADER_ENABLED; 3948 } 3949 3950 // New fledge beacon reporting metrics flag. 3951 boolean FLEDGE_BEACON_REPORTING_METRICS_ENABLED = false; 3952 3953 /** 3954 * Returns whether the fledge beacon reporting metrics is enabled. This flag should not be 3955 * ramped on S- prior to M-2024-04. 3956 */ getFledgeBeaconReportingMetricsEnabled()3957 default boolean getFledgeBeaconReportingMetricsEnabled() { 3958 return getFledgeRegisterAdBeaconEnabled() && FLEDGE_BEACON_REPORTING_METRICS_ENABLED; 3959 } 3960 3961 // Fledge auction server API usage metrics flag. 3962 boolean FLEDGE_AUCTION_SERVER_API_USAGE_METRICS_ENABLED = false; 3963 3964 /** Returns whether the fledge B&A API usage metrics is enabled */ getFledgeAuctionServerApiUsageMetricsEnabled()3965 default boolean getFledgeAuctionServerApiUsageMetricsEnabled() { 3966 return getFledgeAuctionServerEnabled() && FLEDGE_AUCTION_SERVER_API_USAGE_METRICS_ENABLED; 3967 } 3968 3969 // Fledge key fetch metrics flag. 3970 boolean FLEDGE_AUCTION_SERVER_KEY_FETCH_METRICS_ENABLED = false; 3971 3972 /** Returns whether the fledge auction server key fetch metrics feature is enabled */ getFledgeAuctionServerKeyFetchMetricsEnabled()3973 default boolean getFledgeAuctionServerKeyFetchMetricsEnabled() { 3974 return getFledgeAuctionServerEnabled() && FLEDGE_AUCTION_SERVER_KEY_FETCH_METRICS_ENABLED; 3975 } 3976 3977 // Fledge select ads from outcomes API metrics flag. 3978 @FeatureFlag boolean FLEDGE_SELECT_ADS_FROM_OUTCOMES_API_METRICS_ENABLED = false; 3979 3980 /** Returns whether the fledge select ads from outcomes API metrics feature is enabled */ getFledgeSelectAdsFromOutcomesApiMetricsEnabled()3981 default boolean getFledgeSelectAdsFromOutcomesApiMetricsEnabled() { 3982 return FLEDGE_SELECT_ADS_FROM_OUTCOMES_API_METRICS_ENABLED; 3983 } 3984 3985 // Fledge CPC billing metrics flag. 3986 @FeatureFlag boolean FLEDGE_CPC_BILLING_METRICS_ENABLED = false; 3987 3988 /** Returns whether the FLEDGE CPC billing metrics feature is enabled. */ getFledgeCpcBillingMetricsEnabled()3989 default boolean getFledgeCpcBillingMetricsEnabled() { 3990 return FLEDGE_CPC_BILLING_METRICS_ENABLED; 3991 } 3992 3993 // Fledge data version header metrics flag. 3994 @FeatureFlag boolean FLEDGE_DATA_VERSION_HEADER_METRICS_ENABLED = false; 3995 3996 /** Returns whether the FLEDGE data version header metrics feature is enabled. */ getFledgeDataVersionHeaderMetricsEnabled()3997 default boolean getFledgeDataVersionHeaderMetricsEnabled() { 3998 return FLEDGE_DATA_VERSION_HEADER_METRICS_ENABLED; 3999 } 4000 4001 // Fledge report impression API metrics flag. 4002 @FeatureFlag boolean FLEDGE_REPORT_IMPRESSION_API_METRICS_ENABLED = false; 4003 4004 /** Returns whether the FLEDGE report impression API metrics feature is enabled. */ getFledgeReportImpressionApiMetricsEnabled()4005 default boolean getFledgeReportImpressionApiMetricsEnabled() { 4006 return FLEDGE_REPORT_IMPRESSION_API_METRICS_ENABLED; 4007 } 4008 4009 // Fledge JS script result code metrics flag. 4010 @FeatureFlag boolean FLEDGE_JS_SCRIPT_RESULT_CODE_METRICS_ENABLED = false; 4011 4012 /** Returns whether the FLEDGE JS script result code metrics feature is enabled. */ getFledgeJsScriptResultCodeMetricsEnabled()4013 default boolean getFledgeJsScriptResultCodeMetricsEnabled() { 4014 return FLEDGE_JS_SCRIPT_RESULT_CODE_METRICS_ENABLED; 4015 } 4016 4017 /** 4018 * Default allowlist of the enrollments for whom debug key insertion based on join key matching 4019 * is allowed. 4020 */ 4021 String DEFAULT_MEASUREMENT_DEBUG_JOIN_KEY_ENROLLMENT_ALLOWLIST = ""; 4022 4023 /** 4024 * Allowlist of the enrollments for whom debug key insertion based on join key matching is 4025 * allowed. 4026 */ getMeasurementDebugJoinKeyEnrollmentAllowlist()4027 default String getMeasurementDebugJoinKeyEnrollmentAllowlist() { 4028 return DEFAULT_MEASUREMENT_DEBUG_JOIN_KEY_ENROLLMENT_ALLOWLIST; 4029 } 4030 4031 /** 4032 * Default blocklist of the enrollments for whom debug key insertion based on AdID matching is 4033 * blocked. 4034 */ 4035 String DEFAULT_MEASUREMENT_PLATFORM_DEBUG_AD_ID_MATCHING_BLOCKLIST = "*"; 4036 4037 /** 4038 * Blocklist of the enrollments for whom debug key insertion based on AdID matching is blocked. 4039 */ getMeasurementPlatformDebugAdIdMatchingEnrollmentBlocklist()4040 default String getMeasurementPlatformDebugAdIdMatchingEnrollmentBlocklist() { 4041 return DEFAULT_MEASUREMENT_PLATFORM_DEBUG_AD_ID_MATCHING_BLOCKLIST; 4042 } 4043 4044 /** Default computation of adservices version */ 4045 boolean DEFAULT_COMPUTE_VERSION_FROM_MAPPINGS_ENABLED = true; 4046 4047 /** Get Compute adservices Version from mappings */ getEnableComputeVersionFromMappings()4048 default boolean getEnableComputeVersionFromMappings() { 4049 return DEFAULT_COMPUTE_VERSION_FROM_MAPPINGS_ENABLED; 4050 } 4051 4052 /** Get mainline train version */ 4053 String DEFAULT_MAINLINE_TRAIN_VERSION = "000000"; 4054 4055 /** Get mainline train version */ getMainlineTrainVersion()4056 default String getMainlineTrainVersion() { 4057 return DEFAULT_MAINLINE_TRAIN_VERSION; 4058 } 4059 4060 /** 4061 * Default adservices version mappings Format - 4062 * start_range1,end_range1,header_version1|start_range2,end_range2,header_version2 4063 */ 4064 String DEFAULT_ADSERVICES_VERSION_MAPPINGS = 4065 "341300000,341400000,202401|341400000,341500000,202402" 4066 + "|341500000,341600000,202403|341600000,341700000,202404" 4067 + "|341700000,341800000,202405|341800000,341900000,202406" 4068 + "|341900000,342000000,202407|350800000,350900000,202408" 4069 + "|350900000,351000000,202409|351000000,351100000,202410" 4070 + "|351100000,351200000,202411|351200000,351300000,202412" 4071 + "|351300000,351400000,202501|351400000,351500000,202502" 4072 + "|351500000,351600000,202503|351600000,351700000,202504" 4073 + "|351700000,351800000,202505|351800000,351900000,202506"; 4074 4075 /** Get adservices version mappings */ getAdservicesVersionMappings()4076 default String getAdservicesVersionMappings() { 4077 return DEFAULT_ADSERVICES_VERSION_MAPPINGS; 4078 } 4079 4080 /** Default value for Measurement aggregatable named budgets */ 4081 @FeatureFlag boolean MEASUREMENT_ENABLE_AGGREGATABLE_NAMED_BUDGETS = false; 4082 4083 /** Returns whether to enable Measurement aggregatable named budgets */ getMeasurementEnableAggregatableNamedBudgets()4084 default boolean getMeasurementEnableAggregatableNamedBudgets() { 4085 return MEASUREMENT_ENABLE_AGGREGATABLE_NAMED_BUDGETS; 4086 } 4087 4088 /** Default value for Measurement V1 source trigger data */ 4089 @FeatureFlag boolean MEASUREMENT_ENABLE_V1_SOURCE_TRIGGER_DATA = false; 4090 4091 /** Returns whether to enable Measurement V1 source trigger data */ getMeasurementEnableV1SourceTriggerData()4092 default boolean getMeasurementEnableV1SourceTriggerData() { 4093 return MEASUREMENT_ENABLE_V1_SOURCE_TRIGGER_DATA; 4094 } 4095 4096 /** Default value for Measurement flexible event reporting API */ 4097 boolean MEASUREMENT_FLEXIBLE_EVENT_REPORTING_API_ENABLED = false; 4098 4099 /** Returns whether to enable Measurement flexible event reporting API */ getMeasurementFlexibleEventReportingApiEnabled()4100 default boolean getMeasurementFlexibleEventReportingApiEnabled() { 4101 return MEASUREMENT_FLEXIBLE_EVENT_REPORTING_API_ENABLED; 4102 } 4103 4104 /** Default value for Measurement trigger data matching */ 4105 boolean MEASUREMENT_ENABLE_TRIGGER_DATA_MATCHING = true; 4106 4107 /** Returns whether to enable Measurement trigger data matching */ getMeasurementEnableTriggerDataMatching()4108 default boolean getMeasurementEnableTriggerDataMatching() { 4109 return MEASUREMENT_ENABLE_TRIGGER_DATA_MATCHING; 4110 } 4111 4112 /** Default maximum sources per publisher */ 4113 int MEASUREMENT_MAX_SOURCES_PER_PUBLISHER = 4096; 4114 4115 /** Returns maximum sources per publisher */ getMeasurementMaxSourcesPerPublisher()4116 default int getMeasurementMaxSourcesPerPublisher() { 4117 return MEASUREMENT_MAX_SOURCES_PER_PUBLISHER; 4118 } 4119 4120 /** Default maximum triggers per destination */ 4121 int MEASUREMENT_MAX_TRIGGERS_PER_DESTINATION = 1024; 4122 4123 /** Returns maximum triggers per destination */ getMeasurementMaxTriggersPerDestination()4124 default int getMeasurementMaxTriggersPerDestination() { 4125 return MEASUREMENT_MAX_TRIGGERS_PER_DESTINATION; 4126 } 4127 4128 /** Default maximum Aggregate Reports per destination */ 4129 int MEASUREMENT_MAX_AGGREGATE_REPORTS_PER_DESTINATION = 1024; 4130 4131 /** Returns maximum Aggregate Reports per publisher */ getMeasurementMaxAggregateReportsPerDestination()4132 default int getMeasurementMaxAggregateReportsPerDestination() { 4133 return MEASUREMENT_MAX_AGGREGATE_REPORTS_PER_DESTINATION; 4134 } 4135 4136 /** Default maximum Event Reports per destination */ 4137 int MEASUREMENT_MAX_EVENT_REPORTS_PER_DESTINATION = 1024; 4138 4139 /** Returns maximum Event Reports per destination */ getMeasurementMaxEventReportsPerDestination()4140 default int getMeasurementMaxEventReportsPerDestination() { 4141 return MEASUREMENT_MAX_EVENT_REPORTS_PER_DESTINATION; 4142 } 4143 4144 /** Maximum Aggregate Reports per source. */ 4145 int MEASUREMENT_MAX_AGGREGATE_REPORTS_PER_SOURCE = 20; 4146 4147 /** Returns maximum Aggregate Reports per source. */ getMeasurementMaxAggregateReportsPerSource()4148 default int getMeasurementMaxAggregateReportsPerSource() { 4149 return MEASUREMENT_MAX_AGGREGATE_REPORTS_PER_SOURCE; 4150 } 4151 4152 /** Enable unbounded reports with trigger context id. */ 4153 @FeatureFlag boolean MEASUREMENT_ENABLE_UNBOUNDED_REPORTS_WITH_TRIGGER_CONTEXT_ID = false; 4154 4155 /** Returns if Measurement has enabled unbounded reports with trigger context ID. */ getMeasurementEnableUnboundedReportsWithTriggerContextId()4156 default boolean getMeasurementEnableUnboundedReportsWithTriggerContextId() { 4157 return MEASUREMENT_ENABLE_UNBOUNDED_REPORTS_WITH_TRIGGER_CONTEXT_ID; 4158 } 4159 4160 /** Maximum number of aggregation keys allowed during source registration. */ 4161 int MEASUREMENT_MAX_AGGREGATE_KEYS_PER_SOURCE_REGISTRATION = 50; 4162 4163 /** Returns maximum number of aggregation keys allowed during source registration. */ getMeasurementMaxAggregateKeysPerSourceRegistration()4164 default int getMeasurementMaxAggregateKeysPerSourceRegistration() { 4165 return MEASUREMENT_MAX_AGGREGATE_KEYS_PER_SOURCE_REGISTRATION; 4166 } 4167 4168 /** Maximum number of aggregation keys allowed during trigger registration. */ 4169 int MEASUREMENT_MAX_AGGREGATE_KEYS_PER_TRIGGER_REGISTRATION = 50; 4170 4171 /** Returns maximum number of aggregation keys allowed during trigger registration. */ getMeasurementMaxAggregateKeysPerTriggerRegistration()4172 default int getMeasurementMaxAggregateKeysPerTriggerRegistration() { 4173 return MEASUREMENT_MAX_AGGREGATE_KEYS_PER_TRIGGER_REGISTRATION; 4174 } 4175 4176 /** 4177 * Default early reporting windows for VTC type source. Derived from {@link 4178 * com.android.adservices.service.measurement.PrivacyParams#EVENT_EARLY_REPORTING_WINDOW_MILLISECONDS}. 4179 */ 4180 String MEASUREMENT_EVENT_REPORTS_VTC_EARLY_REPORTING_WINDOWS = ""; 4181 4182 /** 4183 * Returns configured comma separated early VTC based source's event reporting windows in 4184 * seconds. 4185 */ getMeasurementEventReportsVtcEarlyReportingWindows()4186 default String getMeasurementEventReportsVtcEarlyReportingWindows() { 4187 return MEASUREMENT_EVENT_REPORTS_VTC_EARLY_REPORTING_WINDOWS; 4188 } 4189 4190 /** 4191 * Default early reporting windows for CTC type source. Derived from {@link 4192 * com.android.adservices.service.measurement.PrivacyParams#NAVIGATION_EARLY_REPORTING_WINDOW_MILLISECONDS}. 4193 */ 4194 String MEASUREMENT_EVENT_REPORTS_CTC_EARLY_REPORTING_WINDOWS = 4195 String.join( 4196 ",", 4197 Long.toString(TimeUnit.DAYS.toSeconds(2)), 4198 Long.toString(TimeUnit.DAYS.toSeconds(7))); 4199 4200 /** 4201 * Returns configured comma separated early CTC based source's event reporting windows in 4202 * seconds. 4203 */ getMeasurementEventReportsCtcEarlyReportingWindows()4204 default String getMeasurementEventReportsCtcEarlyReportingWindows() { 4205 return MEASUREMENT_EVENT_REPORTS_CTC_EARLY_REPORTING_WINDOWS; 4206 } 4207 4208 /** 4209 * Default aggregate report delay. Derived from {@link 4210 * com.android.adservices.service.measurement.PrivacyParams#AGGREGATE_REPORT_MIN_DELAY} and 4211 * {@link com.android.adservices.service.measurement.PrivacyParams#AGGREGATE_REPORT_DELAY_SPAN}. 4212 */ 4213 String MEASUREMENT_AGGREGATE_REPORT_DELAY_CONFIG = 4214 String.join( 4215 ",", 4216 Long.toString(TimeUnit.MINUTES.toMillis(0L)), 4217 Long.toString(TimeUnit.MINUTES.toMillis(10L))); 4218 4219 /** 4220 * Returns configured comma separated aggregate report min delay and aggregate report delay 4221 * span. 4222 */ getMeasurementAggregateReportDelayConfig()4223 default String getMeasurementAggregateReportDelayConfig() { 4224 return MEASUREMENT_AGGREGATE_REPORT_DELAY_CONFIG; 4225 } 4226 4227 /** Default max allowed number of event reports. */ 4228 int DEFAULT_MEASUREMENT_VTC_CONFIGURABLE_MAX_EVENT_REPORTS_COUNT = 1; 4229 4230 /** Returns the default max allowed number of event reports. */ getMeasurementVtcConfigurableMaxEventReportsCount()4231 default int getMeasurementVtcConfigurableMaxEventReportsCount() { 4232 return DEFAULT_MEASUREMENT_VTC_CONFIGURABLE_MAX_EVENT_REPORTS_COUNT; 4233 } 4234 4235 boolean MEASUREMENT_ENABLE_FIFO_DESTINATIONS_DELETE_AGGREGATE_REPORTS = false; 4236 4237 /** 4238 * Enable deletion of reports along with FIFO destinations. In practice it's a sub flag to 4239 * {@link #getMeasurementEnableSourceDestinationLimitPriority()} 4240 */ getMeasurementEnableFifoDestinationsDeleteAggregateReports()4241 default boolean getMeasurementEnableFifoDestinationsDeleteAggregateReports() { 4242 return MEASUREMENT_ENABLE_FIFO_DESTINATIONS_DELETE_AGGREGATE_REPORTS; 4243 } 4244 4245 /** Default Measurement ARA parsing alignment v1 feature flag. */ 4246 boolean MEASUREMENT_ENABLE_ARA_DEDUPLICATION_ALIGNMENT_V1 = true; 4247 4248 /** Returns whether Measurement ARA deduplication alignment v1 feature is enabled. */ getMeasurementEnableAraDeduplicationAlignmentV1()4249 default boolean getMeasurementEnableAraDeduplicationAlignmentV1() { 4250 return MEASUREMENT_ENABLE_ARA_DEDUPLICATION_ALIGNMENT_V1; 4251 } 4252 4253 /** Default Measurement source deactivation after filtering feature flag. */ 4254 boolean MEASUREMENT_ENABLE_SOURCE_DEACTIVATION_AFTER_FILTERING = false; 4255 4256 /** Returns whether Measurement source deactivation after filtering feature is enabled. */ getMeasurementEnableSourceDeactivationAfterFiltering()4257 default boolean getMeasurementEnableSourceDeactivationAfterFiltering() { 4258 return MEASUREMENT_ENABLE_SOURCE_DEACTIVATION_AFTER_FILTERING; 4259 } 4260 4261 /** Default Measurement app package name logging flag. */ 4262 boolean MEASUREMENT_ENABLE_APP_PACKAGE_NAME_LOGGING = true; 4263 4264 /** Returns whether Measurement app package name logging is enabled. */ getMeasurementEnableAppPackageNameLogging()4265 default boolean getMeasurementEnableAppPackageNameLogging() { 4266 return MEASUREMENT_ENABLE_APP_PACKAGE_NAME_LOGGING; 4267 } 4268 4269 /** Default allowlist to enable app package name logging. */ 4270 String MEASUREMENT_APP_PACKAGE_NAME_LOGGING_ALLOWLIST = ""; 4271 4272 /** Returns a list of app package names that allows logging. */ getMeasurementAppPackageNameLoggingAllowlist()4273 default String getMeasurementAppPackageNameLoggingAllowlist() { 4274 return MEASUREMENT_APP_PACKAGE_NAME_LOGGING_ALLOWLIST; 4275 } 4276 4277 /** Disable measurement reporting jobs to throw unaccounted exceptions by default. */ 4278 boolean MEASUREMENT_ENABLE_REPORTING_JOBS_THROW_UNACCOUNTED_EXCEPTION = false; 4279 4280 /** 4281 * If enabled, measurement reporting jobs will throw unaccounted e.g. unexpected unchecked 4282 * exceptions. 4283 */ getMeasurementEnableReportingJobsThrowUnaccountedException()4284 default boolean getMeasurementEnableReportingJobsThrowUnaccountedException() { 4285 return MEASUREMENT_ENABLE_REPORTING_JOBS_THROW_UNACCOUNTED_EXCEPTION; 4286 } 4287 4288 /** 4289 * Disable measurement reporting jobs to throw {@link org.json.JSONException} exception by 4290 * default. 4291 */ 4292 boolean MEASUREMENT_ENABLE_REPORTING_JOBS_THROW_JSON_EXCEPTION = false; 4293 4294 /** If enabled, measurement reporting jobs will throw {@link org.json.JSONException}. */ getMeasurementEnableReportingJobsThrowJsonException()4295 default boolean getMeasurementEnableReportingJobsThrowJsonException() { 4296 return MEASUREMENT_ENABLE_REPORTING_JOBS_THROW_JSON_EXCEPTION; 4297 } 4298 4299 /** Disable measurement report to be deleted if any unrecoverable exception occurs. */ 4300 boolean MEASUREMENT_ENABLE_DELETE_REPORTS_ON_UNRECOVERABLE_EXCEPTION = false; 4301 4302 /** If enabled, measurement reports will get deleted if any unrecoverable exception occurs. */ getMeasurementEnableReportDeletionOnUnrecoverableException()4303 default boolean getMeasurementEnableReportDeletionOnUnrecoverableException() { 4304 return MEASUREMENT_ENABLE_DELETE_REPORTS_ON_UNRECOVERABLE_EXCEPTION; 4305 } 4306 4307 /** Disable measurement aggregate reporting jobs to throw {@code CryptoException} by default. */ 4308 boolean MEASUREMENT_ENABLE_REPORTING_JOBS_THROW_CRYPTO_EXCEPTION = false; 4309 4310 /** If enabled, measurement aggregate reporting job will throw {@code CryptoException}. */ getMeasurementEnableReportingJobsThrowCryptoException()4311 default boolean getMeasurementEnableReportingJobsThrowCryptoException() { 4312 return MEASUREMENT_ENABLE_REPORTING_JOBS_THROW_CRYPTO_EXCEPTION; 4313 } 4314 4315 /** 4316 * Disable measurement datastore to throw {@link 4317 * com.android.adservices.data.measurement.DatastoreException} when it occurs by default. 4318 */ 4319 boolean MEASUREMENT_ENABLE_DATASTORE_MANAGER_THROW_DATASTORE_EXCEPTION = false; 4320 4321 /** 4322 * If enabled, measurement DatastoreManager can throw DatastoreException wrapped in an unchecked 4323 * exception. 4324 */ getMeasurementEnableDatastoreManagerThrowDatastoreException()4325 default boolean getMeasurementEnableDatastoreManagerThrowDatastoreException() { 4326 return MEASUREMENT_ENABLE_DATASTORE_MANAGER_THROW_DATASTORE_EXCEPTION; 4327 } 4328 4329 /** Set the sampling rate to 100% for unknown exceptions to be re-thrown. */ 4330 float MEASUREMENT_THROW_UNKNOWN_EXCEPTION_SAMPLING_RATE = 1.0f; 4331 4332 /** Sampling rate to decide whether to throw unknown exceptions for measurement. */ getMeasurementThrowUnknownExceptionSamplingRate()4333 default float getMeasurementThrowUnknownExceptionSamplingRate() { 4334 return MEASUREMENT_THROW_UNKNOWN_EXCEPTION_SAMPLING_RATE; 4335 } 4336 4337 boolean MEASUREMENT_DELETE_UNINSTALLED_JOB_PERSISTED = true; 4338 4339 /** Returns whether to persist this job across device reboots for delete uninstalled job. */ getMeasurementDeleteUninstalledJobPersisted()4340 default boolean getMeasurementDeleteUninstalledJobPersisted() { 4341 return MEASUREMENT_DELETE_UNINSTALLED_JOB_PERSISTED; 4342 } 4343 4344 long MEASUREMENT_DELETE_UNINSTALLED_JOB_PERIOD_MS = TimeUnit.HOURS.toMillis(24); 4345 4346 /** 4347 * Returns the min time period (in millis) between each uninstalled-record deletion maintenance 4348 * job run. 4349 */ getMeasurementDeleteUninstalledJobPeriodMs()4350 default long getMeasurementDeleteUninstalledJobPeriodMs() { 4351 return MEASUREMENT_DELETE_UNINSTALLED_JOB_PERIOD_MS; 4352 } 4353 4354 boolean MEASUREMENT_DELETE_EXPIRED_JOB_PERSISTED = true; 4355 4356 /** Returns whether to persist this job across device reboots for delete expired job. */ getMeasurementDeleteExpiredJobPersisted()4357 default boolean getMeasurementDeleteExpiredJobPersisted() { 4358 return MEASUREMENT_DELETE_EXPIRED_JOB_PERSISTED; 4359 } 4360 4361 boolean MEASUREMENT_DELETE_EXPIRED_JOB_REQUIRES_DEVICE_IDLE = true; 4362 4363 /** Returns whether to require device to be idle for delete expired job. */ getMeasurementDeleteExpiredJobRequiresDeviceIdle()4364 default boolean getMeasurementDeleteExpiredJobRequiresDeviceIdle() { 4365 return MEASUREMENT_DELETE_EXPIRED_JOB_REQUIRES_DEVICE_IDLE; 4366 } 4367 4368 long MEASUREMENT_DELETE_EXPIRED_JOB_PERIOD_MS = TimeUnit.HOURS.toMillis(24); 4369 4370 /** 4371 * Returns the min time period (in millis) between each expired-record deletion maintenance job 4372 * run. 4373 */ getMeasurementDeleteExpiredJobPeriodMs()4374 default long getMeasurementDeleteExpiredJobPeriodMs() { 4375 return MEASUREMENT_DELETE_EXPIRED_JOB_PERIOD_MS; 4376 } 4377 4378 boolean MEASUREMENT_EVENT_REPORTING_JOB_REQUIRED_BATTERY_NOT_LOW = true; 4379 4380 /** Returns whether to require battery not low for event reporting job . */ getMeasurementEventReportingJobRequiredBatteryNotLow()4381 default boolean getMeasurementEventReportingJobRequiredBatteryNotLow() { 4382 return MEASUREMENT_EVENT_REPORTING_JOB_REQUIRED_BATTERY_NOT_LOW; 4383 } 4384 4385 int MEASUREMENT_EVENT_REPORTING_JOB_REQUIRED_NETWORK_TYPE = JobInfo.NETWORK_TYPE_UNMETERED; 4386 4387 /** Returns the required network type for event reporting job . */ getMeasurementEventReportingJobRequiredNetworkType()4388 default int getMeasurementEventReportingJobRequiredNetworkType() { 4389 return MEASUREMENT_EVENT_REPORTING_JOB_REQUIRED_NETWORK_TYPE; 4390 } 4391 4392 boolean MEASUREMENT_EVENT_REPORTING_JOB_PERSISTED = true; 4393 4394 /** Returns whether to persist this job across device reboots for event reporting job. */ getMeasurementEventReportingJobPersisted()4395 default boolean getMeasurementEventReportingJobPersisted() { 4396 return MEASUREMENT_EVENT_REPORTING_JOB_PERSISTED; 4397 } 4398 4399 boolean MEASUREMENT_EVENT_FALLBACK_REPORTING_JOB_REQUIRED_BATTERY_NOT_LOW = true; 4400 4401 /** Returns whether to require battery not low for event fallback reporting job . */ getMeasurementEventFallbackReportingJobRequiredBatteryNotLow()4402 default boolean getMeasurementEventFallbackReportingJobRequiredBatteryNotLow() { 4403 return MEASUREMENT_EVENT_FALLBACK_REPORTING_JOB_REQUIRED_BATTERY_NOT_LOW; 4404 } 4405 4406 int MEASUREMENT_EVENT_FALLBACK_REPORTING_JOB_REQUIRED_NETWORK_TYPE = JobInfo.NETWORK_TYPE_ANY; 4407 4408 /** Returns the required network type for event fallback reporting job . */ getMeasurementEventFallbackReportingJobRequiredNetworkType()4409 default int getMeasurementEventFallbackReportingJobRequiredNetworkType() { 4410 return MEASUREMENT_EVENT_FALLBACK_REPORTING_JOB_REQUIRED_NETWORK_TYPE; 4411 } 4412 4413 boolean MEASUREMENT_EVENT_FALLBACK_REPORTING_JOB_PERSISTED = true; 4414 4415 /** 4416 * Returns whether to persist this job across device reboots for event fallback reporting job. 4417 */ getMeasurementEventFallbackReportingJobPersisted()4418 default boolean getMeasurementEventFallbackReportingJobPersisted() { 4419 return MEASUREMENT_EVENT_FALLBACK_REPORTING_JOB_PERSISTED; 4420 } 4421 4422 int MEASUREMENT_DEBUG_REPORTING_JOB_REQUIRED_NETWORK_TYPE = JobInfo.NETWORK_TYPE_ANY; 4423 4424 /** Returns the required network type for debug reporting job . */ getMeasurementDebugReportingJobRequiredNetworkType()4425 default int getMeasurementDebugReportingJobRequiredNetworkType() { 4426 return MEASUREMENT_DEBUG_REPORTING_JOB_REQUIRED_NETWORK_TYPE; 4427 } 4428 4429 int MEASUREMENT_DEBUG_REPORTING_FALLBACK_JOB_REQUIRED_NETWORK_TYPE = JobInfo.NETWORK_TYPE_ANY; 4430 4431 /** Returns the required network type for debug reporting fallback job . */ getMeasurementDebugReportingFallbackJobRequiredNetworkType()4432 default int getMeasurementDebugReportingFallbackJobRequiredNetworkType() { 4433 return MEASUREMENT_DEBUG_REPORTING_FALLBACK_JOB_REQUIRED_NETWORK_TYPE; 4434 } 4435 4436 boolean MEASUREMENT_DEBUG_REPORTING_FALLBACK_JOB_PERSISTED = true; 4437 4438 /** 4439 * Returns whether to persist this job across device reboots for debug fallback reporting job. 4440 */ getMeasurementDebugReportingFallbackJobPersisted()4441 default boolean getMeasurementDebugReportingFallbackJobPersisted() { 4442 return MEASUREMENT_DEBUG_REPORTING_FALLBACK_JOB_PERSISTED; 4443 } 4444 4445 int MEASUREMENT_VERBOSE_DEBUG_REPORTING_JOB_REQUIRED_NETWORK_TYPE = JobInfo.NETWORK_TYPE_ANY; 4446 4447 /** Returns the required network type for verbose debug reporting job . */ getMeasurementVerboseDebugReportingJobRequiredNetworkType()4448 default int getMeasurementVerboseDebugReportingJobRequiredNetworkType() { 4449 return MEASUREMENT_VERBOSE_DEBUG_REPORTING_JOB_REQUIRED_NETWORK_TYPE; 4450 } 4451 4452 boolean MEASUREMENT_VERBOSE_DEBUG_REPORTING_FALLBACK_JOB_PERSISTED = true; 4453 4454 /** 4455 * Returns whether to persist this job across device reboots for verbose debug fallback 4456 * reporting job. 4457 */ getMeasurementVerboseDebugReportingFallbackJobPersisted()4458 default boolean getMeasurementVerboseDebugReportingFallbackJobPersisted() { 4459 return MEASUREMENT_VERBOSE_DEBUG_REPORTING_FALLBACK_JOB_PERSISTED; 4460 } 4461 4462 boolean MEASUREMENT_ATTRIBUTION_JOB_PERSISTED = false; 4463 4464 /** Returns whether to persist this job across device reboots for attribution job. */ getMeasurementAttributionJobPersisted()4465 default boolean getMeasurementAttributionJobPersisted() { 4466 return MEASUREMENT_ATTRIBUTION_JOB_PERSISTED; 4467 } 4468 4469 long MEASUREMENT_ATTRIBUTION_JOB_TRIGGERING_DELAY_MS = TimeUnit.MINUTES.toMillis(2); 4470 4471 /** Minimum delay for attribution job triggering. */ getMeasurementAttributionJobTriggeringDelayMs()4472 default long getMeasurementAttributionJobTriggeringDelayMs() { 4473 return MEASUREMENT_ATTRIBUTION_JOB_TRIGGERING_DELAY_MS; 4474 } 4475 4476 @ConfigFlag 4477 long MEASUREMENT_ATTRIBUTION_JOB_TRIGGERING_MAX_DELAY_MS = TimeUnit.MINUTES.toMillis(5); 4478 4479 /** Maximum delay for attribution job triggering. */ getMeasurementAttributionJobTriggeringMaxDelayMs()4480 default long getMeasurementAttributionJobTriggeringMaxDelayMs() { 4481 return MEASUREMENT_ATTRIBUTION_JOB_TRIGGERING_MAX_DELAY_MS; 4482 } 4483 4484 boolean MEASUREMENT_ATTRIBUTION_FALLBACK_JOB_PERSISTED = true; 4485 4486 /** Returns whether to persist this job across device reboots for attribution fallback job. */ getMeasurementAttributionFallbackJobPersisted()4487 default boolean getMeasurementAttributionFallbackJobPersisted() { 4488 return MEASUREMENT_ATTRIBUTION_FALLBACK_JOB_PERSISTED; 4489 } 4490 4491 int MEASUREMENT_ASYNC_REGISTRATION_QUEUE_JOB_REQUIRED_NETWORK_TYPE = JobInfo.NETWORK_TYPE_ANY; 4492 4493 /** Returns the required network type for async registration queue job. */ getMeasurementAsyncRegistrationQueueJobRequiredNetworkType()4494 default int getMeasurementAsyncRegistrationQueueJobRequiredNetworkType() { 4495 return MEASUREMENT_ASYNC_REGISTRATION_QUEUE_JOB_REQUIRED_NETWORK_TYPE; 4496 } 4497 4498 boolean MEASUREMENT_ASYNC_REGISTRATION_QUEUE_JOB_PERSISTED = false; 4499 4500 /** 4501 * Returns whether to persist this job across device reboots for async registration queue job. 4502 */ getMeasurementAsyncRegistrationQueueJobPersisted()4503 default boolean getMeasurementAsyncRegistrationQueueJobPersisted() { 4504 return MEASUREMENT_ASYNC_REGISTRATION_QUEUE_JOB_PERSISTED; 4505 } 4506 4507 boolean MEASUREMENT_ASYNC_REGISTRATION_FALLBACK_JOB_REQUIRED_BATTERY_NOT_LOW = true; 4508 4509 /** Returns whether to require battery not low for async registration queue fallback job. */ getMeasurementAsyncRegistrationFallbackJobRequiredBatteryNotLow()4510 default boolean getMeasurementAsyncRegistrationFallbackJobRequiredBatteryNotLow() { 4511 return MEASUREMENT_ASYNC_REGISTRATION_FALLBACK_JOB_REQUIRED_BATTERY_NOT_LOW; 4512 } 4513 4514 int MEASUREMENT_ASYNC_REGISTRATION_FALLBACK_JOB_REQUIRED_NETWORK_TYPE = 4515 JobInfo.NETWORK_TYPE_ANY; 4516 4517 /** Returns the required network type for async registration queue fallback job. */ getMeasurementAsyncRegistrationFallbackJobRequiredNetworkType()4518 default int getMeasurementAsyncRegistrationFallbackJobRequiredNetworkType() { 4519 return MEASUREMENT_ASYNC_REGISTRATION_FALLBACK_JOB_REQUIRED_NETWORK_TYPE; 4520 } 4521 4522 boolean MEASUREMENT_ASYNC_REGISTRATION_FALLBACK_JOB_PERSISTED = true; 4523 4524 /** 4525 * Returns whether to persist this job across device reboots for async registration queue 4526 * fallback job. 4527 */ getMeasurementAsyncRegistrationFallbackJobPersisted()4528 default boolean getMeasurementAsyncRegistrationFallbackJobPersisted() { 4529 return MEASUREMENT_ASYNC_REGISTRATION_FALLBACK_JOB_PERSISTED; 4530 } 4531 4532 boolean MEASUREMENT_AGGREGATE_REPORTING_JOB_REQUIRED_BATTERY_NOT_LOW = true; 4533 4534 /** Returns whether to require battery not low for aggregate reporting job. */ getMeasurementAggregateReportingJobRequiredBatteryNotLow()4535 default boolean getMeasurementAggregateReportingJobRequiredBatteryNotLow() { 4536 return MEASUREMENT_AGGREGATE_REPORTING_JOB_REQUIRED_BATTERY_NOT_LOW; 4537 } 4538 4539 int MEASUREMENT_AGGREGATE_REPORTING_JOB_REQUIRED_NETWORK_TYPE = JobInfo.NETWORK_TYPE_UNMETERED; 4540 4541 /** Returns the required network type for aggregate reporting job. */ getMeasurementAggregateReportingJobRequiredNetworkType()4542 default int getMeasurementAggregateReportingJobRequiredNetworkType() { 4543 return MEASUREMENT_AGGREGATE_REPORTING_JOB_REQUIRED_NETWORK_TYPE; 4544 } 4545 4546 boolean MEASUREMENT_AGGREGATE_REPORTING_JOB_PERSISTED = true; 4547 4548 /** Returns whether to persist this job across device reboots for aggregate reporting job. */ getMeasurementAggregateReportingJobPersisted()4549 default boolean getMeasurementAggregateReportingJobPersisted() { 4550 return MEASUREMENT_AGGREGATE_REPORTING_JOB_PERSISTED; 4551 } 4552 4553 boolean MEASUREMENT_AGGREGATE_FALLBACK_REPORTING_JOB_REQUIRED_BATTERY_NOT_LOW = true; 4554 4555 /** Returns whether to require battery not low for aggregate fallback reporting job. */ getMeasurementAggregateFallbackReportingJobRequiredBatteryNotLow()4556 default boolean getMeasurementAggregateFallbackReportingJobRequiredBatteryNotLow() { 4557 return MEASUREMENT_AGGREGATE_FALLBACK_REPORTING_JOB_REQUIRED_BATTERY_NOT_LOW; 4558 } 4559 4560 int MEASUREMENT_AGGREGATE_FALLBACK_REPORTING_JOB_REQUIRED_NETWORK_TYPE = 4561 JobInfo.NETWORK_TYPE_ANY; 4562 4563 /** Returns the required network type for aggregate fallback reporting job . */ getMeasurementAggregateFallbackReportingJobRequiredNetworkType()4564 default int getMeasurementAggregateFallbackReportingJobRequiredNetworkType() { 4565 return MEASUREMENT_AGGREGATE_FALLBACK_REPORTING_JOB_REQUIRED_NETWORK_TYPE; 4566 } 4567 4568 boolean MEASUREMENT_AGGREGATE_FALLBACK_REPORTING_JOB_PERSISTED = true; 4569 4570 /** 4571 * Returns whether to persist this job across device reboots for aggregate fallback reporting 4572 * job. 4573 */ getMeasurementAggregateFallbackReportingJobPersisted()4574 default boolean getMeasurementAggregateFallbackReportingJobPersisted() { 4575 return MEASUREMENT_AGGREGATE_FALLBACK_REPORTING_JOB_PERSISTED; 4576 } 4577 4578 boolean MEASUREMENT_IMMEDIATE_AGGREGATE_REPORTING_JOB_REQUIRED_BATTERY_NOT_LOW = true; 4579 4580 /** Returns whether to require battery not low for immediate aggregate reporting job. */ getMeasurementImmediateAggregateReportingJobRequiredBatteryNotLow()4581 default boolean getMeasurementImmediateAggregateReportingJobRequiredBatteryNotLow() { 4582 return MEASUREMENT_IMMEDIATE_AGGREGATE_REPORTING_JOB_REQUIRED_BATTERY_NOT_LOW; 4583 } 4584 4585 int MEASUREMENT_IMMEDIATE_AGGREGATE_REPORTING_JOB_REQUIRED_NETWORK_TYPE = 4586 JobInfo.NETWORK_TYPE_ANY; 4587 4588 /** Returns the required network type for immediate aggregate reporting job. */ getMeasurementImmediateAggregateReportingJobRequiredNetworkType()4589 default int getMeasurementImmediateAggregateReportingJobRequiredNetworkType() { 4590 return MEASUREMENT_IMMEDIATE_AGGREGATE_REPORTING_JOB_REQUIRED_NETWORK_TYPE; 4591 } 4592 4593 boolean MEASUREMENT_IMMEDIATE_AGGREGATE_REPORTING_JOB_PERSISTED = true; 4594 4595 /** Returns whether to persist immediate aggregate reporting job across device reboots. */ getMeasurementImmediateAggregateReportingJobPersisted()4596 default boolean getMeasurementImmediateAggregateReportingJobPersisted() { 4597 return MEASUREMENT_IMMEDIATE_AGGREGATE_REPORTING_JOB_PERSISTED; 4598 } 4599 4600 /** Default value for Reporting Job feature flag */ 4601 @FeatureFlag boolean MEASUREMENT_REPORTING_JOB_ENABLED = false; 4602 4603 /** Feature flag for Reporting Job */ getMeasurementReportingJobServiceEnabled()4604 default boolean getMeasurementReportingJobServiceEnabled() { 4605 // The Measurement API should be enabled as a prerequisite. 4606 return getMeasurementEnabled() && MEASUREMENT_REPORTING_JOB_ENABLED; 4607 } 4608 4609 @ConfigFlag boolean MEASUREMENT_REPORTING_JOB_REQUIRED_BATTERY_NOT_LOW = true; 4610 4611 /** Returns whether to require battery not low for reporting job. */ getMeasurementReportingJobRequiredBatteryNotLow()4612 default boolean getMeasurementReportingJobRequiredBatteryNotLow() { 4613 return MEASUREMENT_REPORTING_JOB_REQUIRED_BATTERY_NOT_LOW; 4614 } 4615 4616 @ConfigFlag int MEASUREMENT_REPORTING_JOB_REQUIRED_NETWORK_TYPE = JobInfo.NETWORK_TYPE_ANY; 4617 4618 /** Returns the required network type for reporting job. */ getMeasurementReportingJobRequiredNetworkType()4619 default int getMeasurementReportingJobRequiredNetworkType() { 4620 return MEASUREMENT_REPORTING_JOB_REQUIRED_NETWORK_TYPE; 4621 } 4622 4623 @ConfigFlag boolean MEASUREMENT_REPORTING_JOB_PERSISTED = true; 4624 4625 /** Returns whether to persist this job across device reboots for reporting job. */ getMeasurementReportingJobPersisted()4626 default boolean getMeasurementReportingJobPersisted() { 4627 return MEASUREMENT_REPORTING_JOB_PERSISTED; 4628 } 4629 4630 /** 4631 * Default value for delaying reporting job service so that reports can be batched. Values are 4632 * in milliseconds. 4633 */ 4634 @ConfigFlag 4635 long MEASUREMENT_REPORTING_JOB_SERVICE_BATCH_WINDOW_MILLIS = TimeUnit.MINUTES.toMillis(30); 4636 4637 /** 4638 * Returns ms to defer transmission of reports in {@link 4639 * com.android.adservices.service.measurement.reporting.ReportingJobService} 4640 */ getMeasurementReportingJobServiceBatchWindowMillis()4641 default long getMeasurementReportingJobServiceBatchWindowMillis() { 4642 return MEASUREMENT_REPORTING_JOB_SERVICE_BATCH_WINDOW_MILLIS; 4643 } 4644 4645 /** 4646 * Default value for minimum amount of time to wait between executions of reporting job service. 4647 * This is to throttle the service. Values are in milliseconds. 4648 */ 4649 @ConfigFlag 4650 long MEASUREMENT_REPORTING_JOB_SERVICE_MIN_EXECUTION_WINDOW_MILLIS = 4651 TimeUnit.MINUTES.toMillis(30); 4652 4653 /** 4654 * Returns minimum ms to wait between invocations of {@link 4655 * com.android.adservices.service.measurement.reporting.ReportingJobService} 4656 */ getMeasurementReportingJobServiceMinExecutionWindowMillis()4657 default long getMeasurementReportingJobServiceMinExecutionWindowMillis() { 4658 return MEASUREMENT_REPORTING_JOB_SERVICE_MIN_EXECUTION_WINDOW_MILLIS; 4659 } 4660 4661 /** Default value for null aggregate report rate including source registration time. */ 4662 float MEASUREMENT_NULL_AGG_REPORT_RATE_INCL_SOURCE_REGISTRATION_TIME = .008f; 4663 4664 /** 4665 * Returns the rate at which null aggregate reports are generated whenever an actual aggregate 4666 * report is successfully generated. 4667 */ getMeasurementNullAggReportRateInclSourceRegistrationTime()4668 default float getMeasurementNullAggReportRateInclSourceRegistrationTime() { 4669 return MEASUREMENT_NULL_AGG_REPORT_RATE_INCL_SOURCE_REGISTRATION_TIME; 4670 } 4671 4672 /** Default value for null report rate excluding source registration time. */ 4673 float MEASUREMENT_NULL_AGG_REPORT_RATE_EXCL_SOURCE_REGISTRATION_TIME = .05f; 4674 4675 /** 4676 * Returns the rate at which null aggregate reports are generated whenever the trigger is 4677 * configured to exclude the source registration time and there is no matching source. 4678 */ getMeasurementNullAggReportRateExclSourceRegistrationTime()4679 default float getMeasurementNullAggReportRateExclSourceRegistrationTime() { 4680 return MEASUREMENT_NULL_AGG_REPORT_RATE_EXCL_SOURCE_REGISTRATION_TIME; 4681 } 4682 4683 /** Default U18 UX feature flag. */ 4684 boolean DEFAULT_U18_UX_ENABLED = false; 4685 4686 /** U18 UX feature flag.. */ getU18UxEnabled()4687 default boolean getU18UxEnabled() { 4688 return DEFAULT_U18_UX_ENABLED; 4689 } 4690 4691 /** Default enableAdServices system API feature flag.. */ 4692 boolean DEFAULT_ENABLE_AD_SERVICES_SYSTEM_API = false; 4693 4694 /** enableAdServices system API feature flag.. */ getEnableAdServicesSystemApi()4695 default boolean getEnableAdServicesSystemApi() { 4696 return DEFAULT_ENABLE_AD_SERVICES_SYSTEM_API; 4697 } 4698 4699 /** Disables client error logging for the list of error codes. Default value is empty list. */ 4700 ImmutableList<Integer> ERROR_CODE_LOGGING_DENY_LIST = ImmutableList.of(); 4701 4702 /** Returns a list of error codes for which we don't want to do error logging. */ getErrorCodeLoggingDenyList()4703 default ImmutableList<Integer> getErrorCodeLoggingDenyList() { 4704 return ERROR_CODE_LOGGING_DENY_LIST; 4705 } 4706 4707 /** Returns the map of UX flags. */ getUxFlags()4708 default Map<String, Boolean> getUxFlags() { 4709 return new HashMap<>(); 4710 } 4711 4712 /** Enable feature to unify destinations for event reports by default. */ 4713 boolean DEFAULT_MEASUREMENT_ENABLE_COARSE_EVENT_REPORT_DESTINATIONS = true; 4714 4715 /** 4716 * Returns true if event reporting destinations are enabled to be reported in a coarse manner, 4717 * i.e. both app and web destinations are merged into a single array in the event report. 4718 */ getMeasurementEnableCoarseEventReportDestinations()4719 default boolean getMeasurementEnableCoarseEventReportDestinations() { 4720 return DEFAULT_MEASUREMENT_ENABLE_COARSE_EVENT_REPORT_DESTINATIONS; 4721 } 4722 4723 /** Privacy Params */ 4724 int MEASUREMENT_MAX_DISTINCT_WEB_DESTINATIONS_IN_SOURCE_REGISTRATION = 3; 4725 4726 /** Max distinct web destinations in a source registration. */ getMeasurementMaxDistinctWebDestinationsInSourceRegistration()4727 default int getMeasurementMaxDistinctWebDestinationsInSourceRegistration() { 4728 return MEASUREMENT_MAX_DISTINCT_WEB_DESTINATIONS_IN_SOURCE_REGISTRATION; 4729 } 4730 4731 long MEASUREMENT_MAX_REPORTING_REGISTER_SOURCE_EXPIRATION_IN_SECONDS = 4732 TimeUnit.DAYS.toSeconds(30); 4733 4734 /** 4735 * Max expiration value in seconds for attribution reporting register source. This value is also 4736 * the default if no expiration was specified. 4737 */ getMeasurementMaxReportingRegisterSourceExpirationInSeconds()4738 default long getMeasurementMaxReportingRegisterSourceExpirationInSeconds() { 4739 return MEASUREMENT_MAX_REPORTING_REGISTER_SOURCE_EXPIRATION_IN_SECONDS; 4740 } 4741 4742 long MEASUREMENT_MIN_REPORTING_REGISTER_SOURCE_EXPIRATION_IN_SECONDS = 4743 TimeUnit.DAYS.toSeconds(1); 4744 4745 /** Min expiration value in seconds for attribution reporting register source. */ getMeasurementMinReportingRegisterSourceExpirationInSeconds()4746 default long getMeasurementMinReportingRegisterSourceExpirationInSeconds() { 4747 return MEASUREMENT_MIN_REPORTING_REGISTER_SOURCE_EXPIRATION_IN_SECONDS; 4748 } 4749 4750 long MEASUREMENT_MAX_INSTALL_ATTRIBUTION_WINDOW = TimeUnit.DAYS.toSeconds(30); 4751 4752 /** Maximum limit of duration to determine attribution for a verified installation. */ getMeasurementMaxInstallAttributionWindow()4753 default long getMeasurementMaxInstallAttributionWindow() { 4754 return MEASUREMENT_MAX_INSTALL_ATTRIBUTION_WINDOW; 4755 } 4756 4757 long MEASUREMENT_MIN_INSTALL_ATTRIBUTION_WINDOW = TimeUnit.DAYS.toSeconds(1); 4758 4759 /** Minimum limit of duration to determine attribution for a verified installation. */ getMeasurementMinInstallAttributionWindow()4760 default long getMeasurementMinInstallAttributionWindow() { 4761 return MEASUREMENT_MIN_INSTALL_ATTRIBUTION_WINDOW; 4762 } 4763 4764 long MEASUREMENT_MAX_POST_INSTALL_EXCLUSIVITY_WINDOW = TimeUnit.DAYS.toSeconds(30); 4765 4766 /** Maximum acceptable install cooldown period. */ getMeasurementMaxPostInstallExclusivityWindow()4767 default long getMeasurementMaxPostInstallExclusivityWindow() { 4768 return MEASUREMENT_MAX_POST_INSTALL_EXCLUSIVITY_WINDOW; 4769 } 4770 4771 long MEASUREMENT_MIN_POST_INSTALL_EXCLUSIVITY_WINDOW = 0L; 4772 4773 /** Default and minimum value for cooldown period of source which led to installation. */ getMeasurementMinPostInstallExclusivityWindow()4774 default long getMeasurementMinPostInstallExclusivityWindow() { 4775 return MEASUREMENT_MIN_POST_INSTALL_EXCLUSIVITY_WINDOW; 4776 } 4777 4778 int MEASUREMENT_MAX_SUM_OF_AGGREGATE_VALUES_PER_SOURCE = 65536; 4779 4780 /** 4781 * L1, the maximum sum of the contributions (values) across all buckets for a given source 4782 * event. 4783 */ getMeasurementMaxSumOfAggregateValuesPerSource()4784 default int getMeasurementMaxSumOfAggregateValuesPerSource() { 4785 return MEASUREMENT_MAX_SUM_OF_AGGREGATE_VALUES_PER_SOURCE; 4786 } 4787 4788 long MEASUREMENT_RATE_LIMIT_WINDOW_MILLISECONDS = TimeUnit.DAYS.toMillis(30); 4789 4790 /** 4791 * Rate limit window for (Source Site, Destination Site, Reporting Site, Window) privacy unit. 4792 * 30 days. 4793 */ getMeasurementRateLimitWindowMilliseconds()4794 default long getMeasurementRateLimitWindowMilliseconds() { 4795 return MEASUREMENT_RATE_LIMIT_WINDOW_MILLISECONDS; 4796 } 4797 4798 long MEASUREMENT_MIN_REPORTING_ORIGIN_UPDATE_WINDOW = TimeUnit.DAYS.toMillis(1); 4799 4800 /** Minimum time window after which reporting origin can be migrated */ getMeasurementMinReportingOriginUpdateWindow()4801 default long getMeasurementMinReportingOriginUpdateWindow() { 4802 return MEASUREMENT_MIN_REPORTING_ORIGIN_UPDATE_WINDOW; 4803 } 4804 4805 boolean MEASUREMENT_ENABLE_PREINSTALL_CHECK = false; 4806 4807 /** Returns true when pre-install check is enabled. */ getMeasurementEnablePreinstallCheck()4808 default boolean getMeasurementEnablePreinstallCheck() { 4809 return MEASUREMENT_ENABLE_PREINSTALL_CHECK; 4810 } 4811 4812 /** Default value of flag for session stable kill switches. */ 4813 @SuppressWarnings("AvoidKillSwitchFlagUsage") // Legacy kill switch flag 4814 boolean MEASUREMENT_ENABLE_SESSION_STABLE_KILL_SWITCHES = true; 4815 4816 /** Returns true when session stable kill switches are enabled. */ getMeasurementEnableSessionStableKillSwitches()4817 default boolean getMeasurementEnableSessionStableKillSwitches() { 4818 return MEASUREMENT_ENABLE_SESSION_STABLE_KILL_SWITCHES; 4819 } 4820 4821 boolean MEASUREMENT_ENABLE_ATTRIBUTION_SCOPE = false; 4822 4823 /** Returns true when attribution scope is enabled. */ getMeasurementEnableAttributionScope()4824 default boolean getMeasurementEnableAttributionScope() { 4825 return MEASUREMENT_ENABLE_ATTRIBUTION_SCOPE; 4826 } 4827 4828 boolean MEASUREMENT_ENABLE_NAVIGATION_REPORTING_ORIGIN_CHECK = false; 4829 4830 /** 4831 * Returns true if validation is enabled for one navigation per reporting origin per 4832 * registration. 4833 */ getMeasurementEnableNavigationReportingOriginCheck()4834 default boolean getMeasurementEnableNavigationReportingOriginCheck() { 4835 return MEASUREMENT_ENABLE_NAVIGATION_REPORTING_ORIGIN_CHECK; 4836 } 4837 4838 @FeatureFlag 4839 boolean MEASUREMENT_ENABLE_SEPARATE_DEBUG_REPORT_TYPES_FOR_ATTRIBUTION_RATE_LIMIT = false; 4840 4841 /** 4842 * Enables separate debug report types for event and aggregate attribution rate limit 4843 * violations. 4844 */ getMeasurementEnableSeparateDebugReportTypesForAttributionRateLimit()4845 default boolean getMeasurementEnableSeparateDebugReportTypesForAttributionRateLimit() { 4846 return MEASUREMENT_ENABLE_SEPARATE_DEBUG_REPORT_TYPES_FOR_ATTRIBUTION_RATE_LIMIT; 4847 } 4848 4849 int MEASUREMENT_MAX_ATTRIBUTION_SCOPES_PER_SOURCE = 20; 4850 4851 /** Returns max number of attribution scopes per source. */ getMeasurementMaxAttributionScopesPerSource()4852 default int getMeasurementMaxAttributionScopesPerSource() { 4853 return MEASUREMENT_MAX_ATTRIBUTION_SCOPES_PER_SOURCE; 4854 } 4855 4856 int MEASUREMENT_MAX_ATTRIBUTION_SCOPE_LENGTH = 50; 4857 4858 /** Returns max length of attribution scope. */ getMeasurementMaxAttributionScopeLength()4859 default int getMeasurementMaxAttributionScopeLength() { 4860 return MEASUREMENT_MAX_ATTRIBUTION_SCOPE_LENGTH; 4861 } 4862 4863 @ConfigFlag int MEASUREMENT_MAX_LENGTH_PER_BUDGET_NAME = 25; 4864 4865 /** Returns max length of an attribution source's named budget's name. */ getMeasurementMaxLengthPerBudgetName()4866 default int getMeasurementMaxLengthPerBudgetName() { 4867 return MEASUREMENT_MAX_LENGTH_PER_BUDGET_NAME; 4868 } 4869 4870 @ConfigFlag int MEASUREMENT_MAX_NAMED_BUDGETS_PER_SOURCE_REGISTRATION = 25; 4871 4872 /** Returns max size of an attribution source's named budget list. */ getMeasurementMaxNamedBudgetsPerSourceRegistration()4873 default int getMeasurementMaxNamedBudgetsPerSourceRegistration() { 4874 return MEASUREMENT_MAX_NAMED_BUDGETS_PER_SOURCE_REGISTRATION; 4875 } 4876 4877 /** Default value of flag for logging consent migration metrics when OTA from S to T+. */ 4878 boolean DEFAULT_ADSERVICES_CONSENT_MIGRATION_LOGGING_ENABLED = true; 4879 4880 /*** 4881 * Returns true when logging consent migration metrics is enabled when OTA from S to T+. 4882 */ getAdservicesConsentMigrationLoggingEnabled()4883 default boolean getAdservicesConsentMigrationLoggingEnabled() { 4884 return DEFAULT_ADSERVICES_CONSENT_MIGRATION_LOGGING_ENABLED; 4885 } 4886 4887 /** The default token for resetting consent notificatio.. */ 4888 String CONSENT_NOTIFICATION_RESET_TOKEN = ""; 4889 4890 /** Returns the consent notification reset token. */ getConsentNotificationResetToken()4891 default String getConsentNotificationResetToken() { 4892 return CONSENT_NOTIFICATION_RESET_TOKEN; 4893 } 4894 4895 /** Default whether Enrollment Mdd Record Deletion feature is enabled. */ 4896 boolean ENROLLMENT_MDD_RECORD_DELETION_ENABLED = false; 4897 4898 /** Returns whether the {@code enrollmentMddRecordDeletion} feature is enabled. */ getEnrollmentMddRecordDeletionEnabled()4899 default boolean getEnrollmentMddRecordDeletionEnabled() { 4900 return ENROLLMENT_MDD_RECORD_DELETION_ENABLED; 4901 } 4902 4903 /** Default value of whether topics cobalt logging feature is enabled. */ 4904 boolean TOPICS_COBALT_LOGGING_ENABLED = false; 4905 4906 /** 4907 * Returns whether the topics cobalt logging feature is enabled. 4908 * 4909 * <p>The topics cobalt logging will be disabled either the {@code getCobaltLoggingEnabled} or 4910 * {@code TOPICS_COBALT_LOGGING_ENABLED} is {@code false}. 4911 */ getTopicsCobaltLoggingEnabled()4912 default boolean getTopicsCobaltLoggingEnabled() { 4913 return getCobaltLoggingEnabled() && TOPICS_COBALT_LOGGING_ENABLED; 4914 } 4915 4916 /** 4917 * Default value of whether cobalt logging feature is enabled for source and trigger 4918 * registrations in measurement service. 4919 */ 4920 @FeatureFlag boolean MSMT_REGISTRATION_COBALT_LOGGING_ENABLED = false; 4921 4922 /** 4923 * Returns whether the cobalt logging feature is enabled for source and trigger registration in 4924 * measurement service . 4925 * 4926 * <p>The cobalt logging for measurement registration will be disabled either the {@code 4927 * getCobaltLoggingEnabled} or {@code MSMT_REGISTRATION_COBALT_LOGGING_ENABLED} is {@code 4928 * false}. 4929 */ getMsmtRegistrationCobaltLoggingEnabled()4930 default boolean getMsmtRegistrationCobaltLoggingEnabled() { 4931 return getCobaltLoggingEnabled() && MSMT_REGISTRATION_COBALT_LOGGING_ENABLED; 4932 } 4933 4934 /** 4935 * Default value of whether cobalt logging feature is enabled for attribution metrics in 4936 * measurement service. 4937 */ 4938 @FeatureFlag boolean MSMT_ATTRIBUTION_COBALT_LOGGING_ENABLED = false; 4939 4940 /** 4941 * Returns whether the cobalt logging feature is enabled for attribution metrics in measurement 4942 * service . 4943 * 4944 * <p>The cobalt logging for measurement registration will be disabled either the {@code 4945 * getCobaltLoggingEnabled} or {@code MSMT_ATTRIBUTION_COBALT_LOGGING_ENABLED} is {@code false}. 4946 */ getMsmtAttributionCobaltLoggingEnabled()4947 default boolean getMsmtAttributionCobaltLoggingEnabled() { 4948 return getCobaltLoggingEnabled() && MSMT_ATTRIBUTION_COBALT_LOGGING_ENABLED; 4949 } 4950 4951 /** 4952 * Default value of whether cobalt logging feature is enabled for reporting metrics in 4953 * measurement service. 4954 */ 4955 @FeatureFlag boolean MSMT_REPORTING_COBALT_LOGGING_ENABLED = false; 4956 4957 /** 4958 * Returns whether the cobalt logging feature is enabled for reporting metrics in measurement 4959 * service . 4960 * 4961 * <p>The cobalt logging for measurement registration will be disabled either the {@code 4962 * getCobaltLoggingEnabled} or {@code MSMT_REPORTING_COBALT_LOGGING_ENABLED} is {@code false}. 4963 */ getMsmtReportingCobaltLoggingEnabled()4964 default boolean getMsmtReportingCobaltLoggingEnabled() { 4965 return getCobaltLoggingEnabled() && MSMT_REPORTING_COBALT_LOGGING_ENABLED; 4966 } 4967 4968 /** Default value of whether app name and api error cobalt logging feature is enabled. */ 4969 boolean APP_NAME_API_ERROR_COBALT_LOGGING_ENABLED = false; 4970 4971 /** 4972 * Returns whether the app name and api error cobalt logging feature is enabled. 4973 * 4974 * <p>The app name and api error cobalt logging will be disabled either the {@code 4975 * getCobaltLoggingEnabled} or {@code APP_NAME_API_ERROR_COBALT_LOGGING_ENABLED} is {@code 4976 * false}. 4977 */ getAppNameApiErrorCobaltLoggingEnabled()4978 default boolean getAppNameApiErrorCobaltLoggingEnabled() { 4979 return getCobaltLoggingEnabled() && APP_NAME_API_ERROR_COBALT_LOGGING_ENABLED; 4980 } 4981 4982 /** 4983 * Default value of {@link AppNameApiErrorLogger} logging sampling rate. 4984 * 4985 * <p>The value should be an integer in the range of {@code [0, 100]}, where {@code 100} is to 4986 * log all events and {@code 0} is to log no events. 4987 */ 4988 int APP_NAME_API_ERROR_COBALT_LOGGING_SAMPLING_RATE = 100; 4989 4990 /** Returns the {@link AppNameApiErrorLogger} logging sampling rate. */ getAppNameApiErrorCobaltLoggingSamplingRate()4991 default int getAppNameApiErrorCobaltLoggingSamplingRate() { 4992 return APP_NAME_API_ERROR_COBALT_LOGGING_SAMPLING_RATE; 4993 } 4994 4995 /** Default value of Cobalt Adservices Api key. */ 4996 String COBALT_ADSERVICES_API_KEY_HEX = CobaltConstants.DEFAULT_API_KEY; 4997 getCobaltAdservicesApiKeyHex()4998 default String getCobaltAdservicesApiKeyHex() { 4999 return COBALT_ADSERVICES_API_KEY_HEX; 5000 } 5001 5002 /** 5003 * Default value of Adservices release stage for Cobalt. The value should correspond to {@link 5004 * com.google.cobalt.ReleaseStage} enum. 5005 */ 5006 String ADSERVICES_RELEASE_STAGE_FOR_COBALT = CobaltConstants.DEFAULT_RELEASE_STAGE; 5007 5008 /** Returns the value of Adservices release stage for Cobalt. */ getAdservicesReleaseStageForCobalt()5009 default String getAdservicesReleaseStageForCobalt() { 5010 return ADSERVICES_RELEASE_STAGE_FOR_COBALT; 5011 } 5012 5013 /** Default value of whether Cobalt registry out of band update feature is enabled */ 5014 @FeatureFlag boolean COBALT_REGISTRY_OUT_OF_BAND_UPDATE_ENABLED = false; 5015 5016 /** Returns whether Cobalt registry out of band update feature is enabled. */ getCobaltRegistryOutOfBandUpdateEnabled()5017 default boolean getCobaltRegistryOutOfBandUpdateEnabled() { 5018 return COBALT_REGISTRY_OUT_OF_BAND_UPDATE_ENABLED; 5019 } 5020 5021 /** MDD Cobalt registry manifest url. */ 5022 String MDD_COBALT_REGISTRY_MANIFEST_FILE_URL = ""; 5023 5024 /** Returns MDD Cobalt registry manifest url. */ getMddCobaltRegistryManifestFileUrl()5025 default String getMddCobaltRegistryManifestFileUrl() { 5026 return MDD_COBALT_REGISTRY_MANIFEST_FILE_URL; 5027 } 5028 5029 /** Default value of whether Cobalt operational logging feature is enabled. */ 5030 @FeatureFlag boolean COBALT_OPERATIONAL_LOGGING_ENABLED = false; 5031 5032 /** Returns whether Cobalt operational logging is enabled. */ getCobaltOperationalLoggingEnabled()5033 default boolean getCobaltOperationalLoggingEnabled() { 5034 return COBALT_OPERATIONAL_LOGGING_ENABLED; 5035 } 5036 5037 /** 5038 * The flag to enable falling back to the default base registry. It prevents Cobalt using merged 5039 * registry. So in case the MDD downloaded registry and merged with default registry already, we 5040 * can still fall back to use the default base registry. 5041 */ 5042 @FeatureFlag Boolean COBALT__FALL_BACK_TO_DEFAULT_BASE_REGISTRY = false; 5043 5044 /** Returns the flag to enable falling back to the default base registry. */ getCobaltFallBackToDefaultBaseRegistry()5045 default boolean getCobaltFallBackToDefaultBaseRegistry() { 5046 return COBALT__FALL_BACK_TO_DEFAULT_BASE_REGISTRY; 5047 } 5048 5049 /** 5050 * The flag tells Cobalt to ignore specific list of report id(s). This flag is used for 5051 * out-of-band registry update. The format is a comma-separated list of 4 colon separated ints, 5052 * e.g. a single value is customer_id:project_id:metric_id:report_id. 5053 */ 5054 @ConfigFlag String COBALT__IGNORED_REPORT_ID_LIST = ""; 5055 5056 /** Returns the flag to ignore specific list of report id(s). */ getCobaltIgnoredReportIdList()5057 default String getCobaltIgnoredReportIdList() { 5058 return COBALT__IGNORED_REPORT_ID_LIST; 5059 } 5060 5061 /** 5062 * The flag to enable Cobalt logging for API call response, including both success and failure 5063 * responses. This metric is replacing the app package name API error metric, controlled by the 5064 * {@link APP_NAME_API_ERROR_COBALT_LOGGING_ENABLED} flag. 5065 */ 5066 @FeatureFlag Boolean COBALT__ENABLE_API_CALL_RESPONSE_LOGGING = false; 5067 5068 /** Returns whether Cobalt Api call response logging is enabled. */ getCobaltEnableApiCallResponseLogging()5069 default boolean getCobaltEnableApiCallResponseLogging() { 5070 return COBALT__ENABLE_API_CALL_RESPONSE_LOGGING; 5071 } 5072 5073 /** 5074 * A feature flag to enable DB schema change to version 8 in Topics API. Version 8 is to add 5075 * logged_topic column to ReturnedTopic table. 5076 * 5077 * <p>Default value is false, which means the feature is disabled by default and needs to be 5078 * ramped up. 5079 */ 5080 boolean ENABLE_LOGGED_TOPIC = false; 5081 5082 /** Returns if to enable logged_topic column in ReturnedTopic table. */ getEnableLoggedTopic()5083 default boolean getEnableLoggedTopic() { 5084 return ENABLE_LOGGED_TOPIC; 5085 } 5086 5087 /** Whether to enable database schema version 8 */ 5088 boolean ENABLE_DATABASE_SCHEMA_VERSION_8 = false; 5089 5090 /** Returns if to enable database schema version 8. */ getEnableDatabaseSchemaVersion8()5091 default boolean getEnableDatabaseSchemaVersion8() { 5092 return ENABLE_DATABASE_SCHEMA_VERSION_8; 5093 } 5094 5095 /** Whether to enable database schema version 9. */ 5096 boolean ENABLE_DATABASE_SCHEMA_VERSION_9 = false; 5097 5098 /** Returns if to enable database schema version 9. */ getEnableDatabaseSchemaVersion9()5099 default boolean getEnableDatabaseSchemaVersion9() { 5100 return ENABLE_DATABASE_SCHEMA_VERSION_9; 5101 } 5102 5103 /** Flag to control which allow list in getMeasurementApiStatus. */ 5104 boolean MEASUREMENT_ENABLE_API_STATUS_ALLOW_LIST_CHECK = false; 5105 5106 /** Returns the flag to control which allow list to use in getMeasurementApiStatus. */ getMsmtEnableApiStatusAllowListCheck()5107 default boolean getMsmtEnableApiStatusAllowListCheck() { 5108 return MEASUREMENT_ENABLE_API_STATUS_ALLOW_LIST_CHECK; 5109 } 5110 5111 @ConfigFlag 5112 long MEASUREMENT_MAX_REINSTALL_REATTRIBUTION_WINDOW_SECONDS = TimeUnit.DAYS.toSeconds(90); 5113 5114 /** Maximum limit of duration to determine reattribution for a verified installation. */ getMeasurementMaxReinstallReattributionWindowSeconds()5115 default long getMeasurementMaxReinstallReattributionWindowSeconds() { 5116 return MEASUREMENT_MAX_REINSTALL_REATTRIBUTION_WINDOW_SECONDS; 5117 } 5118 5119 @FeatureFlag boolean MEASUREMENT_ENABLE_REINSTALL_REATTRIBUTION = false; 5120 5121 /** Returns whether to enable reinstall reattribution. */ getMeasurementEnableReinstallReattribution()5122 default boolean getMeasurementEnableReinstallReattribution() { 5123 return MEASUREMENT_ENABLE_REINSTALL_REATTRIBUTION; 5124 } 5125 5126 @ConfigFlag 5127 long MEASUREMENT_MIN_REPORT_LIFESPAN_FOR_UNINSTALL_SECONDS = TimeUnit.DAYS.toSeconds(1); 5128 5129 /** Minimum time a report can stay on the device after app uninstall. */ getMeasurementMinReportLifespanForUninstallSeconds()5130 default long getMeasurementMinReportLifespanForUninstallSeconds() { 5131 return MEASUREMENT_MIN_REPORT_LIFESPAN_FOR_UNINSTALL_SECONDS; 5132 } 5133 5134 @FeatureFlag boolean MEASUREMENT_ENABLE_MIN_REPORT_LIFESPAN_FOR_UNINSTALL = false; 5135 5136 /** Returns whether to enable uninstall report feature. */ getMeasurementEnableMinReportLifespanForUninstall()5137 default boolean getMeasurementEnableMinReportLifespanForUninstall() { 5138 return MEASUREMENT_ENABLE_MIN_REPORT_LIFESPAN_FOR_UNINSTALL; 5139 } 5140 5141 @FeatureFlag boolean MEASUREMENT_ENABLE_INSTALL_ATTRIBUTION_ON_S = false; 5142 5143 /** Returns whether to enable install attribution on S feature. */ getMeasurementEnableInstallAttributionOnS()5144 default boolean getMeasurementEnableInstallAttributionOnS() { 5145 return MEASUREMENT_ENABLE_INSTALL_ATTRIBUTION_ON_S; 5146 } 5147 5148 /** The maximum allowable length of a trigger context id. */ 5149 int MEASUREMENT_MAX_LENGTH_OF_TRIGGER_CONTEXT_ID = 64; 5150 5151 /** Return the maximum allowable length of a trigger context id. */ getMeasurementMaxLengthOfTriggerContextId()5152 default int getMeasurementMaxLengthOfTriggerContextId() { 5153 return MEASUREMENT_MAX_LENGTH_OF_TRIGGER_CONTEXT_ID; 5154 } 5155 5156 /** Flag for enabling measurement registrations using ODP */ 5157 boolean MEASUREMENT_ENABLE_ODP_WEB_TRIGGER_REGISTRATION = false; 5158 5159 /** Return true if measurement registrations through ODP is enabled */ getMeasurementEnableOdpWebTriggerRegistration()5160 default boolean getMeasurementEnableOdpWebTriggerRegistration() { 5161 return MEASUREMENT_ENABLE_ODP_WEB_TRIGGER_REGISTRATION; 5162 } 5163 5164 float DEFAULT_MEASUREMENT_PRIVACY_EPSILON = 14f; 5165 getMeasurementPrivacyEpsilon()5166 default float getMeasurementPrivacyEpsilon() { 5167 return DEFAULT_MEASUREMENT_PRIVACY_EPSILON; 5168 } 5169 5170 /** Flag for enabling measurement event level epsilon in source */ 5171 @FeatureFlag boolean MEASUREMENT_ENABLE_EVENT_LEVEL_EPSILON_IN_SOURCE = false; 5172 5173 /** Returns true if measurement event level epsilon in source is enabled */ getMeasurementEnableEventLevelEpsilonInSource()5174 default boolean getMeasurementEnableEventLevelEpsilonInSource() { 5175 return MEASUREMENT_ENABLE_EVENT_LEVEL_EPSILON_IN_SOURCE; 5176 } 5177 5178 @FeatureFlag boolean MEASUREMENT_ENABLE_DESTINATION_LIMIT_PRIORITY = false; 5179 getMeasurementEnableSourceDestinationLimitPriority()5180 default boolean getMeasurementEnableSourceDestinationLimitPriority() { 5181 return MEASUREMENT_ENABLE_DESTINATION_LIMIT_PRIORITY; 5182 } 5183 5184 /** 5185 * Default destination limit algorithm configuration. LIFO (0) by default, can be configured as 5186 * FIFO (1). 5187 */ 5188 @ConfigFlag int MEASUREMENT_DEFAULT_DESTINATION_LIMIT_ALGORITHM = 0; 5189 getMeasurementDefaultSourceDestinationLimitAlgorithm()5190 default int getMeasurementDefaultSourceDestinationLimitAlgorithm() { 5191 return MEASUREMENT_DEFAULT_DESTINATION_LIMIT_ALGORITHM; 5192 } 5193 5194 @FeatureFlag boolean MEASUREMENT_ENABLE_DESTINATION_LIMIT_ALGORITHM_FIELD = false; 5195 getMeasurementEnableSourceDestinationLimitAlgorithmField()5196 default boolean getMeasurementEnableSourceDestinationLimitAlgorithmField() { 5197 return MEASUREMENT_ENABLE_DESTINATION_LIMIT_ALGORITHM_FIELD; 5198 } 5199 5200 @FeatureFlag boolean MEASUREMENT_ENABLE_AGGREGATE_VALUE_FILTERS = false; 5201 5202 /* 5203 * Returns whether filtering in Trigger's AGGREGATABLE_VALUES is allowed. 5204 */ getMeasurementEnableAggregateValueFilters()5205 default boolean getMeasurementEnableAggregateValueFilters() { 5206 return MEASUREMENT_ENABLE_AGGREGATE_VALUE_FILTERS; 5207 } 5208 5209 /** Flag for enabling measurement aggregate debug reporting */ 5210 @FeatureFlag boolean MEASUREMENT_ENABLE_AGGREGATE_DEBUG_REPORTING = false; 5211 5212 /** Returns whether measurement aggregate debug reporting is enabled. */ getMeasurementEnableAggregateDebugReporting()5213 default boolean getMeasurementEnableAggregateDebugReporting() { 5214 return MEASUREMENT_ENABLE_AGGREGATE_DEBUG_REPORTING; 5215 } 5216 5217 @ConfigFlag int MEASUREMENT_ADR_BUDGET_PER_ORIGIN_PUBLISHER_WINDOW = 65536; // = 2^16 5218 5219 /** Returns aggregatable debug reporting budget allocated per origin per publisher per window */ getMeasurementAdrBudgetOriginXPublisherXWindow()5220 default int getMeasurementAdrBudgetOriginXPublisherXWindow() { 5221 return MEASUREMENT_ADR_BUDGET_PER_ORIGIN_PUBLISHER_WINDOW; 5222 } 5223 5224 @ConfigFlag int MEASUREMENT_ADR_BUDGET_PER_PUBLISHER_WINDOW = 1048576; // = 2^20 5225 5226 /** Returns aggregatable debug reporting budget allocated per publisher per window */ getMeasurementAdrBudgetPublisherXWindow()5227 default int getMeasurementAdrBudgetPublisherXWindow() { 5228 return MEASUREMENT_ADR_BUDGET_PER_PUBLISHER_WINDOW; 5229 } 5230 5231 @ConfigFlag long MEASUREMENT_ADR_BUDGET_WINDOW_LENGTH_MILLIS = TimeUnit.DAYS.toMillis(1); 5232 5233 /** 5234 * Returns aggregatable debug reporting budget consumption tracking window length in 5235 * milliseconds. 5236 */ getMeasurementAdrBudgetWindowLengthMillis()5237 default long getMeasurementAdrBudgetWindowLengthMillis() { 5238 return MEASUREMENT_ADR_BUDGET_WINDOW_LENGTH_MILLIS; 5239 } 5240 5241 @ConfigFlag int MEASUREMENT_MAX_ADR_COUNT_PER_SOURCE = 5; 5242 5243 /** Returns maximum number of aggregatable debug reports allowed per source. */ getMeasurementMaxAdrCountPerSource()5244 default int getMeasurementMaxAdrCountPerSource() { 5245 return MEASUREMENT_MAX_ADR_COUNT_PER_SOURCE; 5246 } 5247 5248 /** 5249 * Default whether to limit logging for enrollment metrics to avoid performance issues. This 5250 * includes not logging data that requires database queries and downloading MDD files. 5251 */ 5252 boolean ENROLLMENT_ENABLE_LIMITED_LOGGING = false; 5253 5254 /** Returns whether enrollment logging should be limited. */ getEnrollmentEnableLimitedLogging()5255 default boolean getEnrollmentEnableLimitedLogging() { 5256 return ENROLLMENT_ENABLE_LIMITED_LOGGING; 5257 } 5258 5259 @ConfigFlag int MEASUREMENT_DEFAULT_FILTERING_ID_MAX_BYTES = 1; 5260 getMeasurementDefaultFilteringIdMaxBytes()5261 default int getMeasurementDefaultFilteringIdMaxBytes() { 5262 return MEASUREMENT_DEFAULT_FILTERING_ID_MAX_BYTES; 5263 } 5264 5265 @ConfigFlag int MEASUREMENT_MAX_FILTERING_ID_MAX_BYTES = 8; 5266 getMeasurementMaxFilteringIdMaxBytes()5267 default int getMeasurementMaxFilteringIdMaxBytes() { 5268 return MEASUREMENT_MAX_FILTERING_ID_MAX_BYTES; 5269 } 5270 5271 @FeatureFlag boolean MEASUREMENT_ENABLE_FLEXIBLE_CONTRIBUTION_FILTERING = false; 5272 getMeasurementEnableFlexibleContributionFiltering()5273 default boolean getMeasurementEnableFlexibleContributionFiltering() { 5274 return MEASUREMENT_ENABLE_FLEXIBLE_CONTRIBUTION_FILTERING; 5275 } 5276 5277 /** Flag for enabling measurement debug keys privacy enforcement */ 5278 @FeatureFlag boolean MEASUREMENT_ENABLE_BOTH_SIDE_DEBUG_KEYS_IN_REPORTS = false; 5279 5280 /** Returns whether measurement debug keys privacy enforcement is enabled. */ getMeasurementEnableBothSideDebugKeysInReports()5281 default boolean getMeasurementEnableBothSideDebugKeysInReports() { 5282 return MEASUREMENT_ENABLE_BOTH_SIDE_DEBUG_KEYS_IN_REPORTS; 5283 } 5284 5285 /** Flag to enable open access for adtechs to use debug_join_key . */ 5286 @FeatureFlag boolean MEASUREMENT_ENABLE_DEBUG_JOIN_KEYS_OPEN_ACCESS = false; 5287 5288 /** Returns whether open access for adtechs to use debug_join_key is enabled */ getMeasurementEnableDebugJoinKeysOpenAccess()5289 default boolean getMeasurementEnableDebugJoinKeysOpenAccess() { 5290 return MEASUREMENT_ENABLE_DEBUG_JOIN_KEYS_OPEN_ACCESS; 5291 } 5292 5293 /** 5294 * List noncompiliant adtechs using debug_join_keys during open access. Example: 5295 * "adtech_1,adtech_2" 5296 */ 5297 @ConfigFlag String MEASUREMENT_DEBUG_JOIN_KEYS_NONCOMPLIANT_ADTECHS = ""; 5298 5299 /** Returns list noncompiliant adtechs using debug_join_keys during open access.. */ getMeasurementDebugJoinKeysNoncompliantAdtechs()5300 default String getMeasurementDebugJoinKeysNoncompliantAdtechs() { 5301 return MEASUREMENT_DEBUG_JOIN_KEYS_NONCOMPLIANT_ADTECHS; 5302 } 5303 5304 /* Sample rate used to set debug_join_keys if Trigger side adtech is non-compliant. */ 5305 @ConfigFlag float MEASUREMENT_DEBUG_JOIN_KEYS_NONCOMPLIANT_ADTECHS_SAMPLE_RATE = 1.0f; 5306 5307 /** Returns sample rate to set debug_join_keys on non-compliant adtechs. */ getMeasurementDebugJoinKeysNoncompliantAdtechsSampleRate()5308 default float getMeasurementDebugJoinKeysNoncompliantAdtechsSampleRate() { 5309 return MEASUREMENT_DEBUG_JOIN_KEYS_NONCOMPLIANT_ADTECHS_SAMPLE_RATE; 5310 } 5311 5312 /** 5313 * Default value for if events will be registered as a source of attribution in addition to 5314 * being reported. 5315 */ 5316 boolean FLEDGE_MEASUREMENT_REPORT_AND_REGISTER_EVENT_API_ENABLED = false; 5317 5318 /** 5319 * Returns if events will be registered as a source of attribution in addition to being 5320 * reported. 5321 * 5322 * <p>This, unlocked by the short-term integration between Protected Audience (PA) and 5323 * Measurement's ARA, enables the {@link 5324 * android.adservices.adselection.AdSelectionManager#reportEvent} API to report an event and 5325 * register it as source of attribution, using a single API call, unified under the hood. 5326 * 5327 * <ul> 5328 * <li>When enabled, by default: ARA will report and register the event. 5329 * <li>When enabled, with fallback: PA will report the event and ARA will register the event. 5330 * <li>When disabled, when {@link 5331 * android.adservices.adselection.AdSelectionManager#reportEvent} is called, only PA will 5332 * report the event. 5333 * </ul> 5334 */ getFledgeMeasurementReportAndRegisterEventApiEnabled()5335 default boolean getFledgeMeasurementReportAndRegisterEventApiEnabled() { 5336 return FLEDGE_MEASUREMENT_REPORT_AND_REGISTER_EVENT_API_ENABLED; 5337 } 5338 5339 /** Default value for if the fallback for event reporting and source registration is enabled. */ 5340 boolean FLEDGE_MEASUREMENT_REPORT_AND_REGISTER_EVENT_API_FALLBACK_ENABLED = false; 5341 5342 /** 5343 * Returns if the fallback for event reporting and source registration is enabled. 5344 * 5345 * <ul> 5346 * <li>Only relevant if {@link #getFledgeMeasurementReportAndRegisterEventApiEnabled} is 5347 * {@code true}. 5348 * <li>When enabled, PA will report the event and ARA will register the event. 5349 * <li>When disabled, ARA will report and register the event. 5350 * </ul> 5351 * 5352 * <p>If enabled 5353 */ getFledgeMeasurementReportAndRegisterEventApiFallbackEnabled()5354 default boolean getFledgeMeasurementReportAndRegisterEventApiFallbackEnabled() { 5355 return getFledgeMeasurementReportAndRegisterEventApiEnabled() 5356 && FLEDGE_MEASUREMENT_REPORT_AND_REGISTER_EVENT_API_FALLBACK_ENABLED; 5357 } 5358 5359 /** Cobalt logging job period in milliseconds. */ 5360 long COBALT_LOGGING_JOB_PERIOD_MS = 6 * 60 * 60 * 1000; // 6 hours. 5361 5362 /** Returns the max time period (in milliseconds) between each cobalt logging job run. */ getCobaltLoggingJobPeriodMs()5363 default long getCobaltLoggingJobPeriodMs() { 5364 return COBALT_LOGGING_JOB_PERIOD_MS; 5365 } 5366 5367 long COBALT_UPLOAD_SERVICE_UNBIND_DELAY_MS = 10 * 1000; // 10 seconds 5368 5369 /** 5370 * Returns the amount of time Cobalt should wait (in milliseconds) before unbinding from its 5371 * upload service. 5372 */ getCobaltUploadServiceUnbindDelayMs()5373 default long getCobaltUploadServiceUnbindDelayMs() { 5374 return COBALT_UPLOAD_SERVICE_UNBIND_DELAY_MS; 5375 } 5376 5377 /** Cobalt logging feature flag. */ 5378 @FeatureFlag boolean COBALT_LOGGING_ENABLED = false; 5379 5380 /** 5381 * Returns the feature flag value for cobalt logging job. The cobalt logging feature will be 5382 * disabled if either the Global Kill Switch or the Cobalt Logging enabled flag is true. 5383 */ getCobaltLoggingEnabled()5384 default boolean getCobaltLoggingEnabled() { 5385 return !getGlobalKillSwitch() && COBALT_LOGGING_ENABLED; 5386 } 5387 5388 /** U18 UX detention channel is enabled by default. */ 5389 boolean IS_U18_UX_DETENTION_CHANNEL_ENABLED_DEFAULT = true; 5390 5391 /** Returns whether the U18 UX detentional channel is enabled. */ isU18UxDetentionChannelEnabled()5392 default boolean isU18UxDetentionChannelEnabled() { 5393 return IS_U18_UX_DETENTION_CHANNEL_ENABLED_DEFAULT; 5394 } 5395 5396 /** U18 supervised account flow is enabled by default. */ 5397 boolean IS_U18_SUPERVISED_ACCOUNT_ENABLED_DEFAULT = true; 5398 5399 /** Returns whether the U18 supervised account is enabled. */ isU18SupervisedAccountEnabled()5400 default boolean isU18SupervisedAccountEnabled() { 5401 return IS_U18_SUPERVISED_ACCOUNT_ENABLED_DEFAULT; 5402 } 5403 5404 long DEFAULT_AD_ID_FETCHER_TIMEOUT_MS = 50; 5405 5406 /** 5407 * Returns configured timeout value for {@link 5408 * com.android.adservices.service.adselection.AdIdFetcher} logic. 5409 * 5410 * <p>The intended goal is to override this value for tests. 5411 * 5412 * <p>Returns Timeout in mills. 5413 */ getAdIdFetcherTimeoutMs()5414 default long getAdIdFetcherTimeoutMs() { 5415 return DEFAULT_AD_ID_FETCHER_TIMEOUT_MS; 5416 } 5417 5418 /** 5419 * Default value to determine whether AdServicesExtDataStorageService related APIs are enabled. 5420 */ 5421 boolean DEFAULT_ENABLE_ADEXT_DATA_SERVICE_APIS = true; 5422 5423 /** Returns whether AdServicesExtDataStorageService related APIs are enabled. */ getEnableAdExtDataServiceApis()5424 default boolean getEnableAdExtDataServiceApis() { 5425 return DEFAULT_ENABLE_ADEXT_DATA_SERVICE_APIS; 5426 } 5427 5428 /** 5429 * Default value to determine how many logging events {@link AdServicesJobServiceLogger} should 5430 * upload to the server. 5431 * 5432 * <p>The value should be an integer in the range of [0, 100], where 100 is to log all events 5433 * and 0 is to log no events. 5434 */ 5435 int DEFAULT_BACKGROUND_JOB_SAMPLING_LOGGING_RATE = 5; 5436 5437 /** 5438 * Returns the sampling logging rate for {@link AdServicesJobServiceLogger} for logging events. 5439 */ getBackgroundJobSamplingLoggingRate()5440 default int getBackgroundJobSamplingLoggingRate() { 5441 return DEFAULT_BACKGROUND_JOB_SAMPLING_LOGGING_RATE; 5442 } 5443 5444 /** Default value of the timeout for AppSearch write operations */ 5445 int DEFAULT_APPSEARCH_WRITE_TIMEOUT_MS = 3000; 5446 5447 /** 5448 * Gets the value of the timeout for AppSearch write operations, in milliseconds. 5449 * 5450 * @return the timeout, in milliseconds, for AppSearch write operations 5451 */ getAppSearchWriteTimeout()5452 default int getAppSearchWriteTimeout() { 5453 return DEFAULT_APPSEARCH_WRITE_TIMEOUT_MS; 5454 } 5455 5456 /** Default value of the timeout for AppSearch read operations */ 5457 int DEFAULT_APPSEARCH_READ_TIMEOUT_MS = 750; 5458 5459 /** 5460 * Gets the value of the timeout for AppSearch read operations, in milliseconds. 5461 * 5462 * @return the timeout, in milliseconds, for AppSearch read operations 5463 */ getAppSearchReadTimeout()5464 default int getAppSearchReadTimeout() { 5465 return DEFAULT_APPSEARCH_READ_TIMEOUT_MS; 5466 } 5467 5468 /** default value for get adservices common states enabled */ 5469 boolean DEFAULT_IS_GET_ADSERVICES_COMMON_STATES_API_ENABLED = false; 5470 5471 /** Returns if the get adservices common states service enabled. */ isGetAdServicesCommonStatesApiEnabled()5472 default boolean isGetAdServicesCommonStatesApiEnabled() { 5473 return DEFAULT_IS_GET_ADSERVICES_COMMON_STATES_API_ENABLED; 5474 } 5475 5476 /** Default value to determine whether ux related to the PAS Ux are enabled. */ 5477 boolean DEFAULT_PAS_UX_ENABLED = false; 5478 5479 /** 5480 * Returns whether features related to the PAS Ux are enabled. This flag has dependencies on 5481 * {@link #getEeaPasUxEnabled}. This method is the master control for PAS UX. If either EEA or 5482 * original PAS UX flag is on, then this method will return true. 5483 */ getPasUxEnabled()5484 default boolean getPasUxEnabled() { 5485 return DEFAULT_PAS_UX_ENABLED; 5486 } 5487 5488 /** Default value to determine whether ux related to EEA PAS Ux are enabled. */ 5489 boolean DEFAULT_EEA_PAS_UX_ENABLED = false; 5490 5491 /** Returns whether features related to EEA PAS Ux are enabled. */ getEeaPasUxEnabled()5492 default boolean getEeaPasUxEnabled() { 5493 return DEFAULT_EEA_PAS_UX_ENABLED; 5494 } 5495 5496 /** Default value of the KAnon Sign/join feature flag */ 5497 boolean FLEDGE_DEFAULT_KANON_SIGN_JOIN_FEATURE_ENABLED = false; 5498 5499 /** Default value of KAnon Sign/Join feature in PersistAdSelection endpoint */ 5500 boolean FLEDGE_DEFAULT_KANON_FEATURE_AUCTION_SERVER_ENABLED = false; 5501 5502 /** Default value of KAnon sign/join feature in On Device AdSelection path */ 5503 boolean FLEDGE_DEFAULT_KANON_FEATURE_ON_DEVICE_AUCTION_ENABLED = false; 5504 5505 /** Default value of k-anon fetch server parameters url. */ 5506 String FLEDGE_DEFAULT_KANON_FETCH_SERVER_PARAMS_URL = ""; 5507 5508 /** Default value of k-anon get challenge url. */ 5509 String FLEDGE_DEFAULT_GET_CHALLENGE_URL = ""; 5510 5511 /** Default value of k-anon register client parameters url. */ 5512 String FLEDGE_DEFAULT_KANON_REGISTER_CLIENT_PARAMETERS_URL = ""; 5513 5514 /** Default value of k-anon get tokens url. */ 5515 String FLEDGE_DEFAULT_KANON_GET_TOKENS_URL = ""; 5516 5517 /** Default value of k-anon get tokens url. */ 5518 String FLEDGE_DEFAULT_KANON_JOIN_URL = ""; 5519 5520 /** Default value of kanon join authority */ 5521 String FLEDGE_DEFAULT_KANON_AUTHORIY_URL_JOIN = ""; 5522 5523 /** Default size of batch in a kanon sign call */ 5524 int FLEDGE_DEFAULT_KANON_SIGN_BATCH_SIZE = 32; 5525 5526 /** Default percentage of messages to be signed/joined immediately. */ 5527 int FLEDGE_DEFAULT_KANON_PERCENTAGE_IMMEDIATE_SIGN_JOIN_CALLS = 10; 5528 5529 /** Default ttl of kanon-messages stored in the database */ 5530 long FLEDGE_DEFAULT_KANON_MESSAGE_TTL_SECONDS = 2 * 7 * 24 * 60 * 60; // 2 weeks 5531 5532 /** Default time period of the KAnon Sign/Join background process */ 5533 long FLEDGE_DEFAULT_KANON_BACKGROUND_JOB_TIME_PERIOD_MS = TimeUnit.HOURS.toMillis(24); 5534 5535 /** Default number of messages processed in a single background process */ 5536 int FLEDGE_DEFAULT_KANON_NUMBER_OF_MESSAGES_PER_BACKGROUND_PROCESS = 100; 5537 5538 /** Default value for kanon background process flag */ 5539 boolean FLEDGE_DEFAULT_KANON_BACKGROUND_PROCESS_ENABLED = false; 5540 5541 /** Default value for kanon logging flag */ 5542 boolean FLEDGE_DEFAULT_KANON_SIGN_JOIN_LOGGING_ENABLED = false; 5543 5544 /** Default value for kanon key attestation feature flag */ 5545 boolean FLEDGE_DEFAULT_KANON_KEY_ATTESTATION_ENABLED = false; 5546 5547 /** Default value for kanon sign join set type */ 5548 String FLEDGE_DEFAULT_KANON_SET_TYPE_TO_SIGN_JOIN = "fledge"; 5549 5550 /** 5551 * Default boolean for the field determining whether to run background job when the device's 5552 * battery is low. 5553 */ 5554 boolean FLEDGE_DEFAULT_KANON_BACKGROUND_JOB_REQUIRES_BATTERY_NOT_LOW = true; 5555 5556 /** 5557 * Default boolean for the field determining whether to run background job when the device is 5558 * not idle. 5559 */ 5560 boolean FLEDGE_DEFAULT_KANON_BACKGROUND_JOB_REQUIRES_DEVICE_IDLE = true; 5561 5562 /** 5563 * Default value for connection type required field for kanon background job. See {@link 5564 * JobInfo#NETWORK_TYPE_UNMETERED} 5565 */ 5566 int FLEDGE_DEFAULT_KANON_BACKGROUND_JOB_CONNECTION_TYPE = 2; 5567 5568 /** Default value for kanon http client connect timeout in milliseconds */ 5569 int FLEDGE_DEFAULT_KANON_HTTP_CLIENT_TIMEOUT_IN_MS = 5000; 5570 5571 /** 5572 * This is a feature flag for KAnon Sign/Join feature. 5573 * 5574 * @return {@code true} if the feature is enabled, otherwise returns {@code false}. 5575 */ getFledgeKAnonSignJoinFeatureEnabled()5576 default boolean getFledgeKAnonSignJoinFeatureEnabled() { 5577 return getFledgeAuctionServerEnabled() && FLEDGE_DEFAULT_KANON_SIGN_JOIN_FEATURE_ENABLED; 5578 } 5579 5580 /** 5581 * This is a feature flag for KAnon Sign/Join feature on the on device ad selection path. 5582 * 5583 * @return {@code true} if it's enabled, otherwise returns {@code false}. 5584 */ getFledgeKAnonSignJoinFeatureOnDeviceAuctionEnabled()5585 default boolean getFledgeKAnonSignJoinFeatureOnDeviceAuctionEnabled() { 5586 return FLEDGE_DEFAULT_KANON_FEATURE_ON_DEVICE_AUCTION_ENABLED; 5587 } 5588 5589 /** 5590 * This is a feature flag for KAnon Sign/Join feature on the server auction path. 5591 * 5592 * @return {@code true} if it's enabled, otherwise returns {@code false}. 5593 */ getFledgeKAnonSignJoinFeatureAuctionServerEnabled()5594 default boolean getFledgeKAnonSignJoinFeatureAuctionServerEnabled() { 5595 return FLEDGE_DEFAULT_KANON_FEATURE_AUCTION_SERVER_ENABLED; 5596 } 5597 5598 /** 5599 * This method returns the url that needs to be used to fetch server parameters during k-anon 5600 * sign call 5601 * 5602 * @return kanon fetch server params url. 5603 */ getFledgeKAnonFetchServerParamsUrl()5604 default String getFledgeKAnonFetchServerParamsUrl() { 5605 return FLEDGE_DEFAULT_KANON_FETCH_SERVER_PARAMS_URL; 5606 } 5607 5608 /** 5609 * This method returns the url that needs to be used to fetch server parameters during k-anon 5610 * sign call 5611 * 5612 * @return kanon fetch server params url. 5613 */ getFledgeKAnonGetChallengeUrl()5614 default String getFledgeKAnonGetChallengeUrl() { 5615 return FLEDGE_DEFAULT_GET_CHALLENGE_URL; 5616 } 5617 5618 /** 5619 * This method returns the url that needs to be used to register client parameters during k-anon 5620 * sign call. 5621 * 5622 * @return register client params url 5623 */ getFledgeKAnonRegisterClientParametersUrl()5624 default String getFledgeKAnonRegisterClientParametersUrl() { 5625 return FLEDGE_DEFAULT_KANON_REGISTER_CLIENT_PARAMETERS_URL; 5626 } 5627 5628 /** 5629 * This method returns the url that needs to be used to fetch Tokens during k-anon sign call. 5630 * 5631 * @return default value of get tokens url 5632 */ getFledgeKAnonGetTokensUrl()5633 default String getFledgeKAnonGetTokensUrl() { 5634 return FLEDGE_DEFAULT_KANON_GET_TOKENS_URL; 5635 } 5636 5637 /** 5638 * This method returns the url that needs to be used to make k-anon join call. 5639 * 5640 * @return default value of get tokens url 5641 */ getFledgeKAnonJoinUrl()5642 default String getFledgeKAnonJoinUrl() { 5643 return FLEDGE_DEFAULT_KANON_JOIN_URL; 5644 } 5645 5646 /** 5647 * This method returns the value of batch size in a batch kanon sign call 5648 * 5649 * @return k-anon sign batch size 5650 */ getFledgeKAnonSignBatchSize()5651 default int getFledgeKAnonSignBatchSize() { 5652 return FLEDGE_DEFAULT_KANON_SIGN_BATCH_SIZE; 5653 } 5654 5655 /** 5656 * This method returns an integer tha represents the percentage of the messages that needs to be 5657 * signed/joined immediately. 5658 */ getFledgeKAnonPercentageImmediateSignJoinCalls()5659 default int getFledgeKAnonPercentageImmediateSignJoinCalls() { 5660 return FLEDGE_DEFAULT_KANON_PERCENTAGE_IMMEDIATE_SIGN_JOIN_CALLS; 5661 } 5662 5663 /** 5664 * This method returns the max ttl of a KAnonMessage in the Database. This is used to determine 5665 * when to clean up the old KAnonMessages from the database 5666 * 5667 * @return kanon max ttl for a kano message 5668 */ getFledgeKAnonMessageTtlSeconds()5669 default long getFledgeKAnonMessageTtlSeconds() { 5670 return FLEDGE_DEFAULT_KANON_MESSAGE_TTL_SECONDS; 5671 } 5672 5673 /** This method returns the number of k-anon sign/join background processes per day. */ getFledgeKAnonBackgroundProcessTimePeriodInMs()5674 default long getFledgeKAnonBackgroundProcessTimePeriodInMs() { 5675 return FLEDGE_DEFAULT_KANON_BACKGROUND_JOB_TIME_PERIOD_MS; 5676 } 5677 5678 /** 5679 * This method returns the number of k-anon messages to be processed per background process run. 5680 */ getFledgeKAnonMessagesPerBackgroundProcess()5681 default int getFledgeKAnonMessagesPerBackgroundProcess() { 5682 return FLEDGE_DEFAULT_KANON_NUMBER_OF_MESSAGES_PER_BACKGROUND_PROCESS; 5683 } 5684 5685 /** 5686 * This method returns {@code true} if the kanon background process is enabled, {@code false} 5687 * otherwise. 5688 */ getFledgeKAnonBackgroundProcessEnabled()5689 default boolean getFledgeKAnonBackgroundProcessEnabled() { 5690 return getFledgeKAnonSignJoinFeatureEnabled() 5691 && FLEDGE_DEFAULT_KANON_BACKGROUND_PROCESS_ENABLED; 5692 } 5693 5694 /** 5695 * This method returns {@code true} if the telemetry logging for kanon is enabled, {@code false} 5696 * otherwise. 5697 */ getFledgeKAnonLoggingEnabled()5698 default boolean getFledgeKAnonLoggingEnabled() { 5699 return getFledgeKAnonSignJoinFeatureEnabled() 5700 && FLEDGE_DEFAULT_KANON_SIGN_JOIN_LOGGING_ENABLED; 5701 } 5702 5703 /** 5704 * This method return {@code true} if the KAnon Key attestaion is enabled, {@code false} 5705 * otherwise. 5706 */ getFledgeKAnonKeyAttestationEnabled()5707 default boolean getFledgeKAnonKeyAttestationEnabled() { 5708 return getFledgeKAnonSignJoinFeatureEnabled() 5709 && FLEDGE_DEFAULT_KANON_KEY_ATTESTATION_ENABLED; 5710 } 5711 5712 /** 5713 * This method returns the type of set we need to join during kanon sign join process. eg: In 5714 * the following example, fledge is the set type to join. "types/fledge/set/hashset" 5715 */ getFledgeKAnonSetTypeToSignJoin()5716 default String getFledgeKAnonSetTypeToSignJoin() { 5717 return FLEDGE_DEFAULT_KANON_SET_TYPE_TO_SIGN_JOIN; 5718 } 5719 5720 /** 5721 * This method returns the url authority that will be used in the {@link 5722 * com.android.adservices.service.common.bhttp.BinaryHttpMessage}. This BinaryHttpMessage is 5723 * sent as part of kanon http join request. 5724 */ getFledgeKAnonUrlAuthorityToJoin()5725 default String getFledgeKAnonUrlAuthorityToJoin() { 5726 return FLEDGE_DEFAULT_KANON_AUTHORIY_URL_JOIN; 5727 } 5728 5729 /** This method returns the value for kanon http client connect timeout in milliseconds. */ getFledgeKanonHttpClientTimeoutInMs()5730 default int getFledgeKanonHttpClientTimeoutInMs() { 5731 return FLEDGE_DEFAULT_KANON_HTTP_CLIENT_TIMEOUT_IN_MS; 5732 } 5733 5734 /** 5735 * This method returns the boolean field determining whether to run background job when the 5736 * device's battery is low. 5737 */ getFledgeKAnonBackgroundJobRequiresBatteryNotLow()5738 default boolean getFledgeKAnonBackgroundJobRequiresBatteryNotLow() { 5739 return FLEDGE_DEFAULT_KANON_BACKGROUND_JOB_REQUIRES_BATTERY_NOT_LOW; 5740 } 5741 5742 /** 5743 * This method returns the boolean field determining whether to run background job when the 5744 * device is not idle. 5745 */ getFledgeKAnonBackgroundJobRequiresDeviceIdle()5746 default boolean getFledgeKAnonBackgroundJobRequiresDeviceIdle() { 5747 return FLEDGE_DEFAULT_KANON_BACKGROUND_JOB_REQUIRES_DEVICE_IDLE; 5748 } 5749 5750 /** 5751 * This method returns the value for connection type required field for kanon background job. 5752 * See {@link JobInfo#NETWORK_TYPE_UNMETERED} 5753 */ getFledgeKanonBackgroundJobConnectionType()5754 default int getFledgeKanonBackgroundJobConnectionType() { 5755 return FLEDGE_DEFAULT_KANON_BACKGROUND_JOB_CONNECTION_TYPE; 5756 } 5757 5758 /* 5759 * The allow-list for PP APIs. This list has the list of app package names that we allow 5760 * using PP APIs. 5761 * App Package Name that does not belong to this allow-list will not be able to use PP APIs. 5762 * If this list has special value "*", then all package names are allowed. 5763 * There must be not any empty space between comma. 5764 */ 5765 String GET_ADSERVICES_COMMON_STATES_ALLOW_LIST = "com.android.adservices.tests.ui.common"; 5766 5767 /** 5768 * Returns bypass List for Get AdServices Common States app signature check. Apps with package 5769 * name on this list will bypass the signature check 5770 */ getAdServicesCommonStatesAllowList()5771 default String getAdServicesCommonStatesAllowList() { 5772 return GET_ADSERVICES_COMMON_STATES_ALLOW_LIST; 5773 } 5774 5775 /** Default value for the base64 encoded Job Policy proto for AdServices. */ 5776 @ConfigFlag String AD_SERVICES_MODULE_JOB_POLICY = ""; 5777 5778 /** Returns the base64 encoded Job Policy proto for AdServices. */ getAdServicesModuleJobPolicy()5779 default String getAdServicesModuleJobPolicy() { 5780 return AD_SERVICES_MODULE_JOB_POLICY; 5781 } 5782 5783 /** 5784 * Default value for the enabled status of the {@link 5785 * com.android.adservices.service.common.RetryStrategy}. 5786 */ 5787 boolean DEFAULT_AD_SERVICES_RETRY_STRATEGY_ENABLED = false; 5788 5789 /** 5790 * Returns the enabled status of the AdServices {@link 5791 * com.android.adservices.service.common.RetryStrategy}. 5792 */ getAdServicesRetryStrategyEnabled()5793 default boolean getAdServicesRetryStrategyEnabled() { 5794 return DEFAULT_AD_SERVICES_RETRY_STRATEGY_ENABLED; 5795 } 5796 5797 /** 5798 * Default value for the max number of retry attempts for {@link 5799 * com.android.adservices.service.js.JSScriptEngine} 5800 */ 5801 int DEFAULT_AD_SERVICES_JS_SCRIPT_ENGINE_MAX_RETRY_ATTEMPTS = 1; 5802 5803 /** 5804 * Returns the max number of retry attempts for {@link 5805 * com.android.adservices.service.js.JSScriptEngine}. 5806 */ getAdServicesJsScriptEngineMaxRetryAttempts()5807 default int getAdServicesJsScriptEngineMaxRetryAttempts() { 5808 return DEFAULT_AD_SERVICES_JS_SCRIPT_ENGINE_MAX_RETRY_ATTEMPTS; 5809 } 5810 5811 /** Default value for consent manager v2 flag */ 5812 boolean DEFAULT_ENABLE_CONSENT_MANAGER_V2 = false; 5813 5814 /** Gets the Consent Manager V2 enable flag. */ getEnableConsentManagerV2()5815 default boolean getEnableConsentManagerV2() { 5816 return DEFAULT_ENABLE_CONSENT_MANAGER_V2; 5817 } 5818 5819 /** Protected app signals API extended metrics flag. */ 5820 boolean PAS_EXTENDED_METRICS_ENABLED = false; 5821 5822 /** Returns whether the PAS API extended metrics is enabled. */ getPasExtendedMetricsEnabled()5823 default boolean getPasExtendedMetricsEnabled() { 5824 return PAS_EXTENDED_METRICS_ENABLED; 5825 } 5826 5827 /** Protected app signals API product metrics v1 flag. */ 5828 @FeatureFlag boolean PAS_PRODUCT_METRICS_V1_ENABLED = false; 5829 5830 /** Returns whether to enable PAS API product metrics v1. */ getPasProductMetricsV1Enabled()5831 default boolean getPasProductMetricsV1Enabled() { 5832 return PAS_PRODUCT_METRICS_V1_ENABLED; 5833 } 5834 5835 /** Default enablement for applying SPE (Scheduling Policy Engine) to pilot jobs. */ 5836 @FeatureFlag boolean DEFAULT_SPE_ON_PILOT_JOBS_ENABLED = false; 5837 5838 /** Returns the default enablement of applying SPE (Scheduling Policy Engine) to pilot jobs. */ getSpeOnPilotJobsEnabled()5839 default boolean getSpeOnPilotJobsEnabled() { 5840 return DEFAULT_SPE_ON_PILOT_JOBS_ENABLED; 5841 } 5842 5843 /** A feature flag to enable the use of Enrollment API Based Schema. */ 5844 @FeatureFlag boolean ENROLLMENT_API_BASED_SCHEMA_ENABLED = false; 5845 5846 /** 5847 * @return the enabled status for enrollment api based schema. 5848 */ getEnrollmentApiBasedSchemaEnabled()5849 default boolean getEnrollmentApiBasedSchemaEnabled() { 5850 return ENROLLMENT_API_BASED_SCHEMA_ENABLED; 5851 } 5852 5853 /** Whether to enable shared database schema version 4 */ 5854 @FeatureFlag boolean SHARED_DATABASE_SCHEMA_VERSION_4_ENABLED = false; 5855 5856 /** 5857 * @return if to enable shared database schema version 4. 5858 */ getSharedDatabaseSchemaVersion4Enabled()5859 default boolean getSharedDatabaseSchemaVersion4Enabled() { 5860 return SHARED_DATABASE_SCHEMA_VERSION_4_ENABLED; 5861 } 5862 5863 /** Default value for table region fix flag. */ 5864 boolean DEFAULT_ENABLE_TABLET_REGION_FIX = false; 5865 5866 /** 5867 * @return if to enable tablet region fix. 5868 */ getEnableTabletRegionFix()5869 default boolean getEnableTabletRegionFix() { 5870 return DEFAULT_ENABLE_TABLET_REGION_FIX; 5871 } 5872 5873 /** Default value for custom error code sampling enabled. */ 5874 @FeatureFlag boolean DEFAULT_CUSTOM_ERROR_CODE_SAMPLING_ENABLED = false; 5875 5876 /** Returns {@code boolean} determining whether custom error code sampling is enabled. */ getCustomErrorCodeSamplingEnabled()5877 default boolean getCustomErrorCodeSamplingEnabled() { 5878 return DEFAULT_CUSTOM_ERROR_CODE_SAMPLING_ENABLED; 5879 } 5880 5881 /** Read timeout for downloading PAS encoding scripts in milliseconds */ 5882 int DEFAULT_PAS_SCRIPT_DOWNLOAD_READ_TIMEOUT_MS = 5000; 5883 5884 /** 5885 * @return Read timeout for downloading PAS encoding scripts in milliseconds 5886 */ getPasScriptDownloadReadTimeoutMs()5887 default int getPasScriptDownloadReadTimeoutMs() { 5888 return DEFAULT_PAS_SCRIPT_DOWNLOAD_READ_TIMEOUT_MS; 5889 } 5890 5891 /** Connection timeout for downloading PAS encoding scripts in milliseconds */ 5892 int DEFAULT_PAS_SCRIPT_DOWNLOAD_CONNECTION_TIMEOUT_MS = 5000; 5893 5894 /** 5895 * @return Connection timeout for downloading PAS encoding scripts in milliseconds 5896 */ getPasScriptDownloadConnectionTimeoutMs()5897 default int getPasScriptDownloadConnectionTimeoutMs() { 5898 return DEFAULT_PAS_SCRIPT_DOWNLOAD_CONNECTION_TIMEOUT_MS; 5899 } 5900 5901 /** Read timeout for downloading PAS signals in milliseconds */ 5902 int DEFAULT_PAS_SIGNALS_DOWNLOAD_READ_TIMEOUT_MS = 5000; 5903 5904 /** 5905 * @return Read timeout for downloading PAS signals in milliseconds 5906 */ getPasSignalsDownloadReadTimeoutMs()5907 default int getPasSignalsDownloadReadTimeoutMs() { 5908 return DEFAULT_PAS_SIGNALS_DOWNLOAD_READ_TIMEOUT_MS; 5909 } 5910 5911 /** Connection timeout for downloading PAS encoding signals in milliseconds */ 5912 int DEFAULT_PAS_SIGNALS_DOWNLOAD_CONNECTION_TIMEOUT_MS = 5000; 5913 5914 /** 5915 * @return Connection timeout for downloading PAS signals in milliseconds 5916 */ getPasSignalsDownloadConnectionTimeoutMs()5917 default int getPasSignalsDownloadConnectionTimeoutMs() { 5918 return DEFAULT_PAS_SIGNALS_DOWNLOAD_CONNECTION_TIMEOUT_MS; 5919 } 5920 5921 /** Timeout for executing PAS encoding scripts in milliseconds */ 5922 int DEFAULT_PAS_SCRIPT_EXECUTION_TIMEOUT_MS = 5000; 5923 5924 /** 5925 * @return Timeout for executing PAS encoding scripts in milliseconds 5926 */ getPasScriptExecutionTimeoutMs()5927 default int getPasScriptExecutionTimeoutMs() { 5928 return DEFAULT_PAS_SCRIPT_EXECUTION_TIMEOUT_MS; 5929 } 5930 5931 /** Default enablement for applying SPE (Scheduling Policy Engine) to the second pilot jobs. */ 5932 @FeatureFlag boolean DEFAULT_SPE_ON_PILOT_JOBS_BATCH_2_ENABLED = false; 5933 5934 /** 5935 * Returns the default enablement of applying SPE (Scheduling Policy Engine) to the second pilot 5936 * jobs. 5937 */ getSpeOnPilotJobsBatch2Enabled()5938 default boolean getSpeOnPilotJobsBatch2Enabled() { 5939 return DEFAULT_SPE_ON_PILOT_JOBS_BATCH_2_ENABLED; 5940 } 5941 5942 /** 5943 * Default enablement for applying SPE (Scheduling Policy Engine) to {@code EpochJobService}. 5944 */ 5945 @FeatureFlag boolean DEFAULT_SPE_ON_EPOCH_JOB_ENABLED = false; 5946 5947 /** 5948 * Returns the default enablement of applying SPE (Scheduling Policy Engine) to {@code 5949 * EpochJobService}. 5950 */ getSpeOnEpochJobEnabled()5951 default boolean getSpeOnEpochJobEnabled() { 5952 return DEFAULT_SPE_ON_EPOCH_JOB_ENABLED; 5953 } 5954 5955 /** 5956 * Default enablement for applying SPE (Scheduling Policy Engine) to {@code 5957 * BackgroundFetchJobService}. 5958 */ 5959 @FeatureFlag boolean DEFAULT_SPE_ON_BACKGROUND_FETCH_JOB_ENABLED = false; 5960 5961 /** 5962 * Returns the default enablement of applying SPE (Scheduling Policy Engine) to {@code 5963 * BackgroundFetchJobService}. 5964 */ getSpeOnBackgroundFetchJobEnabled()5965 default boolean getSpeOnBackgroundFetchJobEnabled() { 5966 return DEFAULT_SPE_ON_BACKGROUND_FETCH_JOB_ENABLED; 5967 } 5968 5969 /** 5970 * Default enablement for applying SPE (Scheduling Policy Engine) to {@code 5971 * AsyncRegistrationFallbackJobService}. 5972 */ 5973 @FeatureFlag boolean DEFAULT_SPE_ON_ASYNC_REGISTRATION_FALLBACK_JOB_ENABLED = false; 5974 5975 /** 5976 * Returns the default enablement of applying SPE (Scheduling Policy Engine) to {@code 5977 * AsyncRegistrationFallbackJobService}. 5978 */ getSpeOnAsyncRegistrationFallbackJobEnabled()5979 default boolean getSpeOnAsyncRegistrationFallbackJobEnabled() { 5980 return DEFAULT_SPE_ON_ASYNC_REGISTRATION_FALLBACK_JOB_ENABLED; 5981 } 5982 5983 /** Default value for the enablement the new apis for business logic migration. */ 5984 @FeatureFlag boolean DEFAULT_ADSERVICES_CONSENT_BUSINESS_LOGIC_MIGRATION_ENABLED = false; 5985 5986 /** Returns the default value of the enablement of adservices business logic migration. */ getAdServicesConsentBusinessLogicMigrationEnabled()5987 default boolean getAdServicesConsentBusinessLogicMigrationEnabled() { 5988 return DEFAULT_ADSERVICES_CONSENT_BUSINESS_LOGIC_MIGRATION_ENABLED; 5989 } 5990 5991 /** Default value for the enablement the R notification default consent fix. */ 5992 @FeatureFlag boolean DEFAULT_R_NOTIFICATION_DEFAULT_CONSENT_FIX_ENABLED = false; 5993 5994 /** Returns the default value for the enablement the R notification default consent fix */ getRNotificationDefaultConsentFixEnabled()5995 default boolean getRNotificationDefaultConsentFixEnabled() { 5996 return DEFAULT_R_NOTIFICATION_DEFAULT_CONSENT_FIX_ENABLED; 5997 } 5998 5999 /** Enrollment Manifest File URL, used to provide proto file for MDD download. */ 6000 @ConfigFlag String MDD_DEFAULT_ENROLLMENT_MANIFEST_FILE_URL = ""; 6001 6002 /** 6003 * @return default Enrollment Manifest File URL 6004 */ getMddEnrollmentManifestFileUrl()6005 default String getMddEnrollmentManifestFileUrl() { 6006 return MDD_DEFAULT_ENROLLMENT_MANIFEST_FILE_URL; 6007 } 6008 6009 /** Feature flag to ramp up use of enrollment proto file. */ 6010 @FeatureFlag boolean DEFAULT_ENROLLMENT_PROTO_FILE_ENABLED = false; 6011 6012 /** 6013 * @return whether to enable use of enrollment proto file. 6014 */ getEnrollmentProtoFileEnabled()6015 default boolean getEnrollmentProtoFileEnabled() { 6016 return DEFAULT_ENROLLMENT_PROTO_FILE_ENABLED; 6017 } 6018 6019 /** Protected app signals encoding job performance improvements flag. */ 6020 @FeatureFlag boolean PAS_ENCODING_JOB_IMPROVEMENTS_ENABLED = false; 6021 6022 /** Returns whether the PAS encoding job performance improvements are enabled. */ getPasEncodingJobImprovementsEnabled()6023 default boolean getPasEncodingJobImprovementsEnabled() { 6024 return PAS_ENCODING_JOB_IMPROVEMENTS_ENABLED; 6025 } 6026 6027 /** 6028 * Default value to determine whether {@link 6029 * com.android.adservices.service.adid.AdIdCacheManager} cache is timeout. 6030 */ 6031 @ConfigFlag long DEFAULT_ADID_CACHE_TTL_MS = 0; 6032 6033 /** 6034 * Returns {@link com.android.adservices.service.adid.AdIdCacheManager} ttl(time to live) time. 6035 * It will be used to expire the cached adid. 6036 * 6037 * <ul> 6038 * <li>if value is 0, the cache has no ttl. 6039 * <li>otherwise, check the stored time and current time inverval, if larger than the ttl, 6040 * refetch the adid. 6041 * </ul> 6042 * 6043 * Returns ttl of {@link com.android.adservices.service.adid.AdIdCacheManager}. 6044 */ getAdIdCacheTtlMs()6045 default long getAdIdCacheTtlMs() { 6046 return DEFAULT_ADID_CACHE_TTL_MS; 6047 } 6048 6049 /** Feature flag to ramp up use of package deny service. */ 6050 @FeatureFlag boolean DEFAULT_ENABLE_PACKAGE_DENY_SERVICE = false; 6051 6052 /** 6053 * @return whether to enable use of package deny service. 6054 */ getEnablePackageDenyService()6055 default boolean getEnablePackageDenyService() { 6056 return DEFAULT_ENABLE_PACKAGE_DENY_SERVICE; 6057 } 6058 6059 /** Feature flag to ramp up use of mdd package deny proto file. */ 6060 @FeatureFlag boolean DEFAULT_ENABLE_PACKAGE_DENY_MDD = false; 6061 6062 /** 6063 * @return whether to enable use of package deny mdd file. 6064 */ getEnablePackageDenyMdd()6065 default boolean getEnablePackageDenyMdd() { 6066 return DEFAULT_ENABLE_PACKAGE_DENY_MDD; 6067 } 6068 6069 /** Feature flag to ramp up use of package deny service on adding a package. */ 6070 @FeatureFlag boolean DEFAULT_ENABLE_PACKAGE_DENY_JOB_ON_PACKAGE_ADD = false; 6071 6072 /** 6073 * @return whether to enable use of package deny service on adding a package. 6074 */ getEnablePackageDenyJobOnPackageAdd()6075 default boolean getEnablePackageDenyJobOnPackageAdd() { 6076 return DEFAULT_ENABLE_PACKAGE_DENY_JOB_ON_PACKAGE_ADD; 6077 } 6078 6079 /** Feature flag to ramp up use of package deny preprocessing background job. */ 6080 @FeatureFlag boolean DEFAULT_ENABLE_PACKAGE_DENY_BG_JOB = false; 6081 6082 /** 6083 * @return whether to enable use of package deny preprocessing background job. 6084 */ getEnablePackageDenyBgJob()6085 default boolean getEnablePackageDenyBgJob() { 6086 return DEFAULT_ENABLE_PACKAGE_DENY_BG_JOB; 6087 } 6088 6089 /** Feature flag to ramp up use of package deny preprocessing on mdd file download. */ 6090 @FeatureFlag boolean DEFAULT_ENABLE_PACKAGE_DENY_JOB_ON_MDD_DOWNLOAD = false; 6091 6092 /** 6093 * @return whether to enable use of package deny preprocessing job on mdd file download. 6094 */ getEnablePackageDenyJobOnMddDownload()6095 default boolean getEnablePackageDenyJobOnMddDownload() { 6096 return DEFAULT_ENABLE_PACKAGE_DENY_JOB_ON_MDD_DOWNLOAD; 6097 } 6098 6099 /** MDD package deny registry manifest url. */ 6100 @ConfigFlag String DEFAULT_MDD_PACKAGE_DENY_REGISTRY_MANIFEST_FILE_URL = ""; 6101 6102 /** Returns MDD package deny registry manifest url. */ getMddPackageDenyRegistryManifestFileUrl()6103 default String getMddPackageDenyRegistryManifestFileUrl() { 6104 return DEFAULT_MDD_PACKAGE_DENY_REGISTRY_MANIFEST_FILE_URL; 6105 } 6106 6107 /** 6108 * Feature flag to enable enrollment configuration v3 delivery (mdd download + database 6109 * population). 6110 */ 6111 @FeatureFlag boolean DEFAULT_ENABLE_ENROLLMENT_CONFIG_V3_DB = false; 6112 6113 /** Enables enrollment configuration v3 delivery (mdd download + database population). */ getEnableEnrollmentConfigV3Db()6114 default boolean getEnableEnrollmentConfigV3Db() { 6115 return DEFAULT_ENABLE_ENROLLMENT_CONFIG_V3_DB; 6116 } 6117 6118 /** 6119 * Feature flag to provide latest mdd manifest urls for config delivery system. 6120 * 6121 * <p>Mdd manifest urls in this flag are separated by comma. 6122 * 6123 * <p>All file groups and files within the mdd manifest urls provided in this flag will be 6124 * downloaded. 6125 */ 6126 @FeatureFlag String DEFAULT_CONFIG_DELIVERY__MDD_MANIFEST_URLS = ""; 6127 6128 /** 6129 * @return latest mdd manifest urls for config delivery. 6130 */ getConfigDeliveryMddManifestUrls()6131 default String getConfigDeliveryMddManifestUrls() { 6132 return DEFAULT_CONFIG_DELIVERY__MDD_MANIFEST_URLS; 6133 } 6134 6135 /** Flag to use configurations manager to query enrollment data. */ 6136 @FeatureFlag boolean DEFAULT_USE_CONFIGS_MANAGER_TO_QUERY_ENROLLMENT = false; 6137 getUseConfigsManagerToQueryEnrollment()6138 default boolean getUseConfigsManagerToQueryEnrollment() { 6139 return DEFAULT_USE_CONFIGS_MANAGER_TO_QUERY_ENROLLMENT; 6140 } 6141 6142 @FeatureFlag boolean DEFAULT_PACKAGE_DENY_ENABLE_INSTALLED_PACKAGE_FILTER = false; 6143 6144 /** 6145 * @return whether to enable use of filtering of deny list based on installed packages 6146 */ getPackageDenyEnableInstalledPackageFilter()6147 default boolean getPackageDenyEnableInstalledPackageFilter() { 6148 return DEFAULT_PACKAGE_DENY_ENABLE_INSTALLED_PACKAGE_FILTER; 6149 } 6150 6151 @FeatureFlag long DEFAULT_PACKAGE_DENY_BACKGROUND_JOB_PERIOD_MILLIS = 43_200_000; // 12 hours 6152 6153 /** 6154 * @return package dny background job period in millis 6155 */ getPackageDenyBackgroundJobPeriodMillis()6156 default long getPackageDenyBackgroundJobPeriodMillis() { 6157 return DEFAULT_PACKAGE_DENY_BACKGROUND_JOB_PERIOD_MILLIS; 6158 } 6159 6160 /** Feature flag to enable AtomicFileDataStore update API for adservices apk. */ 6161 @FeatureFlag boolean DEFAULT_ENABLE_ATOMIC_FILE_DATASTORE_BATCH_UPDATE_API = false; 6162 6163 /** Returns whether atomic file datastore batch update Api is enabled. */ getEnableAtomicFileDatastoreBatchUpdateApi()6164 default boolean getEnableAtomicFileDatastoreBatchUpdateApi() { 6165 return DEFAULT_ENABLE_ATOMIC_FILE_DATASTORE_BATCH_UPDATE_API; 6166 } 6167 6168 /** Feature flag to enable Ad Id migration. */ 6169 @FeatureFlag boolean DEFAULT_AD_ID_MIGRATION_ENABLED = false; 6170 6171 /** Returns whether Ad Id migration is enabled. */ getAdIdMigrationEnabled()6172 default boolean getAdIdMigrationEnabled() { 6173 return DEFAULT_AD_ID_MIGRATION_ENABLED; 6174 } 6175 6176 boolean DEFAULT_ENABLE_REPORT_EVENT_FOR_COMPONENT_SELLER = false; 6177 6178 /** Returns if component seller as one of the destination in report event is enabled. */ getEnableReportEventForComponentSeller()6179 default boolean getEnableReportEventForComponentSeller() { 6180 return DEFAULT_ENABLE_REPORT_EVENT_FOR_COMPONENT_SELLER; 6181 } 6182 6183 boolean DEFAULT_ENABLE_WINNING_SELLER_ID_IN_AD_SELECTION_OUTCOME = false; 6184 6185 /** Returns if the winning seller id in AdSelectionOutcome is enabled. */ getEnableWinningSellerIdInAdSelectionOutcome()6186 default boolean getEnableWinningSellerIdInAdSelectionOutcome() { 6187 return DEFAULT_ENABLE_WINNING_SELLER_ID_IN_AD_SELECTION_OUTCOME; 6188 } 6189 6190 boolean DEFAULT_PROD_DEBUG_IN_AUCTION_SERVER = false; 6191 6192 /** Returns if the prod debug feature is enabled for server auctions. */ getEnableProdDebugInAuctionServer()6193 default boolean getEnableProdDebugInAuctionServer() { 6194 return DEFAULT_PROD_DEBUG_IN_AUCTION_SERVER; 6195 } 6196 6197 /** 6198 * Feature flag to enable the Android Trace to collect AdServices latency metrics in Crystalball 6199 * tests {@code RbATrace}. 6200 */ 6201 @FeatureFlag boolean DEFAULT_ENABLE_RB_ATRACE = false; 6202 6203 /** Returns whether the AdServices latency metrics {@code RbATrace} is enabled. */ getEnableRbAtrace()6204 default boolean getEnableRbAtrace() { 6205 return DEFAULT_ENABLE_RB_ATRACE; 6206 } 6207 6208 @FeatureFlag boolean DEFAULT_MSMT_REGISTER_SOURCE_PACKAGE_DENY_LIST = false; 6209 6210 /** Returns if the use of package deny list in msmt register source api */ getEnableMsmtRegisterSourcePackageDenyList()6211 default boolean getEnableMsmtRegisterSourcePackageDenyList() { 6212 return DEFAULT_MSMT_REGISTER_SOURCE_PACKAGE_DENY_LIST; 6213 } 6214 6215 @FeatureFlag boolean DEFAULT_MEASUREMENT_ENABLE_PACKAGE_NAME_UID_CHECK = true; 6216 6217 /** 6218 * Feature flag to check that the package name from the request belongs to the calling package's 6219 * uid. 6220 */ getMeasurementEnablePackageNameUidCheck()6221 default boolean getMeasurementEnablePackageNameUidCheck() { 6222 return DEFAULT_MEASUREMENT_ENABLE_PACKAGE_NAME_UID_CHECK; 6223 } 6224 6225 /** Feature flag to enable log sampling infra. */ 6226 @FeatureFlag boolean DEFAULT_ENABLE_LOG_SAMPLING_INFRA = false; 6227 6228 /** Returns if log sampling infra is enabled. */ getEnableLogSamplingInfra()6229 default boolean getEnableLogSamplingInfra() { 6230 return DEFAULT_ENABLE_LOG_SAMPLING_INFRA; 6231 } 6232 6233 /** 6234 * Default value for the base64 encoded LogSamplingConfig proto for AdServices job execution. 6235 */ 6236 @ConfigFlag String DEFAULT_AD_SERVICES_JOB_EXECUTION_SAMPLING_CONFIG = ""; 6237 6238 /** Returns the base64 encoded LogSamplingConfig for AdServices job execution. */ getAdServicesJobExecutionSamplingConfig()6239 default String getAdServicesJobExecutionSamplingConfig() { 6240 return DEFAULT_AD_SERVICES_JOB_EXECUTION_SAMPLING_CONFIG; 6241 } 6242 6243 /** 6244 * Default value for the base64 encoded LogSamplingConfig proto for AdServices job scheduling. 6245 */ 6246 @ConfigFlag String DEFAULT_AD_SERVICES_JOB_SCHEDULING_SAMPLING_CONFIG = ""; 6247 6248 /** Returns the base64 encoded LogSamplingConfig for AdServices job scheduling. */ getAdServicesJobSchedulingSamplingConfig()6249 default String getAdServicesJobSchedulingSamplingConfig() { 6250 return DEFAULT_AD_SERVICES_JOB_SCHEDULING_SAMPLING_CONFIG; 6251 } 6252 6253 /** 6254 * Default value for the base64 encoded LogSamplingConfig proto for AdServices client error 6255 * logging. 6256 */ 6257 @ConfigFlag String DEFAULT_AD_SERVICES_CEL_SAMPLING_CONFIG = ""; 6258 6259 /** Returns the base64 encoded LogSamplingConfig for AdServices client error logging. */ getAdServicesCelSamplingConfig()6260 default String getAdServicesCelSamplingConfig() { 6261 return DEFAULT_AD_SERVICES_CEL_SAMPLING_CONFIG; 6262 } 6263 6264 //////////////////////////////////////////////////////////////////////////////////////////////// 6265 // NOTE: Add new getters either above this comment, or closer to the relevant getters // 6266 //////////////////////////////////////////////////////////////////////////////////////////////// 6267 6268 /** Dump some debug info for the flags */ dump(PrintWriter writer, @Nullable String[] args)6269 default void dump(PrintWriter writer, @Nullable String[] args) {} 6270 6271 //////////////////////////////////////////////////////////////////////////////////////////////// 6272 // NOTE: do NOT add new getters down here // 6273 //////////////////////////////////////////////////////////////////////////////////////////////// 6274 } 6275