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