diff options
| -rw-r--r-- | core/api/system-current.txt | 37 | ||||
| -rw-r--r-- | core/java/android/service/voice/HotwordTrainingAudio.aidl | 19 | ||||
| -rw-r--r-- | core/java/android/service/voice/HotwordTrainingAudio.java | 388 | ||||
| -rw-r--r-- | core/java/android/service/voice/HotwordTrainingData.aidl | 19 | ||||
| -rw-r--r-- | core/java/android/service/voice/HotwordTrainingData.java | 305 |
5 files changed, 0 insertions, 768 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 159410dcde09..96c0d4685d0e 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -13366,43 +13366,6 @@ package android.service.voice { method @NonNull public android.service.voice.HotwordRejectedResult.Builder setConfidenceLevel(int); } - @FlaggedApi("android.service.voice.flags.allow_training_data_egress_from_hds") public final class HotwordTrainingAudio implements android.os.Parcelable { - method public int describeContents(); - method @NonNull public android.media.AudioFormat getAudioFormat(); - method @NonNull public int getAudioType(); - method @NonNull public byte[] getHotwordAudio(); - method public int getHotwordOffsetMillis(); - method public void writeToParcel(@NonNull android.os.Parcel, int); - field @NonNull public static final android.os.Parcelable.Creator<android.service.voice.HotwordTrainingAudio> CREATOR; - field public static final int HOTWORD_OFFSET_UNSET = -1; // 0xffffffff - } - - @FlaggedApi("android.service.voice.flags.allow_training_data_egress_from_hds") public static final class HotwordTrainingAudio.Builder { - ctor public HotwordTrainingAudio.Builder(@NonNull byte[], @NonNull android.media.AudioFormat); - method @NonNull public android.service.voice.HotwordTrainingAudio build(); - method @NonNull public android.service.voice.HotwordTrainingAudio.Builder setAudioFormat(@NonNull android.media.AudioFormat); - method @NonNull public android.service.voice.HotwordTrainingAudio.Builder setAudioType(@NonNull int); - method @NonNull public android.service.voice.HotwordTrainingAudio.Builder setHotwordAudio(@NonNull byte[]); - method @NonNull public android.service.voice.HotwordTrainingAudio.Builder setHotwordOffsetMillis(int); - } - - @FlaggedApi("android.service.voice.flags.allow_training_data_egress_from_hds") public final class HotwordTrainingData implements android.os.Parcelable { - method public int describeContents(); - method public static int getMaxTrainingDataBytes(); - method public int getTimeoutStage(); - method @NonNull public java.util.List<android.service.voice.HotwordTrainingAudio> getTrainingAudioList(); - method public void writeToParcel(@NonNull android.os.Parcel, int); - field @NonNull public static final android.os.Parcelable.Creator<android.service.voice.HotwordTrainingData> CREATOR; - } - - @FlaggedApi("android.service.voice.flags.allow_training_data_egress_from_hds") public static final class HotwordTrainingData.Builder { - ctor public HotwordTrainingData.Builder(); - method @NonNull public android.service.voice.HotwordTrainingData.Builder addTrainingAudio(@NonNull android.service.voice.HotwordTrainingAudio); - method @NonNull public android.service.voice.HotwordTrainingData build(); - method @NonNull public android.service.voice.HotwordTrainingData.Builder setTimeoutStage(int); - method @NonNull public android.service.voice.HotwordTrainingData.Builder setTrainingAudioList(@NonNull java.util.List<android.service.voice.HotwordTrainingAudio>); - } - public interface SandboxedDetectionInitializer { method public static int getMaxCustomInitializationStatus(); method public void onUpdateState(@Nullable android.os.PersistableBundle, @Nullable android.os.SharedMemory, long, @Nullable java.util.function.IntConsumer); diff --git a/core/java/android/service/voice/HotwordTrainingAudio.aidl b/core/java/android/service/voice/HotwordTrainingAudio.aidl deleted file mode 100644 index 4dd22897f831..000000000000 --- a/core/java/android/service/voice/HotwordTrainingAudio.aidl +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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 HotwordTrainingAudio;
\ No newline at end of file diff --git a/core/java/android/service/voice/HotwordTrainingAudio.java b/core/java/android/service/voice/HotwordTrainingAudio.java deleted file mode 100644 index 916fa36b2339..000000000000 --- a/core/java/android/service/voice/HotwordTrainingAudio.java +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (C) 2023 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.FlaggedApi; -import android.annotation.NonNull; -import android.annotation.Nullable; -import android.annotation.SuppressLint; -import android.annotation.SystemApi; -import android.media.AudioFormat; -import android.os.Parcel; -import android.os.Parcelable; -import android.service.voice.flags.Flags; - -import com.android.internal.util.DataClass; - -import java.util.Objects; - -/** - * Represents audio supporting hotword model training. - * - * @hide - */ -@FlaggedApi(Flags.FLAG_ALLOW_TRAINING_DATA_EGRESS_FROM_HDS) -@DataClass( - genConstructor = false, - genBuilder = true, - genEqualsHashCode = true, - genHiddenConstDefs = true, - genParcelable = true, - genToString = true -) -@SystemApi -public final class HotwordTrainingAudio implements Parcelable { - /** Represents unset value for the hotword offset. */ - public static final int HOTWORD_OFFSET_UNSET = -1; - - /** - * Buffer of hotword audio data for training models. The data format is expected to match - * {@link #getAudioFormat()}. - */ - @NonNull - private final byte[] mHotwordAudio; - - private String hotwordAudioToString() { - return "length=" + mHotwordAudio.length; - } - - /** - * The {@link AudioFormat} of the {@link HotwordTrainingAudio#mHotwordAudio}. - */ - @NonNull - private final AudioFormat mAudioFormat; - - /** - * App-defined identifier to distinguish hotword training audio instances. - * <p> Returns -1 if unset. */ - @NonNull - private final int mAudioType; - - private static int defaultAudioType() { - return -1; - } - - /** - * App-defined offset in milliseconds relative to start of - * {@link HotwordTrainingAudio#mHotwordAudio}. Default value is - * {@link HotwordTrainingAudio#HOTWORD_OFFSET_UNSET}. - */ - private int mHotwordOffsetMillis = HOTWORD_OFFSET_UNSET; - - @DataClass.Suppress("setHotwordAudio") - abstract static class BaseBuilder { - - /** - * Buffer of hotword audio data for training models. The data format is expected to match - * {@link #getAudioFormat()}. - */ - @SuppressLint("UnflaggedApi") - public @NonNull HotwordTrainingAudio.Builder setHotwordAudio(@NonNull byte[] value) { - Objects.requireNonNull(value, "value should not be null"); - final HotwordTrainingAudio.Builder builder = (HotwordTrainingAudio.Builder) this; - // If the code gen flag in build() is changed, we must update the flag e.g. 0x1 here. - builder.mBuilderFieldsSet |= 0x1; - builder.mHotwordAudio = value; - return builder; - } - } - - - - // Code below generated by codegen v1.0.23. - // - // DO NOT MODIFY! - // CHECKSTYLE:OFF Generated code - // - // To regenerate run: - // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/service/voice/HotwordTrainingAudio.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 */ HotwordTrainingAudio( - @NonNull byte[] hotwordAudio, - @NonNull AudioFormat audioFormat, - @NonNull int audioType, - int hotwordOffsetMillis) { - this.mHotwordAudio = hotwordAudio; - com.android.internal.util.AnnotationValidations.validate( - NonNull.class, null, mHotwordAudio); - this.mAudioFormat = audioFormat; - com.android.internal.util.AnnotationValidations.validate( - NonNull.class, null, mAudioFormat); - this.mAudioType = audioType; - com.android.internal.util.AnnotationValidations.validate( - NonNull.class, null, mAudioType); - this.mHotwordOffsetMillis = hotwordOffsetMillis; - - // onConstructed(); // You can define this method to get a callback - } - - /** - * Buffer of hotword audio data for training models. The data format is expected to match - * {@link #getAudioFormat()}. - */ - @DataClass.Generated.Member - public @NonNull byte[] getHotwordAudio() { - return mHotwordAudio; - } - - /** - * The {@link AudioFormat} of the {@link HotwordTrainingAudio#mHotwordAudio}. - */ - @DataClass.Generated.Member - public @NonNull AudioFormat getAudioFormat() { - return mAudioFormat; - } - - /** - * App-defined identifier to distinguish hotword training audio instances. - * <p> Returns -1 if unset. - */ - @DataClass.Generated.Member - public @NonNull int getAudioType() { - return mAudioType; - } - - /** - * App-defined offset in milliseconds relative to start of - * {@link HotwordTrainingAudio#mHotwordAudio}. Default value is - * {@link HotwordTrainingAudio#HOTWORD_OFFSET_UNSET}. - */ - @DataClass.Generated.Member - public int getHotwordOffsetMillis() { - return mHotwordOffsetMillis; - } - - @Override - @DataClass.Generated.Member - public String toString() { - // You can override field toString logic by defining methods like: - // String fieldNameToString() { ... } - - return "HotwordTrainingAudio { " + - "hotwordAudio = " + hotwordAudioToString() + ", " + - "audioFormat = " + mAudioFormat + ", " + - "audioType = " + mAudioType + ", " + - "hotwordOffsetMillis = " + mHotwordOffsetMillis + - " }"; - } - - @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(HotwordTrainingAudio other) { ... } - // boolean fieldNameEquals(FieldType otherValue) { ... } - - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - @SuppressWarnings("unchecked") - HotwordTrainingAudio that = (HotwordTrainingAudio) o; - //noinspection PointlessBooleanExpression - return true - && java.util.Arrays.equals(mHotwordAudio, that.mHotwordAudio) - && Objects.equals(mAudioFormat, that.mAudioFormat) - && mAudioType == that.mAudioType - && mHotwordOffsetMillis == that.mHotwordOffsetMillis; - } - - @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 + java.util.Arrays.hashCode(mHotwordAudio); - _hash = 31 * _hash + Objects.hashCode(mAudioFormat); - _hash = 31 * _hash + mAudioType; - _hash = 31 * _hash + mHotwordOffsetMillis; - return _hash; - } - - @Override - @DataClass.Generated.Member - public void writeToParcel(@NonNull Parcel dest, int flags) { - // You can override field parcelling by defining methods like: - // void parcelFieldName(Parcel dest, int flags) { ... } - - dest.writeByteArray(mHotwordAudio); - dest.writeTypedObject(mAudioFormat, flags); - dest.writeInt(mAudioType); - dest.writeInt(mHotwordOffsetMillis); - } - - @Override - @DataClass.Generated.Member - public int describeContents() { return 0; } - - /** @hide */ - @SuppressWarnings({"unchecked", "RedundantCast"}) - @DataClass.Generated.Member - /* package-private */ HotwordTrainingAudio(@NonNull Parcel in) { - // You can override field unparcelling by defining methods like: - // static FieldType unparcelFieldName(Parcel in) { ... } - - byte[] hotwordAudio = in.createByteArray(); - AudioFormat audioFormat = (AudioFormat) in.readTypedObject(AudioFormat.CREATOR); - int audioType = in.readInt(); - int hotwordOffsetMillis = in.readInt(); - - this.mHotwordAudio = hotwordAudio; - com.android.internal.util.AnnotationValidations.validate( - NonNull.class, null, mHotwordAudio); - this.mAudioFormat = audioFormat; - com.android.internal.util.AnnotationValidations.validate( - NonNull.class, null, mAudioFormat); - this.mAudioType = audioType; - com.android.internal.util.AnnotationValidations.validate( - NonNull.class, null, mAudioType); - this.mHotwordOffsetMillis = hotwordOffsetMillis; - - // onConstructed(); // You can define this method to get a callback - } - - @DataClass.Generated.Member - public static final @NonNull Parcelable.Creator<HotwordTrainingAudio> CREATOR - = new Parcelable.Creator<HotwordTrainingAudio>() { - @Override - public HotwordTrainingAudio[] newArray(int size) { - return new HotwordTrainingAudio[size]; - } - - @Override - public HotwordTrainingAudio createFromParcel(@NonNull Parcel in) { - return new HotwordTrainingAudio(in); - } - }; - - /** - * A builder for {@link HotwordTrainingAudio} - */ - @FlaggedApi(Flags.FLAG_ALLOW_TRAINING_DATA_EGRESS_FROM_HDS) - @SuppressWarnings("WeakerAccess") - @DataClass.Generated.Member - public static final class Builder extends BaseBuilder { - - private @NonNull byte[] mHotwordAudio; - private @NonNull AudioFormat mAudioFormat; - private @NonNull int mAudioType; - private int mHotwordOffsetMillis; - - private long mBuilderFieldsSet = 0L; - - /** - * Creates a new Builder. - * - * @param hotwordAudio - * Buffer of hotword audio data for training models. The data format is expected to match - * {@link #getAudioFormat()}. - * @param audioFormat - * The {@link AudioFormat} of the {@link HotwordTrainingAudio#mHotwordAudio}. - */ - public Builder( - @NonNull byte[] hotwordAudio, - @NonNull AudioFormat audioFormat) { - mHotwordAudio = hotwordAudio; - com.android.internal.util.AnnotationValidations.validate( - NonNull.class, null, mHotwordAudio); - mAudioFormat = audioFormat; - com.android.internal.util.AnnotationValidations.validate( - NonNull.class, null, mAudioFormat); - } - - /** - * The {@link AudioFormat} of the {@link HotwordTrainingAudio#mHotwordAudio}. - */ - @DataClass.Generated.Member - public @NonNull Builder setAudioFormat(@NonNull AudioFormat value) { - checkNotUsed(); - mBuilderFieldsSet |= 0x2; - mAudioFormat = value; - return this; - } - - /** - * App-defined identifier to distinguish hotword training audio instances. - * <p> Returns -1 if unset. - */ - @DataClass.Generated.Member - public @NonNull Builder setAudioType(@NonNull int value) { - checkNotUsed(); - mBuilderFieldsSet |= 0x4; - mAudioType = value; - return this; - } - - /** - * App-defined offset in milliseconds relative to start of - * {@link HotwordTrainingAudio#mHotwordAudio}. Default value is - * {@link HotwordTrainingAudio#HOTWORD_OFFSET_UNSET}. - */ - @DataClass.Generated.Member - public @NonNull Builder setHotwordOffsetMillis(int value) { - checkNotUsed(); - mBuilderFieldsSet |= 0x8; - mHotwordOffsetMillis = value; - return this; - } - - /** Builds the instance. This builder should not be touched after calling this! */ - public @NonNull HotwordTrainingAudio build() { - checkNotUsed(); - mBuilderFieldsSet |= 0x10; // Mark builder used - - if ((mBuilderFieldsSet & 0x4) == 0) { - mAudioType = defaultAudioType(); - } - if ((mBuilderFieldsSet & 0x8) == 0) { - mHotwordOffsetMillis = HOTWORD_OFFSET_UNSET; - } - HotwordTrainingAudio o = new HotwordTrainingAudio( - mHotwordAudio, - mAudioFormat, - mAudioType, - mHotwordOffsetMillis); - return o; - } - - private void checkNotUsed() { - if ((mBuilderFieldsSet & 0x10) != 0) { - throw new IllegalStateException( - "This Builder should not be reused. Use a new Builder instance instead"); - } - } - } - - @DataClass.Generated( - time = 1697827049629L, - codegenVersion = "1.0.23", - sourceFile = "frameworks/base/core/java/android/service/voice/HotwordTrainingAudio.java", - inputSignatures = "public static final int HOTWORD_OFFSET_UNSET\nprivate final @android.annotation.NonNull byte[] mHotwordAudio\nprivate final @android.annotation.NonNull android.media.AudioFormat mAudioFormat\nprivate final @android.annotation.NonNull int mAudioType\nprivate int mHotwordOffsetMillis\nprivate java.lang.String hotwordAudioToString()\nprivate static int defaultAudioType()\nclass HotwordTrainingAudio extends java.lang.Object implements [android.os.Parcelable]\npublic @android.annotation.SuppressLint @android.annotation.NonNull android.service.voice.HotwordTrainingAudio.Builder setHotwordAudio(byte[])\nclass BaseBuilder extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genConstructor=false, genBuilder=true, genEqualsHashCode=true, genHiddenConstDefs=true, genParcelable=true, genToString=true)\npublic @android.annotation.SuppressLint @android.annotation.NonNull android.service.voice.HotwordTrainingAudio.Builder setHotwordAudio(byte[])\nclass BaseBuilder extends java.lang.Object implements []") - @Deprecated - private void __metadata() {} - - - //@formatter:on - // End of generated code - -} diff --git a/core/java/android/service/voice/HotwordTrainingData.aidl b/core/java/android/service/voice/HotwordTrainingData.aidl deleted file mode 100644 index 03cc8413d780..000000000000 --- a/core/java/android/service/voice/HotwordTrainingData.aidl +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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 HotwordTrainingData; diff --git a/core/java/android/service/voice/HotwordTrainingData.java b/core/java/android/service/voice/HotwordTrainingData.java deleted file mode 100644 index aa6dab3629b4..000000000000 --- a/core/java/android/service/voice/HotwordTrainingData.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright (C) 2023 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.FlaggedApi; -import android.annotation.NonNull; -import android.annotation.SystemApi; -import android.os.Parcel; -import android.os.Parcelable; -import android.service.voice.flags.Flags; -import android.text.TextUtils; - -import com.android.internal.util.DataClass; -import com.android.internal.util.Preconditions; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * Contains training data related to hotword detection service. - * - * <p>The constructed object's size must be within - * {@link HotwordTrainingData#getMaxTrainingDataBytes()} or an - * {@link IllegalArgumentException} will be thrown on construction. Size of the object is calculated - * by converting object to a {@link Parcel} and using the {@link Parcel#dataSize()}. - * - * @hide - */ -@DataClass( - genConstructor = false, - genBuilder = true, - genEqualsHashCode = true, - genHiddenConstDefs = true, - genParcelable = true, - genToString = true) -@SystemApi -@FlaggedApi(Flags.FLAG_ALLOW_TRAINING_DATA_EGRESS_FROM_HDS) -public final class HotwordTrainingData implements Parcelable { - /** Max size for hotword training data in bytes. */ - public static int getMaxTrainingDataBytes() { - return 1024 * 1024; // 1 MB; - } - - /** The list containing hotword audio that is useful for training. */ - @NonNull - @DataClass.PluralOf("trainingAudio") - private final List<HotwordTrainingAudio> mTrainingAudioList; - - private static List<HotwordTrainingAudio> defaultTrainingAudioList() { - return Collections.emptyList(); - } - - /** App-defined stage when hotword model timed-out while running. - * <p> Returns -1 if unset. */ - private final int mTimeoutStage; - - private static int defaultTimeoutStage() { - return -1; - } - - private void onConstructed() { - // Verify size of object is within limit. - Parcel parcel = Parcel.obtain(); - parcel.writeValue(this); - int dataSizeBytes = parcel.dataSize(); - parcel.recycle(); - Preconditions.checkArgument( - dataSizeBytes < getMaxTrainingDataBytes(), - TextUtils.formatSimple( - "Hotword training data of size %s exceeds size limit of %s bytes!", - dataSizeBytes, getMaxTrainingDataBytes())); - } - - - - // Code below generated by codegen v1.0.23. - // - // DO NOT MODIFY! - // CHECKSTYLE:OFF Generated code - // - // To regenerate run: - // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/service/voice/HotwordTrainingData.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 */ HotwordTrainingData( - @NonNull List<HotwordTrainingAudio> trainingAudioList, - int timeoutStage) { - this.mTrainingAudioList = trainingAudioList; - com.android.internal.util.AnnotationValidations.validate( - NonNull.class, null, mTrainingAudioList); - this.mTimeoutStage = timeoutStage; - - onConstructed(); - } - - /** - * The list containing hotword audio that is useful for training. - */ - @DataClass.Generated.Member - public @NonNull List<HotwordTrainingAudio> getTrainingAudioList() { - return mTrainingAudioList; - } - - /** - * App-defined stage when hotword model timed-out while running. - * <p> Returns -1 if unset. - */ - @DataClass.Generated.Member - public int getTimeoutStage() { - return mTimeoutStage; - } - - @Override - @DataClass.Generated.Member - public String toString() { - // You can override field toString logic by defining methods like: - // String fieldNameToString() { ... } - - return "HotwordTrainingData { " + - "trainingAudioList = " + mTrainingAudioList + ", " + - "timeoutStage = " + mTimeoutStage + - " }"; - } - - @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(HotwordTrainingData other) { ... } - // boolean fieldNameEquals(FieldType otherValue) { ... } - - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - @SuppressWarnings("unchecked") - HotwordTrainingData that = (HotwordTrainingData) o; - //noinspection PointlessBooleanExpression - return true - && java.util.Objects.equals(mTrainingAudioList, that.mTrainingAudioList) - && mTimeoutStage == that.mTimeoutStage; - } - - @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 + java.util.Objects.hashCode(mTrainingAudioList); - _hash = 31 * _hash + mTimeoutStage; - return _hash; - } - - @Override - @DataClass.Generated.Member - public void writeToParcel(@NonNull Parcel dest, int flags) { - // You can override field parcelling by defining methods like: - // void parcelFieldName(Parcel dest, int flags) { ... } - - dest.writeParcelableList(mTrainingAudioList, flags); - dest.writeInt(mTimeoutStage); - } - - @Override - @DataClass.Generated.Member - public int describeContents() { return 0; } - - /** @hide */ - @SuppressWarnings({"unchecked", "RedundantCast"}) - @DataClass.Generated.Member - /* package-private */ HotwordTrainingData(@NonNull Parcel in) { - // You can override field unparcelling by defining methods like: - // static FieldType unparcelFieldName(Parcel in) { ... } - - List<HotwordTrainingAudio> trainingAudioList = new ArrayList<>(); - in.readParcelableList(trainingAudioList, HotwordTrainingAudio.class.getClassLoader()); - int timeoutStage = in.readInt(); - - this.mTrainingAudioList = trainingAudioList; - com.android.internal.util.AnnotationValidations.validate( - NonNull.class, null, mTrainingAudioList); - this.mTimeoutStage = timeoutStage; - - onConstructed(); - } - - @DataClass.Generated.Member - public static final @NonNull Parcelable.Creator<HotwordTrainingData> CREATOR - = new Parcelable.Creator<HotwordTrainingData>() { - @Override - public HotwordTrainingData[] newArray(int size) { - return new HotwordTrainingData[size]; - } - - @Override - public HotwordTrainingData createFromParcel(@NonNull Parcel in) { - return new HotwordTrainingData(in); - } - }; - - /** - * A builder for {@link HotwordTrainingData} - */ - @FlaggedApi(Flags.FLAG_ALLOW_TRAINING_DATA_EGRESS_FROM_HDS) - @SuppressWarnings("WeakerAccess") - @DataClass.Generated.Member - public static final class Builder { - - private @NonNull List<HotwordTrainingAudio> mTrainingAudioList; - private int mTimeoutStage; - - private long mBuilderFieldsSet = 0L; - - public Builder() { - } - - /** - * The list containing hotword audio that is useful for training. - */ - @DataClass.Generated.Member - public @NonNull Builder setTrainingAudioList(@NonNull List<HotwordTrainingAudio> value) { - checkNotUsed(); - mBuilderFieldsSet |= 0x1; - mTrainingAudioList = value; - return this; - } - - /** @see #setTrainingAudioList */ - @DataClass.Generated.Member - public @NonNull Builder addTrainingAudio(@NonNull HotwordTrainingAudio value) { - if (mTrainingAudioList == null) setTrainingAudioList(new ArrayList<>()); - mTrainingAudioList.add(value); - return this; - } - - /** - * App-defined stage when hotword model timed-out while running. - * <p> Returns -1 if unset. - */ - @DataClass.Generated.Member - public @NonNull Builder setTimeoutStage(int value) { - checkNotUsed(); - mBuilderFieldsSet |= 0x2; - mTimeoutStage = value; - return this; - } - - /** Builds the instance. This builder should not be touched after calling this! */ - public @NonNull HotwordTrainingData build() { - checkNotUsed(); - mBuilderFieldsSet |= 0x4; // Mark builder used - - if ((mBuilderFieldsSet & 0x1) == 0) { - mTrainingAudioList = defaultTrainingAudioList(); - } - if ((mBuilderFieldsSet & 0x2) == 0) { - mTimeoutStage = defaultTimeoutStage(); - } - HotwordTrainingData o = new HotwordTrainingData( - mTrainingAudioList, - mTimeoutStage); - return o; - } - - private void checkNotUsed() { - if ((mBuilderFieldsSet & 0x4) != 0) { - throw new IllegalStateException( - "This Builder should not be reused. Use a new Builder instance instead"); - } - } - } - - @DataClass.Generated( - time = 1697826948280L, - codegenVersion = "1.0.23", - sourceFile = "frameworks/base/core/java/android/service/voice/HotwordTrainingData.java", - inputSignatures = "private final @android.annotation.NonNull @com.android.internal.util.DataClass.PluralOf(\"trainingAudio\") java.util.List<android.service.voice.HotwordTrainingAudio> mTrainingAudioList\nprivate final int mTimeoutStage\npublic static int getMaxTrainingDataBytes()\nprivate static java.util.List<android.service.voice.HotwordTrainingAudio> defaultTrainingAudioList()\nprivate static int defaultTimeoutStage()\nprivate void onConstructed()\nclass HotwordTrainingData 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 - -} |