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.SERVER_AUCTION_COORDINATOR_SOURCE_UNSET; 20 21 import android.adservices.common.AdServicesStatusUtils; 22 23 import com.google.auto.value.AutoValue; 24 25 /** Class for GetAdSelectionData API called stats */ 26 @AutoValue 27 public abstract class GetAdSelectionDataApiCalledStats { 28 /** Returns the size of the payload in Kb after encryption and padding */ getPayloadSizeKb()29 public abstract int getPayloadSizeKb(); 30 31 /** Return number of buyers participating in this payload */ getNumBuyers()32 public abstract int getNumBuyers(); 33 34 /** The status response code of the GetAdSelectionData API in AdServices */ 35 @AdServicesStatusUtils.StatusCode getStatusCode()36 public abstract int getStatusCode(); 37 38 /** Return the coordinator source in this payload, i.e., DEFAULT or provided via API */ 39 @AdsRelevanceStatusUtils.ServerAuctionCoordinatorSource getServerAuctionCoordinatorSource()40 public abstract int getServerAuctionCoordinatorSource(); 41 42 /** Returns a generic builder. */ builder()43 public static Builder builder() { 44 return new AutoValue_GetAdSelectionDataApiCalledStats.Builder() 45 .setServerAuctionCoordinatorSource(SERVER_AUCTION_COORDINATOR_SOURCE_UNSET); 46 } 47 48 /** Builder class for GetAdSelectionDataApiCalledStats. */ 49 @AutoValue.Builder 50 public abstract static class Builder { 51 /** Sets the size of the payload in KB */ setPayloadSizeKb(int payloadSizeKb)52 public abstract Builder setPayloadSizeKb(int payloadSizeKb); 53 54 /** Sets the number of buyers. */ setNumBuyers(int numBuyers)55 public abstract Builder setNumBuyers(int numBuyers); 56 57 /** Sets the status code. */ setStatusCode(@dServicesStatusUtils.StatusCode int statusCode)58 public abstract Builder setStatusCode(@AdServicesStatusUtils.StatusCode int statusCode); 59 60 /** Sets the coordinator source in this payload, i.e., DEFAULT or provided via API. */ setServerAuctionCoordinatorSource( @dsRelevanceStatusUtils.ServerAuctionCoordinatorSource int coordinatorSource)61 public abstract Builder setServerAuctionCoordinatorSource( 62 @AdsRelevanceStatusUtils.ServerAuctionCoordinatorSource int coordinatorSource); 63 64 /** Builds the {@link GetAdSelectionDataApiCalledStats} object. */ build()65 public abstract GetAdSelectionDataApiCalledStats build(); 66 } 67 } 68