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.kanon; 18 19 import static com.android.adservices.service.stats.kanon.KAnonSignJoinStatsConstants.KANON_ACTION_FAILURE_REASON_UNSET; 20 import static com.android.adservices.service.stats.kanon.KAnonSignJoinStatsConstants.KANON_ACTION_UNSET; 21 22 import com.google.auto.value.AutoValue; 23 24 @AutoValue 25 public abstract class KAnonSignStatusStats { 26 27 /** A boolean representing if the sign call was successful. */ getWasSuccessful()28 public abstract boolean getWasSuccessful(); 29 30 /** Batch size for the KAnon sign call. */ getBatchSize()31 public abstract int getBatchSize(); 32 33 /** The kanon action which caused the failure of the sign call. */ getKAnonAction()34 public abstract int getKAnonAction(); 35 36 /** Cause of the failure, if there was any failure. */ getKAnonActionFailureReason()37 public abstract int getKAnonActionFailureReason(); 38 39 /** The latency of the KAnon sign method in milliseconds. */ getLatencyInMs()40 public abstract int getLatencyInMs(); 41 42 /** Returns a builder class for {@link Builder} for {@link KAnonSignStatusStats} */ builder()43 public static Builder builder() { 44 return new AutoValue_KAnonSignStatusStats.Builder() 45 .setKAnonAction(KANON_ACTION_UNSET) 46 .setKAnonActionFailureReason(KANON_ACTION_FAILURE_REASON_UNSET); 47 } 48 49 @AutoValue.Builder 50 public abstract static class Builder { 51 /** Sets the wasSuccessful field for {@link KAnonSignStatusStats}. */ setWasSuccessful(boolean wasSuccessful)52 public abstract Builder setWasSuccessful(boolean wasSuccessful); 53 54 /** Sets the batch size for {@link KAnonSignStatusStats}. */ setBatchSize(int batchSize)55 public abstract Builder setBatchSize(int batchSize); 56 57 /** Sets the action field for {@link KAnonSignStatusStats}. */ setKAnonAction(int kAnonAction)58 public abstract Builder setKAnonAction(int kAnonAction); 59 60 /** Sets set batch field for {@link KAnonSignStatusStats}. */ setKAnonActionFailureReason(int kAnonActionFailureReason)61 public abstract Builder setKAnonActionFailureReason(int kAnonActionFailureReason); 62 63 /** Sets the latency for {@link KAnonSignStatusStats}. */ setLatencyInMs(int latencyInMs)64 public abstract Builder setLatencyInMs(int latencyInMs); 65 66 /** Builds and returns a {@link KAnonSignStatusStats} object */ build()67 public abstract KAnonSignStatusStats build(); 68 } 69 } 70