/* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.ondevicepersonalization.services.statsd; import static com.android.ondevicepersonalization.OnDevicePersonalizationStatsLog.ON_DEVICE_PERSONALIZATION_API_CALLED__API_CLASS__UNKNOWN; import android.annotation.Nullable; import com.android.ondevicepersonalization.internal.util.DataClass; /** * Class holds OnDevicePersonalizationApiCalled defined at * frameworks/proto_logging/stats/atoms/ondevicepersonalization/ondevicepersonalization_extension_atoms.proto */ @DataClass(genBuilder = true, genEqualsHashCode = true) public class ApiCallStats { private int mApiClass = ON_DEVICE_PERSONALIZATION_API_CALLED__API_CLASS__UNKNOWN; private final int mApiName; private int mLatencyMillis = 0; private int mResponseCode = 0; private int mOverheadLatencyMillis = 0; private int mAppUid = 0; @Nullable private String mSdkPackageName = ""; private int mRpcCallLatencyMillis = 0; private int mRpcReturnLatencyMillis = 0; // Code below generated by codegen v1.0.23. // // DO NOT MODIFY! // CHECKSTYLE:OFF Generated code // // To regenerate run: // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/src/com/android/ondevicepersonalization/services/statsd/ApiCallStats.java // // To exclude the generated code from IntelliJ auto-formatting enable (one-time): // Settings > Editor > Code Style > Formatter Control //@formatter:off @DataClass.Generated.Member /* package-private */ ApiCallStats( int apiClass, int apiName, int latencyMillis, int responseCode, int overheadLatencyMillis, int appUid, @Nullable String sdkPackageName, int rpcCallLatencyMillis, int rpcReturnLatencyMillis) { this.mApiClass = apiClass; this.mApiName = apiName; this.mLatencyMillis = latencyMillis; this.mResponseCode = responseCode; this.mOverheadLatencyMillis = overheadLatencyMillis; this.mAppUid = appUid; this.mSdkPackageName = sdkPackageName; this.mRpcCallLatencyMillis = rpcCallLatencyMillis; this.mRpcReturnLatencyMillis = rpcReturnLatencyMillis; // onConstructed(); // You can define this method to get a callback } @DataClass.Generated.Member public int getApiClass() { return mApiClass; } @DataClass.Generated.Member public int getApiName() { return mApiName; } @DataClass.Generated.Member public int getLatencyMillis() { return mLatencyMillis; } @DataClass.Generated.Member public int getResponseCode() { return mResponseCode; } @DataClass.Generated.Member public int getOverheadLatencyMillis() { return mOverheadLatencyMillis; } @DataClass.Generated.Member public int getAppUid() { return mAppUid; } @DataClass.Generated.Member public @Nullable String getSdkPackageName() { return mSdkPackageName; } @DataClass.Generated.Member public int getRpcCallLatencyMillis() { return mRpcCallLatencyMillis; } @DataClass.Generated.Member public int getRpcReturnLatencyMillis() { return mRpcReturnLatencyMillis; } @Override @DataClass.Generated.Member public boolean equals(@Nullable Object o) { // You can override field equality logic by defining either of the methods like: // boolean fieldNameEquals(ApiCallStats other) { ... } // boolean fieldNameEquals(FieldType otherValue) { ... } if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; @SuppressWarnings("unchecked") ApiCallStats that = (ApiCallStats) o; //noinspection PointlessBooleanExpression return true && mApiClass == that.mApiClass && mApiName == that.mApiName && mLatencyMillis == that.mLatencyMillis && mResponseCode == that.mResponseCode && mOverheadLatencyMillis == that.mOverheadLatencyMillis && mAppUid == that.mAppUid && java.util.Objects.equals(mSdkPackageName, that.mSdkPackageName) && mRpcCallLatencyMillis == that.mRpcCallLatencyMillis && mRpcReturnLatencyMillis == that.mRpcReturnLatencyMillis; } @Override @DataClass.Generated.Member public int hashCode() { // You can override field hashCode logic by defining methods like: // int fieldNameHashCode() { ... } int _hash = 1; _hash = 31 * _hash + mApiClass; _hash = 31 * _hash + mApiName; _hash = 31 * _hash + mLatencyMillis; _hash = 31 * _hash + mResponseCode; _hash = 31 * _hash + mOverheadLatencyMillis; _hash = 31 * _hash + mAppUid; _hash = 31 * _hash + java.util.Objects.hashCode(mSdkPackageName); _hash = 31 * _hash + mRpcCallLatencyMillis; _hash = 31 * _hash + mRpcReturnLatencyMillis; return _hash; } /** * A builder for {@link ApiCallStats} */ @SuppressWarnings("WeakerAccess") @DataClass.Generated.Member public static class Builder { private int mApiClass; private int mApiName; private int mLatencyMillis; private int mResponseCode; private int mOverheadLatencyMillis; private int mAppUid; private @Nullable String mSdkPackageName; private int mRpcCallLatencyMillis; private int mRpcReturnLatencyMillis; private long mBuilderFieldsSet = 0L; public Builder( int apiName) { mApiName = apiName; } @DataClass.Generated.Member public @android.annotation.NonNull Builder setApiClass(int value) { checkNotUsed(); mBuilderFieldsSet |= 0x1; mApiClass = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull Builder setApiName(int value) { checkNotUsed(); mBuilderFieldsSet |= 0x2; mApiName = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull Builder setLatencyMillis(int value) { checkNotUsed(); mBuilderFieldsSet |= 0x4; mLatencyMillis = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull Builder setResponseCode(int value) { checkNotUsed(); mBuilderFieldsSet |= 0x8; mResponseCode = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull Builder setOverheadLatencyMillis(int value) { checkNotUsed(); mBuilderFieldsSet |= 0x10; mOverheadLatencyMillis = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull Builder setAppUid(int value) { checkNotUsed(); mBuilderFieldsSet |= 0x20; mAppUid = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull Builder setSdkPackageName(@android.annotation.NonNull String value) { checkNotUsed(); mBuilderFieldsSet |= 0x40; mSdkPackageName = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull Builder setRpcCallLatencyMillis(int value) { checkNotUsed(); mBuilderFieldsSet |= 0x80; mRpcCallLatencyMillis = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull Builder setRpcReturnLatencyMillis(int value) { checkNotUsed(); mBuilderFieldsSet |= 0x100; mRpcReturnLatencyMillis = value; return this; } /** Builds the instance. This builder should not be touched after calling this! */ public @android.annotation.NonNull ApiCallStats build() { checkNotUsed(); mBuilderFieldsSet |= 0x200; // Mark builder used if ((mBuilderFieldsSet & 0x1) == 0) { mApiClass = ON_DEVICE_PERSONALIZATION_API_CALLED__API_CLASS__UNKNOWN; } if ((mBuilderFieldsSet & 0x4) == 0) { mLatencyMillis = 0; } if ((mBuilderFieldsSet & 0x8) == 0) { mResponseCode = 0; } if ((mBuilderFieldsSet & 0x10) == 0) { mOverheadLatencyMillis = 0; } if ((mBuilderFieldsSet & 0x20) == 0) { mAppUid = 0; } if ((mBuilderFieldsSet & 0x40) == 0) { mSdkPackageName = ""; } if ((mBuilderFieldsSet & 0x80) == 0) { mRpcCallLatencyMillis = 0; } if ((mBuilderFieldsSet & 0x100) == 0) { mRpcReturnLatencyMillis = 0; } ApiCallStats o = new ApiCallStats( mApiClass, mApiName, mLatencyMillis, mResponseCode, mOverheadLatencyMillis, mAppUid, mSdkPackageName, mRpcCallLatencyMillis, mRpcReturnLatencyMillis); return o; } private void checkNotUsed() { if ((mBuilderFieldsSet & 0x200) != 0) { throw new IllegalStateException( "This Builder should not be reused. Use a new Builder instance instead"); } } } @DataClass.Generated( time = 1716244029076L, codegenVersion = "1.0.23", sourceFile = "packages/modules/OnDevicePersonalization/src/com/android/ondevicepersonalization/services/statsd/ApiCallStats.java", inputSignatures = "private int mApiClass\nprivate final int mApiName\nprivate int mLatencyMillis\nprivate int mResponseCode\nprivate int mOverheadLatencyMillis\nprivate int mAppUid\nprivate @android.annotation.Nullable java.lang.String mSdkPackageName\nprivate int mRpcCallLatencyMillis\nprivate int mRpcReturnLatencyMillis\nclass ApiCallStats extends java.lang.Object implements []\n@com.android.ondevicepersonalization.internal.util.DataClass(genBuilder=true, genEqualsHashCode=true)") @Deprecated private void __metadata() {} //@formatter:on // End of generated code }