• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.service.stats;
18 
19 import static com.android.adservices.service.stats.AdsRelevanceStatusUtils.SCHEDULE_CA_UPDATE_EXISTING_UPDATE_STATUS_UNKNOWN;
20 
21 import com.google.auto.value.AutoValue;
22 
23 @AutoValue
24 public abstract class ScheduledCustomAudienceUpdateScheduleAttemptedStats {
25 
26     /** Returns the number of partial Custom Audiences. */
getNumberOfPartialCustomAudiences()27     public abstract int getNumberOfPartialCustomAudiences();
28 
29     /** Returns the number of leave Custom Audiences. */
getNumberOfLeaveCustomAudiences()30     public abstract int getNumberOfLeaveCustomAudiences();
31 
32     /** Returns the minimum delay in seconds. */
getMinimumDelayInMinutes()33     public abstract int getMinimumDelayInMinutes();
34 
35     /** Returns whether this was the initial hop. */
isInitialHop()36     public abstract boolean isInitialHop();
37 
38     /** Returns the existing update status. */
39     @AdsRelevanceStatusUtils.ScheduleCustomAudienceUpdateExistingUpdateStatus
getExistingUpdateStatus()40     public abstract int getExistingUpdateStatus();
41 
42     /**
43      * Returns a new builder for creating an instance of {@link
44      * ScheduledCustomAudienceUpdateScheduleAttemptedStats}.
45      */
builder()46     public static Builder builder() {
47         return new AutoValue_ScheduledCustomAudienceUpdateScheduleAttemptedStats.Builder()
48                 .setNumberOfLeaveCustomAudiences(0)
49                 .setInitialHop(true)
50                 .setExistingUpdateStatus(SCHEDULE_CA_UPDATE_EXISTING_UPDATE_STATUS_UNKNOWN);
51     }
52 
53     @AutoValue.Builder
54     public abstract static class Builder {
55         /** Sets the number of partial Custom Audiences. */
setNumberOfPartialCustomAudiences( int numberOfPartialCustomAudiences)56         public abstract Builder setNumberOfPartialCustomAudiences(
57                 int numberOfPartialCustomAudiences);
58 
59         /** Sets the number of partial Custom Audiences. */
setNumberOfLeaveCustomAudiences(int numberOfLeaveCustomAudiences)60         public abstract Builder setNumberOfLeaveCustomAudiences(int numberOfLeaveCustomAudiences);
61 
62         /** Sets the number of partial Custom Audiences. */
setMinimumDelayInMinutes(int minimumDelayInMinutes)63         public abstract Builder setMinimumDelayInMinutes(int minimumDelayInMinutes);
64 
65         /** Sets the number of partial Custom Audiences. */
setInitialHop(boolean initialHop)66         public abstract Builder setInitialHop(boolean initialHop);
67 
68         /** Sets the existing schedule CA update status in DB. */
setExistingUpdateStatus( @dsRelevanceStatusUtils.ScheduleCustomAudienceUpdateExistingUpdateStatus int value)69         public abstract Builder setExistingUpdateStatus(
70                 @AdsRelevanceStatusUtils.ScheduleCustomAudienceUpdateExistingUpdateStatus
71                         int value);
72 
73         /**
74          * Returns a new {@link ScheduledCustomAudienceUpdateScheduleAttemptedStats} instance built
75          * from the values set on this builder.
76          */
build()77         public abstract ScheduledCustomAudienceUpdateScheduleAttemptedStats build();
78     }
79 }
80