1 /* 2 * Copyright (C) 2024 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.shared.common.flags; 18 19 import static com.android.adservices.shared.common.flags.FeatureFlag.Type.SHARED; 20 21 /** 22 * This class contains common flags used by multiple modules. In principle if a module wants to use 23 * a flag, it should implement the method in this class by pointing to the method to its own flags. 24 * This is because the shared directory contains only libraries, the roll-out should happen in the 25 * module which actually uses the libraries. 26 */ 27 public interface ModuleSharedFlags { 28 /** The default value of whether background job logging is enabled. */ 29 @FeatureFlag(SHARED) 30 boolean BACKGROUND_JOB_LOGGING_ENABLED = false; 31 32 /** Get if background job logging is enabled or not. */ getBackgroundJobsLoggingEnabled()33 default boolean getBackgroundJobsLoggingEnabled() { 34 return BACKGROUND_JOB_LOGGING_ENABLED; 35 } 36 37 /** The default value of background job sampling logging rate. */ 38 @ConfigFlag int BACKGROUND_JOB_SAMPLING_LOGGING_RATE = 1; 39 40 /** Gets the value of background job sampling logging rate. */ getBackgroundJobSamplingLoggingRate()41 default int getBackgroundJobSamplingLoggingRate() { 42 return BACKGROUND_JOB_SAMPLING_LOGGING_RATE; 43 } 44 45 /** Default value for the enablement of background job scheduling logging. */ 46 @FeatureFlag(SHARED) 47 boolean DEFAULT_JOB_SCHEDULING_LOGGING_ENABLED = false; 48 49 /** Returns the default value of the enablement of background job scheduling logging. */ getJobSchedulingLoggingEnabled()50 default boolean getJobSchedulingLoggingEnabled() { 51 return DEFAULT_JOB_SCHEDULING_LOGGING_ENABLED; 52 } 53 54 /** Default value of the sampling logging rate for job scheduling logging events. */ 55 @ConfigFlag int DEFAULT_JOB_SCHEDULING_LOGGING_SAMPLING_RATE = 5; 56 57 /** Returns the sampling logging rate for job scheduling logging events. */ getJobSchedulingLoggingSamplingRate()58 default int getJobSchedulingLoggingSamplingRate() { 59 return DEFAULT_JOB_SCHEDULING_LOGGING_SAMPLING_RATE; 60 } 61 62 /** 63 * Base64 encoded String which describes a map of sampling interval to a list of error codes. 64 */ 65 @ConfigFlag String ENCODED_ERROR_CODE_LIST_PER_SAMPLE_INTERVAL = ""; 66 getEncodedErrorCodeListPerSampleInterval()67 default String getEncodedErrorCodeListPerSampleInterval() { 68 return ENCODED_ERROR_CODE_LIST_PER_SAMPLE_INTERVAL; 69 } 70 } 71