summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorSergey Volnov <volnov@google.com>2021-03-12 17:21:42 +0000
committerSergey Volnov <volnov@google.com>2021-03-18 23:37:59 +0000
commitb481d8c8f7307e0c3202d4eec4d0dbe9a620b9e4 (patch)
tree0ca08ad69cd606daa826ba6e626f6ddd32c301e3 /core/java/android
parent86cde2c6a039ebfae3e2e75ee0878f9c287451f3 (diff)
Defined trigger result structures for positive / negative hotword
triggers. CTS-Coverage-Bug: 182788844 Bug: 168305377 Test: N/A committing data classes. Change-Id: I9838d569b7cd4868d4b319a6c627f9215c71a489
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/service/voice/HotwordDetectedResult.aidl19
-rw-r--r--core/java/android/service/voice/HotwordDetectedResult.java501
-rw-r--r--core/java/android/service/voice/HotwordDetector.java50
-rw-r--r--core/java/android/service/voice/HotwordRejectedResult.aidl19
-rw-r--r--core/java/android/service/voice/HotwordRejectedResult.java222
5 files changed, 811 insertions, 0 deletions
diff --git a/core/java/android/service/voice/HotwordDetectedResult.aidl b/core/java/android/service/voice/HotwordDetectedResult.aidl
new file mode 100644
index 000000000000..c3201a190442
--- /dev/null
+++ b/core/java/android/service/voice/HotwordDetectedResult.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.voice;
+
+parcelable HotwordDetectedResult;
diff --git a/core/java/android/service/voice/HotwordDetectedResult.java b/core/java/android/service/voice/HotwordDetectedResult.java
new file mode 100644
index 000000000000..dd6f69818553
--- /dev/null
+++ b/core/java/android/service/voice/HotwordDetectedResult.java
@@ -0,0 +1,501 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.voice;
+
+import static android.service.voice.HotwordDetector.CONFIDENCE_LEVEL_NONE;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.SystemApi;
+import android.os.Bundle;
+import android.os.Parcelable;
+
+import com.android.internal.util.DataClass;
+
+/**
+ * Represents a result supporting the hotword detection.
+ *
+ * @hide
+ */
+@DataClass(
+ genConstructor = false,
+ genBuilder = true,
+ genEqualsHashCode = true,
+ genHiddenConstDefs = true,
+ genParcelable = true,
+ genToString = true
+)
+@SystemApi
+public final class HotwordDetectedResult implements Parcelable {
+
+ /** Represents unset value for byte offset. */
+ public static final int BYTE_OFFSET_UNSET = -1;
+
+ /** Confidence level in the trigger outcome. */
+ @HotwordDetector.HotwordConfidenceLevelValue
+ private final int mConfidenceLevel;
+ private static int defaultConfidenceLevel() {
+ return CONFIDENCE_LEVEL_NONE;
+ }
+
+ /**
+ * Byte offset in the audio stream when the trigger event happened.
+ *
+ * <p>If unset, the most recent bytes in the audio stream will be used.
+ */
+ private final int mByteOffset;
+ private static int defaultByteOffset() {
+ return BYTE_OFFSET_UNSET;
+ }
+
+ /**
+ * Score for the hotword trigger.
+ *
+ * <p>Only values between 0 and {@link #getMaxScore} (inclusive) are accepted.
+ */
+ private final int mScore;
+ private static int defaultScore() {
+ return 0;
+ }
+
+ /**
+ * Score for the hotword trigger for device user.
+ *
+ * <p>Only values between 0 and {@link #getMaxScore} (inclusive) are accepted.
+ */
+ private final int mPersonalizedScore;
+ private static int defaultPersonalizedScore() {
+ return 0;
+ }
+
+ /**
+ * Returns the maximum values of {@link #getScore} and {@link #getPersonalizedScore}.
+ *
+ * The float value should be calculated as {@code getScore() / getMaxScore()}.
+ */
+ public static int getMaxScore() {
+ return 255;
+ }
+
+ /**
+ * Triggered phrase.
+ *
+ * <p>This phrase has to be listed in the AndroidManifest of the application in order for
+ * trigger to be accepted by the system.
+ */
+ // TODO(b/183128696): allow listing this in the manifest.
+ @Nullable
+ private final String mHotwordPhrase;
+ private static String defaultHotwordPhrase() {
+ return null;
+ }
+
+ /**
+ * App-specific extras to support trigger.
+ *
+ * <p>The size of this bundle will be limited to {@link #getMaxBundleSize}. Results will larger
+ * bundles will be rejected.
+ *
+ * <p>Only primitive types are supported in this bundle. Complex types will be removed from the
+ * bundle.
+ *
+ * <p>The use of this method is discouraged, and support for it will be removed in future
+ * versions of Android.
+ */
+ @NonNull
+ private final Bundle mExtras;
+ private static Bundle defaultExtras() {
+ return new Bundle();
+ }
+
+ /**
+ * Returns the maximum byte size of the information contained in the bundle.
+ *
+ * <p>The total size will be calculated as a sum of byte sizes over all bundle keys.
+ *
+ * <p>For example, for a bundle containing a single key: {@code "example_key" -> 42.0f}, the
+ * bundle size will be {@code 11 + Float.BYTES = 15} bytes.
+ */
+ public static int getMaxBundleSize() {
+ return 50;
+ }
+
+
+
+ // Code below generated by codegen v1.0.22.
+ //
+ // DO NOT MODIFY!
+ // CHECKSTYLE:OFF Generated code
+ //
+ // To regenerate run:
+ // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/service/voice/HotwordDetectedResult.java
+ //
+ // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
+ // Settings > Editor > Code Style > Formatter Control
+ //@formatter:off
+
+
+ @DataClass.Generated.Member
+ /* package-private */ HotwordDetectedResult(
+ @HotwordDetector.HotwordConfidenceLevelValue int confidenceLevel,
+ int byteOffset,
+ int score,
+ int personalizedScore,
+ @Nullable String hotwordPhrase,
+ @NonNull Bundle extras) {
+ this.mConfidenceLevel = confidenceLevel;
+ com.android.internal.util.AnnotationValidations.validate(
+ HotwordDetector.HotwordConfidenceLevelValue.class, null, mConfidenceLevel);
+ this.mByteOffset = byteOffset;
+ this.mScore = score;
+ this.mPersonalizedScore = personalizedScore;
+ this.mHotwordPhrase = hotwordPhrase;
+ this.mExtras = extras;
+ com.android.internal.util.AnnotationValidations.validate(
+ NonNull.class, null, mExtras);
+
+ // onConstructed(); // You can define this method to get a callback
+ }
+
+ /**
+ * Confidence level in the trigger outcome.
+ */
+ @DataClass.Generated.Member
+ public @HotwordDetector.HotwordConfidenceLevelValue int getConfidenceLevel() {
+ return mConfidenceLevel;
+ }
+
+ /**
+ * Byte offset in the audio stream when the trigger event happened.
+ *
+ * <p>If unset, the most recent bytes in the audio stream will be used.
+ */
+ @DataClass.Generated.Member
+ public int getByteOffset() {
+ return mByteOffset;
+ }
+
+ /**
+ * Score for the hotword trigger.
+ *
+ * <p>Only values between 0 and {@link #getMaxScore} (inclusive) are accepted.
+ */
+ @DataClass.Generated.Member
+ public int getScore() {
+ return mScore;
+ }
+
+ /**
+ * Score for the hotword trigger for device user.
+ *
+ * <p>Only values between 0 and {@link #getMaxScore} (inclusive) are accepted.
+ */
+ @DataClass.Generated.Member
+ public int getPersonalizedScore() {
+ return mPersonalizedScore;
+ }
+
+ @DataClass.Generated.Member
+ public @Nullable String getHotwordPhrase() {
+ return mHotwordPhrase;
+ }
+
+ /**
+ * App-specific extras to support trigger.
+ *
+ * <p>The size of this bundle will be limited to {@link #getMaxBundleSize}. Results will larger
+ * bundles will be rejected.
+ *
+ * <p>Only primitive types are supported in this bundle. Complex types will be removed from the
+ * bundle.
+ *
+ * <p>The use of this method is discouraged, and support for it will be removed in future
+ * versions of Android.
+ */
+ @DataClass.Generated.Member
+ public @NonNull Bundle getExtras() {
+ return mExtras;
+ }
+
+ @Override
+ @DataClass.Generated.Member
+ public String toString() {
+ // You can override field toString logic by defining methods like:
+ // String fieldNameToString() { ... }
+
+ return "HotwordDetectedResult { " +
+ "confidenceLevel = " + mConfidenceLevel + ", " +
+ "byteOffset = " + mByteOffset + ", " +
+ "score = " + mScore + ", " +
+ "personalizedScore = " + mPersonalizedScore + ", " +
+ "hotwordPhrase = " + mHotwordPhrase + ", " +
+ "extras = " + mExtras +
+ " }";
+ }
+
+ @Override
+ @DataClass.Generated.Member
+ public boolean equals(@Nullable Object o) {
+ // You can override field equality logic by defining either of the methods like:
+ // boolean fieldNameEquals(HotwordDetectedResult other) { ... }
+ // boolean fieldNameEquals(FieldType otherValue) { ... }
+
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ @SuppressWarnings("unchecked")
+ HotwordDetectedResult that = (HotwordDetectedResult) o;
+ //noinspection PointlessBooleanExpression
+ return true
+ && mConfidenceLevel == that.mConfidenceLevel
+ && mByteOffset == that.mByteOffset
+ && mScore == that.mScore
+ && mPersonalizedScore == that.mPersonalizedScore
+ && java.util.Objects.equals(mHotwordPhrase, that.mHotwordPhrase)
+ && java.util.Objects.equals(mExtras, that.mExtras);
+ }
+
+ @Override
+ @DataClass.Generated.Member
+ public int hashCode() {
+ // You can override field hashCode logic by defining methods like:
+ // int fieldNameHashCode() { ... }
+
+ int _hash = 1;
+ _hash = 31 * _hash + mConfidenceLevel;
+ _hash = 31 * _hash + mByteOffset;
+ _hash = 31 * _hash + mScore;
+ _hash = 31 * _hash + mPersonalizedScore;
+ _hash = 31 * _hash + java.util.Objects.hashCode(mHotwordPhrase);
+ _hash = 31 * _hash + java.util.Objects.hashCode(mExtras);
+ return _hash;
+ }
+
+ @Override
+ @DataClass.Generated.Member
+ public void writeToParcel(@NonNull android.os.Parcel dest, int flags) {
+ // You can override field parcelling by defining methods like:
+ // void parcelFieldName(Parcel dest, int flags) { ... }
+
+ byte flg = 0;
+ if (mHotwordPhrase != null) flg |= 0x10;
+ dest.writeByte(flg);
+ dest.writeInt(mConfidenceLevel);
+ dest.writeInt(mByteOffset);
+ dest.writeInt(mScore);
+ dest.writeInt(mPersonalizedScore);
+ if (mHotwordPhrase != null) dest.writeString(mHotwordPhrase);
+ dest.writeBundle(mExtras);
+ }
+
+ @Override
+ @DataClass.Generated.Member
+ public int describeContents() { return 0; }
+
+ /** @hide */
+ @SuppressWarnings({"unchecked", "RedundantCast"})
+ @DataClass.Generated.Member
+ /* package-private */ HotwordDetectedResult(@NonNull android.os.Parcel in) {
+ // You can override field unparcelling by defining methods like:
+ // static FieldType unparcelFieldName(Parcel in) { ... }
+
+ byte flg = in.readByte();
+ int confidenceLevel = in.readInt();
+ int byteOffset = in.readInt();
+ int score = in.readInt();
+ int personalizedScore = in.readInt();
+ String hotwordPhrase = (flg & 0x10) == 0 ? null : in.readString();
+ Bundle extras = in.readBundle();
+
+ this.mConfidenceLevel = confidenceLevel;
+ com.android.internal.util.AnnotationValidations.validate(
+ HotwordDetector.HotwordConfidenceLevelValue.class, null, mConfidenceLevel);
+ this.mByteOffset = byteOffset;
+ this.mScore = score;
+ this.mPersonalizedScore = personalizedScore;
+ this.mHotwordPhrase = hotwordPhrase;
+ this.mExtras = extras;
+ com.android.internal.util.AnnotationValidations.validate(
+ NonNull.class, null, mExtras);
+
+ // onConstructed(); // You can define this method to get a callback
+ }
+
+ @DataClass.Generated.Member
+ public static final @NonNull Parcelable.Creator<HotwordDetectedResult> CREATOR
+ = new Parcelable.Creator<HotwordDetectedResult>() {
+ @Override
+ public HotwordDetectedResult[] newArray(int size) {
+ return new HotwordDetectedResult[size];
+ }
+
+ @Override
+ public HotwordDetectedResult createFromParcel(@NonNull android.os.Parcel in) {
+ return new HotwordDetectedResult(in);
+ }
+ };
+
+ /**
+ * A builder for {@link HotwordDetectedResult}
+ */
+ @SuppressWarnings("WeakerAccess")
+ @DataClass.Generated.Member
+ public static final class Builder {
+
+ private @HotwordDetector.HotwordConfidenceLevelValue int mConfidenceLevel;
+ private int mByteOffset;
+ private int mScore;
+ private int mPersonalizedScore;
+ private @Nullable String mHotwordPhrase;
+ private @NonNull Bundle mExtras;
+
+ private long mBuilderFieldsSet = 0L;
+
+ public Builder() {
+ }
+
+ /**
+ * Confidence level in the trigger outcome.
+ */
+ @DataClass.Generated.Member
+ public @NonNull Builder setConfidenceLevel(@HotwordDetector.HotwordConfidenceLevelValue int value) {
+ checkNotUsed();
+ mBuilderFieldsSet |= 0x1;
+ mConfidenceLevel = value;
+ return this;
+ }
+
+ /**
+ * Byte offset in the audio stream when the trigger event happened.
+ *
+ * <p>If unset, the most recent bytes in the audio stream will be used.
+ */
+ @DataClass.Generated.Member
+ public @NonNull Builder setByteOffset(int value) {
+ checkNotUsed();
+ mBuilderFieldsSet |= 0x2;
+ mByteOffset = value;
+ return this;
+ }
+
+ /**
+ * Score for the hotword trigger.
+ *
+ * <p>Only values between 0 and {@link #getMaxScore} (inclusive) are accepted.
+ */
+ @DataClass.Generated.Member
+ public @NonNull Builder setScore(int value) {
+ checkNotUsed();
+ mBuilderFieldsSet |= 0x4;
+ mScore = value;
+ return this;
+ }
+
+ /**
+ * Score for the hotword trigger for device user.
+ *
+ * <p>Only values between 0 and {@link #getMaxScore} (inclusive) are accepted.
+ */
+ @DataClass.Generated.Member
+ public @NonNull Builder setPersonalizedScore(int value) {
+ checkNotUsed();
+ mBuilderFieldsSet |= 0x8;
+ mPersonalizedScore = value;
+ return this;
+ }
+
+ @DataClass.Generated.Member
+ public @NonNull Builder setHotwordPhrase(@NonNull String value) {
+ checkNotUsed();
+ mBuilderFieldsSet |= 0x10;
+ mHotwordPhrase = value;
+ return this;
+ }
+
+ /**
+ * App-specific extras to support trigger.
+ *
+ * <p>The size of this bundle will be limited to {@link #getMaxBundleSize}. Results will larger
+ * bundles will be rejected.
+ *
+ * <p>Only primitive types are supported in this bundle. Complex types will be removed from the
+ * bundle.
+ *
+ * <p>The use of this method is discouraged, and support for it will be removed in future
+ * versions of Android.
+ */
+ @DataClass.Generated.Member
+ public @NonNull Builder setExtras(@NonNull Bundle value) {
+ checkNotUsed();
+ mBuilderFieldsSet |= 0x20;
+ mExtras = value;
+ return this;
+ }
+
+ /** Builds the instance. This builder should not be touched after calling this! */
+ public @NonNull HotwordDetectedResult build() {
+ checkNotUsed();
+ mBuilderFieldsSet |= 0x40; // Mark builder used
+
+ if ((mBuilderFieldsSet & 0x1) == 0) {
+ mConfidenceLevel = defaultConfidenceLevel();
+ }
+ if ((mBuilderFieldsSet & 0x2) == 0) {
+ mByteOffset = defaultByteOffset();
+ }
+ if ((mBuilderFieldsSet & 0x4) == 0) {
+ mScore = defaultScore();
+ }
+ if ((mBuilderFieldsSet & 0x8) == 0) {
+ mPersonalizedScore = defaultPersonalizedScore();
+ }
+ if ((mBuilderFieldsSet & 0x10) == 0) {
+ mHotwordPhrase = defaultHotwordPhrase();
+ }
+ if ((mBuilderFieldsSet & 0x20) == 0) {
+ mExtras = defaultExtras();
+ }
+ HotwordDetectedResult o = new HotwordDetectedResult(
+ mConfidenceLevel,
+ mByteOffset,
+ mScore,
+ mPersonalizedScore,
+ mHotwordPhrase,
+ mExtras);
+ return o;
+ }
+
+ private void checkNotUsed() {
+ if ((mBuilderFieldsSet & 0x40) != 0) {
+ throw new IllegalStateException(
+ "This Builder should not be reused. Use a new Builder instance instead");
+ }
+ }
+ }
+
+ @DataClass.Generated(
+ time = 1616110545582L,
+ codegenVersion = "1.0.22",
+ sourceFile = "frameworks/base/core/java/android/service/voice/HotwordDetectedResult.java",
+ inputSignatures = "public static final int BYTE_OFFSET_UNSET\nprivate final @android.service.voice.HotwordDetector.HotwordConfidenceLevelValue int mConfidenceLevel\nprivate final int mByteOffset\nprivate final int mScore\nprivate final int mPersonalizedScore\nprivate final @android.annotation.Nullable java.lang.String mHotwordPhrase\nprivate final @android.annotation.NonNull android.os.Bundle mExtras\nprivate static int defaultConfidenceLevel()\nprivate static int defaultByteOffset()\nprivate static int defaultScore()\nprivate static int defaultPersonalizedScore()\npublic static int getMaxScore()\nprivate static java.lang.String defaultHotwordPhrase()\nprivate static android.os.Bundle defaultExtras()\npublic static int getMaxBundleSize()\nclass HotwordDetectedResult 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)")
+ @Deprecated
+ private void __metadata() {}
+
+
+ //@formatter:on
+ // End of generated code
+
+}
diff --git a/core/java/android/service/voice/HotwordDetector.java b/core/java/android/service/voice/HotwordDetector.java
new file mode 100644
index 000000000000..abf49b797da4
--- /dev/null
+++ b/core/java/android/service/voice/HotwordDetector.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.voice;
+
+import android.annotation.IntDef;
+import android.annotation.SystemApi;
+
+/**
+ * Basic functionality for hotword detectors.
+ *
+ * @hide
+ */
+@SystemApi
+public interface HotwordDetector {
+
+ /** No confidence in hotword detector result. */
+ int CONFIDENCE_LEVEL_NONE = 0;
+
+ /** Small confidence in hotword detector result. */
+ int CONFIDENCE_LEVEL_LOW = 1;
+
+ /** Medium confidence in hotword detector result. */
+ int CONFIDENCE_LEVEL_MEDIUM = 2;
+
+ /** High confidence in hotword detector result. */
+ int CONFIDENCE_LEVEL_HIGH = 3;
+
+ /** @hide */
+ @IntDef(prefix = { "CONFIDENCE_LEVEL_" }, value = {
+ CONFIDENCE_LEVEL_NONE,
+ CONFIDENCE_LEVEL_LOW,
+ CONFIDENCE_LEVEL_MEDIUM,
+ CONFIDENCE_LEVEL_HIGH
+ })
+ @interface HotwordConfidenceLevelValue {}
+}
diff --git a/core/java/android/service/voice/HotwordRejectedResult.aidl b/core/java/android/service/voice/HotwordRejectedResult.aidl
new file mode 100644
index 000000000000..ef38a15dc2fd
--- /dev/null
+++ b/core/java/android/service/voice/HotwordRejectedResult.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.voice;
+
+parcelable HotwordRejectedResult;
diff --git a/core/java/android/service/voice/HotwordRejectedResult.java b/core/java/android/service/voice/HotwordRejectedResult.java
new file mode 100644
index 000000000000..5d85662e3805
--- /dev/null
+++ b/core/java/android/service/voice/HotwordRejectedResult.java
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.voice;
+
+import static android.service.voice.HotwordDetector.CONFIDENCE_LEVEL_NONE;
+
+import android.annotation.SystemApi;
+import android.os.Parcelable;
+
+import com.android.internal.util.DataClass;
+
+/**
+ * Represents a result supporting the rejected hotword trigger.
+ *
+ * @hide
+ */
+@DataClass(
+ genConstructor = false,
+ genHiddenBuilder = true,
+ genEqualsHashCode = true,
+ genHiddenConstDefs = true,
+ genParcelable = true,
+ genToString = true
+)
+@SystemApi
+public final class HotwordRejectedResult implements Parcelable {
+
+ /** Confidence level in the trigger outcome. */
+ @HotwordDetector.HotwordConfidenceLevelValue
+ private final int mConfidenceLevel;
+ private static int defaultConfidenceLevel() {
+ return CONFIDENCE_LEVEL_NONE;
+ }
+
+
+
+ // Code below generated by codegen v1.0.22.
+ //
+ // DO NOT MODIFY!
+ // CHECKSTYLE:OFF Generated code
+ //
+ // To regenerate run:
+ // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/service/voice/HotwordRejectedResult.java
+ //
+ // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
+ // Settings > Editor > Code Style > Formatter Control
+ //@formatter:off
+
+
+ @DataClass.Generated.Member
+ /* package-private */ HotwordRejectedResult(
+ @HotwordDetector.HotwordConfidenceLevelValue int confidenceLevel) {
+ this.mConfidenceLevel = confidenceLevel;
+ com.android.internal.util.AnnotationValidations.validate(
+ HotwordDetector.HotwordConfidenceLevelValue.class, null, mConfidenceLevel);
+
+ // onConstructed(); // You can define this method to get a callback
+ }
+
+ /**
+ * Confidence level in the trigger outcome.
+ */
+ @DataClass.Generated.Member
+ public @HotwordDetector.HotwordConfidenceLevelValue int getConfidenceLevel() {
+ return mConfidenceLevel;
+ }
+
+ @Override
+ @DataClass.Generated.Member
+ public String toString() {
+ // You can override field toString logic by defining methods like:
+ // String fieldNameToString() { ... }
+
+ return "HotwordRejectedResult { " +
+ "confidenceLevel = " + mConfidenceLevel +
+ " }";
+ }
+
+ @Override
+ @DataClass.Generated.Member
+ public boolean equals(@android.annotation.Nullable Object o) {
+ // You can override field equality logic by defining either of the methods like:
+ // boolean fieldNameEquals(HotwordRejectedResult other) { ... }
+ // boolean fieldNameEquals(FieldType otherValue) { ... }
+
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ @SuppressWarnings("unchecked")
+ HotwordRejectedResult that = (HotwordRejectedResult) o;
+ //noinspection PointlessBooleanExpression
+ return true
+ && mConfidenceLevel == that.mConfidenceLevel;
+ }
+
+ @Override
+ @DataClass.Generated.Member
+ public int hashCode() {
+ // You can override field hashCode logic by defining methods like:
+ // int fieldNameHashCode() { ... }
+
+ int _hash = 1;
+ _hash = 31 * _hash + mConfidenceLevel;
+ return _hash;
+ }
+
+ @Override
+ @DataClass.Generated.Member
+ public void writeToParcel(@android.annotation.NonNull android.os.Parcel dest, int flags) {
+ // You can override field parcelling by defining methods like:
+ // void parcelFieldName(Parcel dest, int flags) { ... }
+
+ dest.writeInt(mConfidenceLevel);
+ }
+
+ @Override
+ @DataClass.Generated.Member
+ public int describeContents() { return 0; }
+
+ /** @hide */
+ @SuppressWarnings({"unchecked", "RedundantCast"})
+ @DataClass.Generated.Member
+ /* package-private */ HotwordRejectedResult(@android.annotation.NonNull android.os.Parcel in) {
+ // You can override field unparcelling by defining methods like:
+ // static FieldType unparcelFieldName(Parcel in) { ... }
+
+ int confidenceLevel = in.readInt();
+
+ this.mConfidenceLevel = confidenceLevel;
+ com.android.internal.util.AnnotationValidations.validate(
+ HotwordDetector.HotwordConfidenceLevelValue.class, null, mConfidenceLevel);
+
+ // onConstructed(); // You can define this method to get a callback
+ }
+
+ @DataClass.Generated.Member
+ public static final @android.annotation.NonNull Parcelable.Creator<HotwordRejectedResult> CREATOR
+ = new Parcelable.Creator<HotwordRejectedResult>() {
+ @Override
+ public HotwordRejectedResult[] newArray(int size) {
+ return new HotwordRejectedResult[size];
+ }
+
+ @Override
+ public HotwordRejectedResult createFromParcel(@android.annotation.NonNull android.os.Parcel in) {
+ return new HotwordRejectedResult(in);
+ }
+ };
+
+ /**
+ * A builder for {@link HotwordRejectedResult}
+ * @hide
+ */
+ @SuppressWarnings("WeakerAccess")
+ @DataClass.Generated.Member
+ public static final class Builder {
+
+ private @HotwordDetector.HotwordConfidenceLevelValue int mConfidenceLevel;
+
+ private long mBuilderFieldsSet = 0L;
+
+ public Builder() {
+ }
+
+ /**
+ * Confidence level in the trigger outcome.
+ */
+ @DataClass.Generated.Member
+ public @android.annotation.NonNull Builder setConfidenceLevel(@HotwordDetector.HotwordConfidenceLevelValue int value) {
+ checkNotUsed();
+ mBuilderFieldsSet |= 0x1;
+ mConfidenceLevel = value;
+ return this;
+ }
+
+ /** Builds the instance. This builder should not be touched after calling this! */
+ public @android.annotation.NonNull HotwordRejectedResult build() {
+ checkNotUsed();
+ mBuilderFieldsSet |= 0x2; // Mark builder used
+
+ if ((mBuilderFieldsSet & 0x1) == 0) {
+ mConfidenceLevel = defaultConfidenceLevel();
+ }
+ HotwordRejectedResult o = new HotwordRejectedResult(
+ mConfidenceLevel);
+ return o;
+ }
+
+ private void checkNotUsed() {
+ if ((mBuilderFieldsSet & 0x2) != 0) {
+ throw new IllegalStateException(
+ "This Builder should not be reused. Use a new Builder instance instead");
+ }
+ }
+ }
+
+ @DataClass.Generated(
+ time = 1616108967315L,
+ codegenVersion = "1.0.22",
+ sourceFile = "frameworks/base/core/java/android/service/voice/HotwordRejectedResult.java",
+ inputSignatures = "private final @android.service.voice.HotwordDetector.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, genHiddenBuilder=true, genEqualsHashCode=true, genHiddenConstDefs=true, genParcelable=true, genToString=true)")
+ @Deprecated
+ private void __metadata() {}
+
+
+ //@formatter:on
+ // End of generated code
+
+}