1 /* 2 * Copyright (C) 2020 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.input; 18 19 import static com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport.BOILERPLATE_CODE; 20 21 import android.annotation.NonNull; 22 import android.annotation.SystemApi; 23 import android.os.Parcel; 24 import android.os.Parcelable; 25 26 import com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport; 27 import com.android.car.internal.util.DataClass; 28 29 /** 30 * {@code Parcelable} containing custom input event. 31 * 32 * <p>A custom input event representing HW_CUSTOM_INPUT event defined in 33 * {@code hardware/interfaces/automotive/vehicle/2.0/types.hal}. 34 * 35 * @hide 36 */ 37 @SystemApi 38 @DataClass( 39 genEqualsHashCode = true, 40 genAidl = true) 41 public final class CustomInputEvent implements Parcelable { 42 43 // The following constant values must be in sync with the ones defined in 44 // {@code hardware/interfaces/automotive/vehicle/2.0/types.hal} 45 public static final int INPUT_CODE_F1 = 1001; 46 public static final int INPUT_CODE_F2 = 1002; 47 public static final int INPUT_CODE_F3 = 1003; 48 public static final int INPUT_CODE_F4 = 1004; 49 public static final int INPUT_CODE_F5 = 1005; 50 public static final int INPUT_CODE_F6 = 1006; 51 public static final int INPUT_CODE_F7 = 1007; 52 public static final int INPUT_CODE_F8 = 1008; 53 public static final int INPUT_CODE_F9 = 1009; 54 public static final int INPUT_CODE_F10 = 1010; 55 56 private final int mInputCode; 57 58 private final int mTargetDisplayType; 59 private final int mRepeatCounter; 60 61 62 // Code below generated by codegen v1.0.15. 63 // 64 // Note: Fields and methods related to INPUT_CODE were manually edited in order to remove the 65 // value range constraints in #mInputCode. 66 // 67 // CHECKSTYLE:OFF Generated code 68 // To regenerate run: 69 // $ codegen --to-string $ANDROID_BUILD_TOP/packages/services/Car/car-lib/src/android/car 70 // /input/CustomInputEvent.java 71 // Added AddedInOrBefore or ApiRequirement Annotation manually 72 // 73 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 74 // Settings > Editor > Code Style > Formatter Control 75 //@formatter:off 76 77 @DataClass.Generated.Member 78 @NonNull inputCodeToString(int value)79 public static String inputCodeToString(int value) { 80 return Integer.toString(value); 81 } 82 83 @DataClass.Generated.Member CustomInputEvent( int inputCode, int targetDisplayType, int repeatCounter)84 public CustomInputEvent( 85 int inputCode, 86 int targetDisplayType, 87 int repeatCounter) { 88 89 this.mInputCode = inputCode; 90 this.mTargetDisplayType = targetDisplayType; 91 this.mRepeatCounter = repeatCounter; 92 93 // onConstructed(); // You can define this method to get a callback 94 } 95 96 @DataClass.Generated.Member getInputCode()97 public int getInputCode() { 98 return mInputCode; 99 } 100 101 @DataClass.Generated.Member getTargetDisplayType()102 public int getTargetDisplayType() { 103 return mTargetDisplayType; 104 } 105 106 @DataClass.Generated.Member getRepeatCounter()107 public int getRepeatCounter() { 108 return mRepeatCounter; 109 } 110 111 @Override 112 @DataClass.Generated.Member 113 @ExcludeFromCodeCoverageGeneratedReport(reason = BOILERPLATE_CODE) toString()114 public String toString() { 115 // You can override field toString logic by defining methods like: 116 // String fieldNameToString() { ... } 117 118 return "CustomInputEvent { " + 119 "inputCode = " + mInputCode + ", " + 120 "targetDisplayType = " + mTargetDisplayType + ", " + 121 "repeatCounter = " + mRepeatCounter + 122 " }"; 123 } 124 125 @Override 126 @DataClass.Generated.Member 127 @ExcludeFromCodeCoverageGeneratedReport(reason = BOILERPLATE_CODE) equals(@ndroid.annotation.Nullable Object o)128 public boolean equals(@android.annotation.Nullable Object o) { 129 // You can override field equality logic by defining either of the methods like: 130 // boolean fieldNameEquals(CustomInputEvent other) { ... } 131 // boolean fieldNameEquals(FieldType otherValue) { ... } 132 133 if (this == o) return true; 134 if (o == null || getClass() != o.getClass()) return false; 135 @SuppressWarnings("unchecked") 136 CustomInputEvent that = (CustomInputEvent) o; 137 //noinspection PointlessBooleanExpression 138 return true 139 && mInputCode == that.mInputCode 140 && mTargetDisplayType == that.mTargetDisplayType 141 && mRepeatCounter == that.mRepeatCounter; 142 } 143 144 @Override 145 @DataClass.Generated.Member 146 @ExcludeFromCodeCoverageGeneratedReport(reason = BOILERPLATE_CODE) hashCode()147 public int hashCode() { 148 // You can override field hashCode logic by defining methods like: 149 // int fieldNameHashCode() { ... } 150 151 int _hash = 1; 152 _hash = 31 * _hash + mInputCode; 153 _hash = 31 * _hash + mTargetDisplayType; 154 _hash = 31 * _hash + mRepeatCounter; 155 return _hash; 156 } 157 158 @Override 159 @DataClass.Generated.Member writeToParcel(@onNull Parcel dest, int flags)160 public void writeToParcel(@NonNull Parcel dest, int flags) { 161 // You can override field parcelling by defining methods like: 162 // void parcelFieldName(Parcel dest, int flags) { ... } 163 164 dest.writeInt(mInputCode); 165 dest.writeInt(mTargetDisplayType); 166 dest.writeInt(mRepeatCounter); 167 } 168 169 @Override 170 @DataClass.Generated.Member 171 @ExcludeFromCodeCoverageGeneratedReport(reason = BOILERPLATE_CODE) describeContents()172 public int describeContents() { 173 return 0; 174 } 175 176 /** @hide */ 177 @SuppressWarnings({"unchecked", "RedundantCast"}) 178 @DataClass.Generated.Member CustomInputEvent(@onNull Parcel in)179 /* package-private */ CustomInputEvent(@NonNull Parcel in) { 180 // You can override field unparcelling by defining methods like: 181 // static FieldType unparcelFieldName(Parcel in) { ... } 182 183 this.mInputCode = in.readInt(); 184 this.mTargetDisplayType = in.readInt(); 185 this.mRepeatCounter = in.readInt(); 186 187 // onConstructed(); // You can define this method to get a callback 188 } 189 190 @DataClass.Generated.Member 191 public static final @NonNull 192 Parcelable.Creator<CustomInputEvent> CREATOR 193 = new Parcelable.Creator<CustomInputEvent>() { 194 @Override 195 public CustomInputEvent[] newArray(int size) { 196 return new CustomInputEvent[size]; 197 } 198 199 @Override 200 public CustomInputEvent createFromParcel(@NonNull Parcel in) { 201 return new CustomInputEvent(in); 202 } 203 }; 204 205 @DataClass.Generated( 206 time = 1600715769152L, 207 codegenVersion = "1.0.15", 208 sourceFile = "packages/services/Car/car-lib/src/android/car/input/CustomInputEvent" 209 + ".java", 210 inputSignatures = "public static final int INPUT_CODE_F1\npublic static final int " 211 + "INPUT_CODE_F2\npublic static final int INPUT_CODE_F3\npublic static final" 212 + " int INPUT_CODE_F4\npublic static final int INPUT_CODE_F5\npublic static" 213 + " final int INPUT_CODE_F6\npublic static final int INPUT_CODE_F7\npublic " 214 + "static final int INPUT_CODE_F8\npublic static final int " 215 + "INPUT_CODE_F9\npublic static final int INPUT_CODE_F10\nprivate final " 216 + "@android.car.input.CustomInputEvent.InputCode int mInputCode\nprivate " 217 + "final int mTargetDisplayType\nprivate final int mRepeatCounter\nclass " 218 + "CustomInputEvent extends java.lang.Object implements [android.os" 219 + ".Parcelable]\n@com.android.car.internal.util.DataClass(genEqualsHashCode=true," 220 + " genAidl=true)") 221 @Deprecated 222 @ExcludeFromCodeCoverageGeneratedReport(reason = BOILERPLATE_CODE) __metadata()223 private void __metadata() { 224 } 225 226 //@formatter:on 227 // End of generated code 228 } 229