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.ondevicepersonalization.services.statsd; 18 19 import static com.android.ondevicepersonalization.OnDevicePersonalizationStatsLog.ON_DEVICE_PERSONALIZATION_TRACE_EVENT__EVENT_TYPE__UNKNOWN; 20 import static com.android.ondevicepersonalization.OnDevicePersonalizationStatsLog.ON_DEVICE_PERSONALIZATION_TRACE_EVENT__TASK_TYPE__TASK_TYPE_UNKNOWN; 21 22 import android.annotation.Nullable; 23 24 import com.android.ondevicepersonalization.internal.util.DataClass; 25 26 /** 27 * Class holds OnDevicePersonalizationApiCalled defined at 28 * frameworks/proto_logging/stats/atoms/ondevicepersonalization/ondevicepersonalization_extension_atoms.proto 29 */ 30 @DataClass(genBuilder = true, genEqualsHashCode = true) 31 public class TraceEventStats { 32 private int mTaskType = ON_DEVICE_PERSONALIZATION_TRACE_EVENT__TASK_TYPE__TASK_TYPE_UNKNOWN; 33 private int mEventType = ON_DEVICE_PERSONALIZATION_TRACE_EVENT__EVENT_TYPE__UNKNOWN; 34 private int mStatus = 0; 35 private int mLatencyMillis = 0; 36 @Nullable private String mServicePackageName = ""; 37 38 39 40 // Code below generated by codegen v1.0.23. 41 // 42 // DO NOT MODIFY! 43 // CHECKSTYLE:OFF Generated code 44 // 45 // To regenerate run: 46 // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/src/com/android/ondevicepersonalization/services/statsd/TraceEventStats.java 47 // 48 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 49 // Settings > Editor > Code Style > Formatter Control 50 //@formatter:off 51 52 53 @DataClass.Generated.Member TraceEventStats( int taskType, int eventType, int status, int latencyMillis, @Nullable String servicePackageName)54 /* package-private */ TraceEventStats( 55 int taskType, 56 int eventType, 57 int status, 58 int latencyMillis, 59 @Nullable String servicePackageName) { 60 this.mTaskType = taskType; 61 this.mEventType = eventType; 62 this.mStatus = status; 63 this.mLatencyMillis = latencyMillis; 64 this.mServicePackageName = servicePackageName; 65 66 // onConstructed(); // You can define this method to get a callback 67 } 68 69 @DataClass.Generated.Member getTaskType()70 public int getTaskType() { 71 return mTaskType; 72 } 73 74 @DataClass.Generated.Member getEventType()75 public int getEventType() { 76 return mEventType; 77 } 78 79 @DataClass.Generated.Member getStatus()80 public int getStatus() { 81 return mStatus; 82 } 83 84 @DataClass.Generated.Member getLatencyMillis()85 public int getLatencyMillis() { 86 return mLatencyMillis; 87 } 88 89 @DataClass.Generated.Member getServicePackageName()90 public @Nullable String getServicePackageName() { 91 return mServicePackageName; 92 } 93 94 @Override 95 @DataClass.Generated.Member equals(@ullable Object o)96 public boolean equals(@Nullable Object o) { 97 // You can override field equality logic by defining either of the methods like: 98 // boolean fieldNameEquals(TraceEventStats other) { ... } 99 // boolean fieldNameEquals(FieldType otherValue) { ... } 100 101 if (this == o) return true; 102 if (o == null || getClass() != o.getClass()) return false; 103 @SuppressWarnings("unchecked") 104 TraceEventStats that = (TraceEventStats) o; 105 //noinspection PointlessBooleanExpression 106 return true 107 && mTaskType == that.mTaskType 108 && mEventType == that.mEventType 109 && mStatus == that.mStatus 110 && mLatencyMillis == that.mLatencyMillis 111 && java.util.Objects.equals(mServicePackageName, that.mServicePackageName); 112 } 113 114 @Override 115 @DataClass.Generated.Member hashCode()116 public int hashCode() { 117 // You can override field hashCode logic by defining methods like: 118 // int fieldNameHashCode() { ... } 119 120 int _hash = 1; 121 _hash = 31 * _hash + mTaskType; 122 _hash = 31 * _hash + mEventType; 123 _hash = 31 * _hash + mStatus; 124 _hash = 31 * _hash + mLatencyMillis; 125 _hash = 31 * _hash + java.util.Objects.hashCode(mServicePackageName); 126 return _hash; 127 } 128 129 /** 130 * A builder for {@link TraceEventStats} 131 */ 132 @SuppressWarnings("WeakerAccess") 133 @DataClass.Generated.Member 134 public static class Builder { 135 136 private int mTaskType; 137 private int mEventType; 138 private int mStatus; 139 private int mLatencyMillis; 140 private @Nullable String mServicePackageName; 141 142 private long mBuilderFieldsSet = 0L; 143 Builder()144 public Builder() { 145 } 146 147 @DataClass.Generated.Member setTaskType(int value)148 public @android.annotation.NonNull Builder setTaskType(int value) { 149 checkNotUsed(); 150 mBuilderFieldsSet |= 0x1; 151 mTaskType = value; 152 return this; 153 } 154 155 @DataClass.Generated.Member setEventType(int value)156 public @android.annotation.NonNull Builder setEventType(int value) { 157 checkNotUsed(); 158 mBuilderFieldsSet |= 0x2; 159 mEventType = value; 160 return this; 161 } 162 163 @DataClass.Generated.Member setStatus(int value)164 public @android.annotation.NonNull Builder setStatus(int value) { 165 checkNotUsed(); 166 mBuilderFieldsSet |= 0x4; 167 mStatus = value; 168 return this; 169 } 170 171 @DataClass.Generated.Member setLatencyMillis(int value)172 public @android.annotation.NonNull Builder setLatencyMillis(int value) { 173 checkNotUsed(); 174 mBuilderFieldsSet |= 0x8; 175 mLatencyMillis = value; 176 return this; 177 } 178 179 @DataClass.Generated.Member setServicePackageName(@ndroid.annotation.NonNull String value)180 public @android.annotation.NonNull Builder setServicePackageName(@android.annotation.NonNull String value) { 181 checkNotUsed(); 182 mBuilderFieldsSet |= 0x10; 183 mServicePackageName = value; 184 return this; 185 } 186 187 /** Builds the instance. This builder should not be touched after calling this! */ build()188 public @android.annotation.NonNull TraceEventStats build() { 189 checkNotUsed(); 190 mBuilderFieldsSet |= 0x20; // Mark builder used 191 192 if ((mBuilderFieldsSet & 0x1) == 0) { 193 mTaskType = 0; 194 } 195 if ((mBuilderFieldsSet & 0x2) == 0) { 196 mEventType = 0; 197 } 198 if ((mBuilderFieldsSet & 0x4) == 0) { 199 mStatus = 0; 200 } 201 if ((mBuilderFieldsSet & 0x8) == 0) { 202 mLatencyMillis = 0; 203 } 204 if ((mBuilderFieldsSet & 0x10) == 0) { 205 mServicePackageName = ""; 206 } 207 TraceEventStats o = new TraceEventStats( 208 mTaskType, 209 mEventType, 210 mStatus, 211 mLatencyMillis, 212 mServicePackageName); 213 return o; 214 } 215 checkNotUsed()216 private void checkNotUsed() { 217 if ((mBuilderFieldsSet & 0x20) != 0) { 218 throw new IllegalStateException( 219 "This Builder should not be reused. Use a new Builder instance instead"); 220 } 221 } 222 } 223 224 @DataClass.Generated( 225 time = 1728943962441L, 226 codegenVersion = "1.0.23", 227 sourceFile = "packages/modules/OnDevicePersonalization/src/com/android/ondevicepersonalization/services/statsd/TraceEventStats.java", 228 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)") 229 @Deprecated __metadata()230 private void __metadata() {} 231 232 233 //@formatter:on 234 // End of generated code 235 236 } 237