/* * Copyright (C) 2024 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_TRACE_EVENT__EVENT_TYPE__UNKNOWN; import static com.android.ondevicepersonalization.OnDevicePersonalizationStatsLog.ON_DEVICE_PERSONALIZATION_TRACE_EVENT__TASK_TYPE__TASK_TYPE_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 TraceEventStats { private int mTaskType = ON_DEVICE_PERSONALIZATION_TRACE_EVENT__TASK_TYPE__TASK_TYPE_UNKNOWN; private int mEventType = ON_DEVICE_PERSONALIZATION_TRACE_EVENT__EVENT_TYPE__UNKNOWN; private int mStatus = 0; private int mLatencyMillis = 0; @Nullable private String mServicePackageName = ""; // 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/TraceEventStats.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 */ TraceEventStats( int taskType, int eventType, int status, int latencyMillis, @Nullable String servicePackageName) { this.mTaskType = taskType; this.mEventType = eventType; this.mStatus = status; this.mLatencyMillis = latencyMillis; this.mServicePackageName = servicePackageName; // onConstructed(); // You can define this method to get a callback } @DataClass.Generated.Member public int getTaskType() { return mTaskType; } @DataClass.Generated.Member public int getEventType() { return mEventType; } @DataClass.Generated.Member public int getStatus() { return mStatus; } @DataClass.Generated.Member public int getLatencyMillis() { return mLatencyMillis; } @DataClass.Generated.Member public @Nullable String getServicePackageName() { return mServicePackageName; } @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(TraceEventStats other) { ... } // boolean fieldNameEquals(FieldType otherValue) { ... } if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; @SuppressWarnings("unchecked") TraceEventStats that = (TraceEventStats) o; //noinspection PointlessBooleanExpression return true && mTaskType == that.mTaskType && mEventType == that.mEventType && mStatus == that.mStatus && mLatencyMillis == that.mLatencyMillis && java.util.Objects.equals(mServicePackageName, that.mServicePackageName); } @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 + mTaskType; _hash = 31 * _hash + mEventType; _hash = 31 * _hash + mStatus; _hash = 31 * _hash + mLatencyMillis; _hash = 31 * _hash + java.util.Objects.hashCode(mServicePackageName); return _hash; } /** * A builder for {@link TraceEventStats} */ @SuppressWarnings("WeakerAccess") @DataClass.Generated.Member public static class Builder { private int mTaskType; private int mEventType; private int mStatus; private int mLatencyMillis; private @Nullable String mServicePackageName; private long mBuilderFieldsSet = 0L; public Builder() { } @DataClass.Generated.Member public @android.annotation.NonNull Builder setTaskType(int value) { checkNotUsed(); mBuilderFieldsSet |= 0x1; mTaskType = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull Builder setEventType(int value) { checkNotUsed(); mBuilderFieldsSet |= 0x2; mEventType = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull Builder setStatus(int value) { checkNotUsed(); mBuilderFieldsSet |= 0x4; mStatus = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull Builder setLatencyMillis(int value) { checkNotUsed(); mBuilderFieldsSet |= 0x8; mLatencyMillis = value; return this; } @DataClass.Generated.Member public @android.annotation.NonNull Builder setServicePackageName(@android.annotation.NonNull String value) { checkNotUsed(); mBuilderFieldsSet |= 0x10; mServicePackageName = value; return this; } /** Builds the instance. This builder should not be touched after calling this! */ public @android.annotation.NonNull TraceEventStats build() { checkNotUsed(); mBuilderFieldsSet |= 0x20; // Mark builder used if ((mBuilderFieldsSet & 0x1) == 0) { mTaskType = 0; } if ((mBuilderFieldsSet & 0x2) == 0) { mEventType = 0; } if ((mBuilderFieldsSet & 0x4) == 0) { mStatus = 0; } if ((mBuilderFieldsSet & 0x8) == 0) { mLatencyMillis = 0; } if ((mBuilderFieldsSet & 0x10) == 0) { mServicePackageName = ""; } TraceEventStats o = new TraceEventStats( mTaskType, mEventType, mStatus, mLatencyMillis, mServicePackageName); return o; } private void checkNotUsed() { if ((mBuilderFieldsSet & 0x20) != 0) { throw new IllegalStateException( "This Builder should not be reused. Use a new Builder instance instead"); } } } @DataClass.Generated( time = 1728943962441L, codegenVersion = "1.0.23", sourceFile = "packages/modules/OnDevicePersonalization/src/com/android/ondevicepersonalization/services/statsd/TraceEventStats.java", inputSignatures = "private int mTaskType\nprivate int mEventType\nprivate int mStatus\nprivate int mLatencyMillis\nprivate @android.annotation.Nullable java.lang.String mServicePackageName\nclass TraceEventStats 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 }