1 /* 2 * Copyright (C) 2021 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 android.car.watchdog; 18 19 import static com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport.BOILERPLATE_CODE; 20 21 import android.annotation.NonNull; 22 import android.annotation.SuppressLint; 23 import android.annotation.SystemApi; 24 import android.car.annotation.AddedInOrBefore; 25 import android.os.Parcelable; 26 27 import com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport; 28 import com.android.car.internal.util.DataClass; 29 30 /** 31 * System-wide disk I/O overuse alert threshold. 32 * 33 * @hide 34 */ 35 @SystemApi 36 @DataClass(genToString = true, genHiddenConstructor = true) 37 public final class IoOveruseAlertThreshold implements Parcelable { 38 /** 39 * Duration over which the given written bytes per second should be checked against. 40 * 41 * <p>Non-zero duration must provided in seconds. 42 */ 43 @SuppressLint({"MethodNameUnits"}) 44 private long mDurationInSeconds; 45 46 /** 47 * Alert I/O overuse on reaching the written bytes/second over {@link #mDurationInSeconds}. 48 * 49 * <p>Must provide non-zero bytes. 50 */ 51 private long mWrittenBytesPerSecond; 52 53 54 55 // Code below generated by codegen v1.0.22. 56 // 57 // DO NOT MODIFY! 58 // CHECKSTYLE:OFF Generated code 59 // 60 // To regenerate run: 61 // $ codegen $ANDROID_BUILD_TOP/packages/services/Car/car-lib/src/android/car/watchdog/IoOveruseAlertThreshold.java 62 // 63 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 64 // Settings > Editor > Code Style > Formatter Control 65 //@formatter:off 66 67 68 /** 69 * Creates a new IoOveruseAlertThreshold. 70 * 71 * @param durationInSeconds 72 * Duration over which the given written bytes per second should be checked against. 73 * 74 * <p>Non-zero duration must provided in seconds. 75 * @param writtenBytesPerSecond 76 * Alert I/O overuse on reaching the written bytes/second over {@link #mDurationInSeconds}. 77 * 78 * <p>Must provide non-zero bytes. 79 * @hide 80 */ 81 @DataClass.Generated.Member IoOveruseAlertThreshold( @uppressLint{ "MethodNameUnits" }) long durationInSeconds, long writtenBytesPerSecond)82 public IoOveruseAlertThreshold( 83 @SuppressLint({ "MethodNameUnits" }) long durationInSeconds, 84 long writtenBytesPerSecond) { 85 this.mDurationInSeconds = durationInSeconds; 86 this.mWrittenBytesPerSecond = writtenBytesPerSecond; 87 88 // onConstructed(); // You can define this method to get a callback 89 } 90 91 /** 92 * Duration over which the given written bytes per second should be checked against. 93 * 94 * <p>Non-zero duration must provided in seconds. 95 */ 96 @DataClass.Generated.Member 97 @AddedInOrBefore(majorVersion = 33) getDurationInSeconds()98 public @SuppressLint({ "MethodNameUnits" }) long getDurationInSeconds() { 99 return mDurationInSeconds; 100 } 101 102 /** 103 * Alert I/O overuse on reaching the written bytes/second over {@link #mDurationInSeconds}. 104 * 105 * <p>Must provide non-zero bytes. 106 */ 107 @DataClass.Generated.Member 108 @AddedInOrBefore(majorVersion = 33) getWrittenBytesPerSecond()109 public long getWrittenBytesPerSecond() { 110 return mWrittenBytesPerSecond; 111 } 112 113 @Override 114 @DataClass.Generated.Member 115 @AddedInOrBefore(majorVersion = 33) toString()116 public String toString() { 117 // You can override field toString logic by defining methods like: 118 // String fieldNameToString() { ... } 119 120 return "IoOveruseAlertThreshold { " + 121 "durationInSeconds = " + mDurationInSeconds + ", " + 122 "writtenBytesPerSecond = " + mWrittenBytesPerSecond + 123 " }"; 124 } 125 126 @Override 127 @DataClass.Generated.Member 128 @AddedInOrBefore(majorVersion = 33) writeToParcel(@onNull android.os.Parcel dest, int flags)129 public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { 130 // You can override field parcelling by defining methods like: 131 // void parcelFieldName(Parcel dest, int flags) { ... } 132 133 dest.writeLong(mDurationInSeconds); 134 dest.writeLong(mWrittenBytesPerSecond); 135 } 136 137 @Override 138 @DataClass.Generated.Member 139 @ExcludeFromCodeCoverageGeneratedReport(reason = BOILERPLATE_CODE) 140 @AddedInOrBefore(majorVersion = 33) describeContents()141 public int describeContents() { return 0; } 142 143 /** @hide */ 144 @SuppressWarnings({"unchecked", "RedundantCast"}) 145 @DataClass.Generated.Member IoOveruseAlertThreshold(@onNull android.os.Parcel in)146 /* package-private */ IoOveruseAlertThreshold(@NonNull android.os.Parcel in) { 147 // You can override field unparcelling by defining methods like: 148 // static FieldType unparcelFieldName(Parcel in) { ... } 149 150 long durationInSeconds = in.readLong(); 151 long writtenBytesPerSecond = in.readLong(); 152 153 this.mDurationInSeconds = durationInSeconds; 154 this.mWrittenBytesPerSecond = writtenBytesPerSecond; 155 156 // onConstructed(); // You can define this method to get a callback 157 } 158 159 @DataClass.Generated.Member 160 @AddedInOrBefore(majorVersion = 33) 161 public static final @NonNull Parcelable.Creator<IoOveruseAlertThreshold> CREATOR 162 = new Parcelable.Creator<IoOveruseAlertThreshold>() { 163 @Override 164 public IoOveruseAlertThreshold[] newArray(int size) { 165 return new IoOveruseAlertThreshold[size]; 166 } 167 168 @Override 169 public IoOveruseAlertThreshold createFromParcel(@NonNull android.os.Parcel in) { 170 return new IoOveruseAlertThreshold(in); 171 } 172 }; 173 174 @DataClass.Generated( 175 time = 1615312119067L, 176 codegenVersion = "1.0.22", 177 sourceFile = "packages/services/Car/car-lib/src/android/car/watchdog/IoOveruseAlertThreshold.java", 178 inputSignatures = "private @android.annotation.SuppressLint long mDurationInSeconds\nprivate long mWrittenBytesPerSecond\nclass IoOveruseAlertThreshold extends java.lang.Object implements [android.os.Parcelable]\n@com.android.car.internal.util.DataClass(genToString=true, genHiddenConstructor=true)") 179 @Deprecated 180 @ExcludeFromCodeCoverageGeneratedReport(reason = BOILERPLATE_CODE) __metadata()181 private void __metadata() {} 182 183 184 //@formatter:on 185 // End of generated code 186 187 } 188