Debian Codegraph @

core/java/android/service/voice/HotwordRejectedResult.java

raw symbols SCIP
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.service.voice;
18
19 import android.annotation.IntDef;
20 import android.annotation.SystemApi;
21 import android.os.Parcelable;
22
23 import com.android.internal.util.DataClass;
24
25 /**
26 * Represents a result supporting the rejected hotword trigger.
27 *
28 * @hide
29 */
30 @DataClass(
31 genConstructor = false,
32 genBuilder = true,
33 genEqualsHashCode = true,
34 genHiddenConstDefs = true,
35 genParcelable = true,
36 genToString = true
37 )
38 @SystemApi
39 public final class HotwordRejectedResult implements Parcelable {
40
41 /** No confidence in hotword detector result. */
42 public static final int CONFIDENCE_LEVEL_NONE = 0;
43
44 /** Small confidence in hotword detector result. */
45 public static final int CONFIDENCE_LEVEL_LOW = 1;
46
47 /** Medium confidence in hotword detector result. */
48 public static final int CONFIDENCE_LEVEL_MEDIUM = 2;
49
50 /** High confidence in hotword detector result. */
51 public static final int CONFIDENCE_LEVEL_HIGH = 3;
52
53 /** @hide */
54 @IntDef(prefix = {"CONFIDENCE_LEVEL_"}, value = {
55 CONFIDENCE_LEVEL_NONE,
56 CONFIDENCE_LEVEL_LOW,
57 CONFIDENCE_LEVEL_MEDIUM,
58 CONFIDENCE_LEVEL_HIGH
59 })
60 @interface HotwordConfidenceLevelValue {
61 }
62
63 /** Confidence level in the trigger outcome. */
64 @HotwordConfidenceLevelValue
65 private final int mConfidenceLevel;
66 private static int defaultConfidenceLevel() {
67 return CONFIDENCE_LEVEL_NONE;
68 }
69
70
71
72 // Code below generated by codegen v1.0.23.
73 //
74 // DO NOT MODIFY!
75 // CHECKSTYLE:OFF Generated code
76 //
77 // To regenerate run:
78 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/service/voice/HotwordRejectedResult.java
79 //
80 // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
81 // Settings > Editor > Code Style > Formatter Control
82 //@formatter:off
83
84
85 /** @hide */
86 @IntDef(prefix = "CONFIDENCE_LEVEL_", value = {
87 CONFIDENCE_LEVEL_NONE,
88 CONFIDENCE_LEVEL_LOW,
89 CONFIDENCE_LEVEL_MEDIUM,
90 CONFIDENCE_LEVEL_HIGH
91 })
92 @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE)
93 @DataClass.Generated.Member
94 public @interface ConfidenceLevel {}
95
96 /** @hide */
97 @DataClass.Generated.Member
98 public static String confidenceLevelToString(@ConfidenceLevel int value) {
99 switch (value) {
100 case CONFIDENCE_LEVEL_NONE:
101 return "CONFIDENCE_LEVEL_NONE";
102 case CONFIDENCE_LEVEL_LOW:
103 return "CONFIDENCE_LEVEL_LOW";
104 case CONFIDENCE_LEVEL_MEDIUM:
105 return "CONFIDENCE_LEVEL_MEDIUM";
106 case CONFIDENCE_LEVEL_HIGH:
107 return "CONFIDENCE_LEVEL_HIGH";
108 default: return Integer.toHexString(value);
109 }
110 }
111
112 @DataClass.Generated.Member
113 /* package-private */ HotwordRejectedResult(
114 @HotwordConfidenceLevelValue int confidenceLevel) {
115 this.mConfidenceLevel = confidenceLevel;
116 com.android.internal.util.AnnotationValidations.validate(
117 HotwordConfidenceLevelValue.class, null, mConfidenceLevel);
118
119 // onConstructed(); // You can define this method to get a callback
120 }
121
122 /**
123 * Confidence level in the trigger outcome.
124 */
125 @DataClass.Generated.Member
126 public @HotwordConfidenceLevelValue int getConfidenceLevel() {
127 return mConfidenceLevel;
128 }
129
130 @Override
131 @DataClass.Generated.Member
132 public String toString() {
133 // You can override field toString logic by defining methods like:
134 // String fieldNameToString() { ... }
135
136 return "HotwordRejectedResult { " +
137 "confidenceLevel = " + mConfidenceLevel +
138 " }";
139 }
140
141 @Override
142 @DataClass.Generated.Member
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(HotwordRejectedResult 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 HotwordRejectedResult that = (HotwordRejectedResult) o;
152 //noinspection PointlessBooleanExpression
153 return true
154 && mConfidenceLevel == that.mConfidenceLevel;
155 }
156
157 @Override
158 @DataClass.Generated.Member
159 public int hashCode() {
160 // You can override field hashCode logic by defining methods like:
161 // int fieldNameHashCode() { ... }
162
163 int _hash = 1;
164 _hash = 31 * _hash + mConfidenceLevel;
165 return _hash;
166 }
167
168 @Override
169 @DataClass.Generated.Member
170 public void writeToParcel(@android.annotation.NonNull android.os.Parcel dest, int flags) {
171 // You can override field parcelling by defining methods like:
172 // void parcelFieldName(Parcel dest, int flags) { ... }
173
174 dest.writeInt(mConfidenceLevel);
175 }
176
177 @Override
178 @DataClass.Generated.Member
179 public int describeContents() { return 0; }
180
181 /** @hide */
182 @SuppressWarnings({"unchecked", "RedundantCast"})
183 @DataClass.Generated.Member
184 /* package-private */ HotwordRejectedResult(@android.annotation.NonNull android.os.Parcel in) {
185 // You can override field unparcelling by defining methods like:
186 // static FieldType unparcelFieldName(Parcel in) { ... }
187
188 int confidenceLevel = in.readInt();
189
190 this.mConfidenceLevel = confidenceLevel;
191 com.android.internal.util.AnnotationValidations.validate(
192 HotwordConfidenceLevelValue.class, null, mConfidenceLevel);
193
194 // onConstructed(); // You can define this method to get a callback
195 }
196
197 @DataClass.Generated.Member
198 public static final @android.annotation.NonNull Parcelable.Creator<HotwordRejectedResult> CREATOR
199 = new Parcelable.Creator<HotwordRejectedResult>() {
200 @Override
201 public HotwordRejectedResult[] newArray(int size) {
202 return new HotwordRejectedResult[size];
203 }
204
205 @Override
206 public HotwordRejectedResult createFromParcel(@android.annotation.NonNull android.os.Parcel in) {
207 return new HotwordRejectedResult(in);
208 }
209 };
210
211 /**
212 * A builder for {@link HotwordRejectedResult}
213 */
214 @SuppressWarnings("WeakerAccess")
215 @DataClass.Generated.Member
216 public static final class Builder {
217
218 private @HotwordConfidenceLevelValue int mConfidenceLevel;
219
220 private long mBuilderFieldsSet = 0L;
221
222 public Builder() {
223 }
224
225 /**
226 * Confidence level in the trigger outcome.
227 */
228 @DataClass.Generated.Member
229 public @android.annotation.NonNull Builder setConfidenceLevel(@HotwordConfidenceLevelValue int value) {
230 checkNotUsed();
231 mBuilderFieldsSet |= 0x1;
232 mConfidenceLevel = value;
233 return this;
234 }
235
236 /** Builds the instance. This builder should not be touched after calling this! */
237 public @android.annotation.NonNull HotwordRejectedResult build() {
238 checkNotUsed();
239 mBuilderFieldsSet |= 0x2; // Mark builder used
240
241 if ((mBuilderFieldsSet & 0x1) == 0) {
242 mConfidenceLevel = defaultConfidenceLevel();
243 }
244 HotwordRejectedResult o = new HotwordRejectedResult(
245 mConfidenceLevel);
246 return o;
247 }
248
249 private void checkNotUsed() {
250 if ((mBuilderFieldsSet & 0x2) != 0) {
251 throw new IllegalStateException(
252 "This Builder should not be reused. Use a new Builder instance instead");
253 }
254 }
255 }
256
257 @DataClass.Generated(
258 time = 1621961370106L,
259 codegenVersion = "1.0.23",
260 sourceFile = "frameworks/base/core/java/android/service/voice/HotwordRejectedResult.java",
261 inputSignatures = "public static final int CONFIDENCE_LEVEL_NONE\npublic static final int CONFIDENCE_LEVEL_LOW\npublic static final int CONFIDENCE_LEVEL_MEDIUM\npublic static final int CONFIDENCE_LEVEL_HIGH\nprivate final @android.service.voice.HotwordRejectedResult.HotwordConfidenceLevelValue int mConfidenceLevel\nprivate static int defaultConfidenceLevel()\nclass HotwordRejectedResult extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genConstructor=false, genBuilder=true, genEqualsHashCode=true, genHiddenConstDefs=true, genParcelable=true, genToString=true)")
262 @Deprecated
263 private void __metadata() {}
264
265
266 //@formatter:on
267 // End of generated code
268
269 }