Loading core/api/current.txt +29 −0 Original line number Diff line number Diff line Loading @@ -39619,6 +39619,34 @@ package android.service.wallpaper { package android.speech { public final class AlternativeSpan implements android.os.Parcelable { method public int describeContents(); method @NonNull public java.util.List<java.lang.String> getAlternatives(); method public int getEndPosition(); method public int getStartPosition(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.speech.AlternativeSpan> CREATOR; } public static final class AlternativeSpan.Builder { ctor public AlternativeSpan.Builder(int, int); method @NonNull public android.speech.AlternativeSpan build(); method @NonNull public android.speech.AlternativeSpan.Builder setAlternatives(@NonNull java.util.List<java.lang.String>); } public final class AlternativeSpans implements android.os.Parcelable { method public int describeContents(); method @NonNull public java.util.List<android.speech.AlternativeSpan> getSpans(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.speech.AlternativeSpans> CREATOR; } public static final class AlternativeSpans.Builder { ctor public AlternativeSpans.Builder(); method @NonNull public android.speech.AlternativeSpans build(); method @NonNull public android.speech.AlternativeSpans.Builder setSpans(@NonNull java.util.List<android.speech.AlternativeSpan>); } public interface RecognitionListener { method public void onBeginningOfSpeech(); method public void onBufferReceived(byte[]); Loading Loading @@ -39780,6 +39808,7 @@ package android.speech { field public static final int ERROR_SERVER_DISCONNECTED = 11; // 0xb field public static final int ERROR_SPEECH_TIMEOUT = 6; // 0x6 field public static final int ERROR_TOO_MANY_REQUESTS = 10; // 0xa field public static final String RESULTS_ALTERNATIVES = "results_alternatives"; field public static final String RESULTS_RECOGNITION = "results_recognition"; } core/java/android/speech/AlternativeSpan.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.speech; parcelable AlternativeSpan; core/java/android/speech/AlternativeSpan.java 0 → 100644 +327 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.speech; import android.annotation.NonNull; import android.os.Parcelable; import com.android.internal.util.DataClass; import com.android.internal.util.Preconditions; import java.util.ArrayList; import java.util.List; /** * List of alternative hypotheses for a specific span of a speech recognition result string. * * <p> A single {@link SpeechRecognizer} result is represented as a {@link String}. For a specific * span of the originally recognized result string, the recognizer may provide alternative * hypotheses of what it may have recognized. A span is specifically a substring and is thereby * defined by its start and end positions in the originally recognized string. Alternative * hypotheses are represented as strings which may replace that substring. * * <p> These alternatives can be used to enhance recognition by adding/re-ranking/applying or in * other ways manipulating the SpeechRecognizer results before powering dictation features. */ @DataClass( genBuilder = true, genConstructor = false, genEqualsHashCode = true, genParcelable = true, genToString = true ) @DataClass.Suppress( {"Builder.setStartPosition", "Builder.setEndPosition", "Builder.addAlternative"}) public final class AlternativeSpan implements Parcelable { /** * The start position of the span of the originally recognized string. * * <p> Must be set to a non-negative value before building. */ private final int mStartPosition; /** * The exclusive end position of the span of the originally recognized string. * * <p> Must be set to a value greater than the start of the span before building. */ private final int mEndPosition; /** * All the alternatives for the [mStart, mEnd) span. * * <p> Must not be empty. If the recognizer does not produce an alternative, this list will * contain a single empty string. * * <p> The alternatives may be strings of different lengths than the span they can replace. */ @NonNull @DataClass.PluralOf("alternative") private final List<String> mAlternatives; private static List<String> defaultAlternatives() { return new ArrayList<>(); } private void onConstructed() { Preconditions.checkArgumentNonnegative(mStartPosition, "The range start must be non-negative."); Preconditions.checkArgument(mStartPosition < mEndPosition, "Illegal range [%d, %d), must be start < end.", mStartPosition, mEndPosition); Preconditions.checkCollectionNotEmpty(mAlternatives, "List of alternative strings must not be empty."); } // 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/speech/AlternativeSpan.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 */ AlternativeSpan( int startPosition, int endPosition, @NonNull List<String> alternatives) { this.mStartPosition = startPosition; this.mEndPosition = endPosition; this.mAlternatives = alternatives; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mAlternatives); onConstructed(); } /** * The start position of the span of the originally recognized string. * * <p> Must be set to a non-negative value before building. */ @DataClass.Generated.Member public int getStartPosition() { return mStartPosition; } /** * The exclusive end position of the span of the originally recognized string. * * <p> Must be set to a value greater than the start of the span before building. */ @DataClass.Generated.Member public int getEndPosition() { return mEndPosition; } /** * All the alternatives for the [mStart, mEnd) span. * * <p> Must not be empty. If the recognizer does not produce an alternative, this list will * contain a single empty string. * * <p> The alternatives may be strings of different lengths than the span they can replace. */ @DataClass.Generated.Member public @NonNull List<String> getAlternatives() { return mAlternatives; } @Override @DataClass.Generated.Member public String toString() { // You can override field toString logic by defining methods like: // String fieldNameToString() { ... } return "AlternativeSpan { " + "startPosition = " + mStartPosition + ", " + "endPosition = " + mEndPosition + ", " + "alternatives = " + mAlternatives + " }"; } @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(AlternativeSpan other) { ... } // boolean fieldNameEquals(FieldType otherValue) { ... } if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; @SuppressWarnings("unchecked") AlternativeSpan that = (AlternativeSpan) o; //noinspection PointlessBooleanExpression return true && mStartPosition == that.mStartPosition && mEndPosition == that.mEndPosition && java.util.Objects.equals(mAlternatives, that.mAlternatives); } @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 + mStartPosition; _hash = 31 * _hash + mEndPosition; _hash = 31 * _hash + java.util.Objects.hashCode(mAlternatives); 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) { ... } dest.writeInt(mStartPosition); dest.writeInt(mEndPosition); dest.writeStringList(mAlternatives); } @Override @DataClass.Generated.Member public int describeContents() { return 0; } /** @hide */ @SuppressWarnings({"unchecked", "RedundantCast"}) @DataClass.Generated.Member /* package-private */ AlternativeSpan(@NonNull android.os.Parcel in) { // You can override field unparcelling by defining methods like: // static FieldType unparcelFieldName(Parcel in) { ... } int startPosition = in.readInt(); int endPosition = in.readInt(); List<String> alternatives = new ArrayList<>(); in.readStringList(alternatives); this.mStartPosition = startPosition; this.mEndPosition = endPosition; this.mAlternatives = alternatives; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mAlternatives); onConstructed(); } @DataClass.Generated.Member public static final @NonNull Parcelable.Creator<AlternativeSpan> CREATOR = new Parcelable.Creator<AlternativeSpan>() { @Override public AlternativeSpan[] newArray(int size) { return new AlternativeSpan[size]; } @Override public AlternativeSpan createFromParcel(@NonNull android.os.Parcel in) { return new AlternativeSpan(in); } }; /** * A builder for {@link AlternativeSpan} */ @SuppressWarnings("WeakerAccess") @DataClass.Generated.Member public static final class Builder { private int mStartPosition; private int mEndPosition; private @NonNull List<String> mAlternatives; private long mBuilderFieldsSet = 0L; /** * Creates a new Builder. * * @param startPosition * The start position of the span of the originally recognized string. * * <p> Must be set to a non-negative value before building. * @param endPosition * The exclusive end position of the span of the originally recognized string. * * <p> Must be set to a value greater than the start of the span before building. */ public Builder( int startPosition, int endPosition) { mStartPosition = startPosition; mEndPosition = endPosition; } /** * All the alternatives for the [mStart, mEnd) span. * * <p> Must not be empty. If the recognizer does not produce an alternative, this list will * contain a single empty string. * * <p> The alternatives may be strings of different lengths than the span they can replace. */ @DataClass.Generated.Member public @NonNull Builder setAlternatives(@NonNull List<String> value) { checkNotUsed(); mBuilderFieldsSet |= 0x4; mAlternatives = value; return this; } /** Builds the instance. This builder should not be touched after calling this! */ public @NonNull AlternativeSpan build() { checkNotUsed(); mBuilderFieldsSet |= 0x8; // Mark builder used if ((mBuilderFieldsSet & 0x4) == 0) { mAlternatives = defaultAlternatives(); } AlternativeSpan o = new AlternativeSpan( mStartPosition, mEndPosition, mAlternatives); return o; } private void checkNotUsed() { if ((mBuilderFieldsSet & 0x8) != 0) { throw new IllegalStateException( "This Builder should not be reused. Use a new Builder instance instead"); } } } @DataClass.Generated( time = 1655225556488L, codegenVersion = "1.0.23", sourceFile = "frameworks/base/core/java/android/speech/AlternativeSpan.java", inputSignatures = "private final int mStartPosition\nprivate final int mEndPosition\nprivate final @android.annotation.NonNull @com.android.internal.util.DataClass.PluralOf(\"alternative\") java.util.List<java.lang.String> mAlternatives\nprivate static java.util.List<java.lang.String> defaultAlternatives()\nprivate void onConstructed()\nclass AlternativeSpan extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genBuilder=true, genConstructor=false, genEqualsHashCode=true, genParcelable=true, genToString=true)") @Deprecated private void __metadata() {} //@formatter:on // End of generated code } core/java/android/speech/AlternativeSpans.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.speech; parcelable AlternativeSpans; core/java/android/speech/AlternativeSpans.java 0 → 100644 +224 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.speech; import android.annotation.NonNull; import android.os.Parcelable; import com.android.internal.util.DataClass; import java.util.ArrayList; import java.util.List; /** * List of {@link AlternativeSpan} for a specific speech recognition result. * * <p> A single {@link SpeechRecognizer} result is represented as a {@link String}. Each element * in this list is an {@link AlternativeSpan} object representing alternative hypotheses for a * specific span (substring) of the originally recognized string. */ @DataClass( genBuilder = true, genConstructor = false, genEqualsHashCode = true, genParcelable = true, genToString = true ) @DataClass.Suppress({"Builder.addSpan"}) public final class AlternativeSpans implements Parcelable { /** List of {@link AlternativeSpan} for a specific speech recognition result. */ @NonNull @DataClass.PluralOf("span") private final List<AlternativeSpan> mSpans; private static List<AlternativeSpan> defaultSpans() { return new ArrayList<>(); } // 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/speech/AlternativeSpans.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 */ AlternativeSpans( @NonNull List<AlternativeSpan> spans) { this.mSpans = spans; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mSpans); // onConstructed(); // You can define this method to get a callback } /** * List of {@link AlternativeSpan} for a specific speech recognition result. */ @DataClass.Generated.Member public @NonNull List<AlternativeSpan> getSpans() { return mSpans; } @Override @DataClass.Generated.Member public String toString() { // You can override field toString logic by defining methods like: // String fieldNameToString() { ... } return "AlternativeSpans { " + "spans = " + mSpans + " }"; } @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(AlternativeSpans other) { ... } // boolean fieldNameEquals(FieldType otherValue) { ... } if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; @SuppressWarnings("unchecked") AlternativeSpans that = (AlternativeSpans) o; //noinspection PointlessBooleanExpression return true && java.util.Objects.equals(mSpans, that.mSpans); } @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(mSpans); 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) { ... } dest.writeParcelableList(mSpans, flags); } @Override @DataClass.Generated.Member public int describeContents() { return 0; } /** @hide */ @SuppressWarnings({"unchecked", "RedundantCast"}) @DataClass.Generated.Member /* package-private */ AlternativeSpans(@NonNull android.os.Parcel in) { // You can override field unparcelling by defining methods like: // static FieldType unparcelFieldName(Parcel in) { ... } List<AlternativeSpan> spans = new ArrayList<>(); in.readParcelableList(spans, AlternativeSpan.class.getClassLoader()); this.mSpans = spans; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mSpans); // onConstructed(); // You can define this method to get a callback } @DataClass.Generated.Member public static final @NonNull Parcelable.Creator<AlternativeSpans> CREATOR = new Parcelable.Creator<AlternativeSpans>() { @Override public AlternativeSpans[] newArray(int size) { return new AlternativeSpans[size]; } @Override public AlternativeSpans createFromParcel(@NonNull android.os.Parcel in) { return new AlternativeSpans(in); } }; /** * A builder for {@link AlternativeSpans} */ @SuppressWarnings("WeakerAccess") @DataClass.Generated.Member public static final class Builder { private @NonNull List<AlternativeSpan> mSpans; private long mBuilderFieldsSet = 0L; public Builder() { } /** * List of {@link AlternativeSpan} for a specific speech recognition result. */ @DataClass.Generated.Member public @NonNull Builder setSpans(@NonNull List<AlternativeSpan> value) { checkNotUsed(); mBuilderFieldsSet |= 0x1; mSpans = value; return this; } /** Builds the instance. This builder should not be touched after calling this! */ public @NonNull AlternativeSpans build() { checkNotUsed(); mBuilderFieldsSet |= 0x2; // Mark builder used if ((mBuilderFieldsSet & 0x1) == 0) { mSpans = defaultSpans(); } AlternativeSpans o = new AlternativeSpans( mSpans); 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 = 1655151024975L, codegenVersion = "1.0.23", sourceFile = "frameworks/base/core/java/android/speech/AlternativeSpans.java", inputSignatures = "private final @android.annotation.NonNull @com.android.internal.util.DataClass.PluralOf(\"span\") java.util.List<android.speech.AlternativeSpan> mSpans\nprivate static java.util.List<android.speech.AlternativeSpan> defaultSpans()\nclass AlternativeSpans extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genBuilder=true, genConstructor=false, genEqualsHashCode=true, genParcelable=true, genToString=true)") @Deprecated private void __metadata() {} //@formatter:on // End of generated code } Loading
core/api/current.txt +29 −0 Original line number Diff line number Diff line Loading @@ -39619,6 +39619,34 @@ package android.service.wallpaper { package android.speech { public final class AlternativeSpan implements android.os.Parcelable { method public int describeContents(); method @NonNull public java.util.List<java.lang.String> getAlternatives(); method public int getEndPosition(); method public int getStartPosition(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.speech.AlternativeSpan> CREATOR; } public static final class AlternativeSpan.Builder { ctor public AlternativeSpan.Builder(int, int); method @NonNull public android.speech.AlternativeSpan build(); method @NonNull public android.speech.AlternativeSpan.Builder setAlternatives(@NonNull java.util.List<java.lang.String>); } public final class AlternativeSpans implements android.os.Parcelable { method public int describeContents(); method @NonNull public java.util.List<android.speech.AlternativeSpan> getSpans(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.speech.AlternativeSpans> CREATOR; } public static final class AlternativeSpans.Builder { ctor public AlternativeSpans.Builder(); method @NonNull public android.speech.AlternativeSpans build(); method @NonNull public android.speech.AlternativeSpans.Builder setSpans(@NonNull java.util.List<android.speech.AlternativeSpan>); } public interface RecognitionListener { method public void onBeginningOfSpeech(); method public void onBufferReceived(byte[]); Loading Loading @@ -39780,6 +39808,7 @@ package android.speech { field public static final int ERROR_SERVER_DISCONNECTED = 11; // 0xb field public static final int ERROR_SPEECH_TIMEOUT = 6; // 0x6 field public static final int ERROR_TOO_MANY_REQUESTS = 10; // 0xa field public static final String RESULTS_ALTERNATIVES = "results_alternatives"; field public static final String RESULTS_RECOGNITION = "results_recognition"; }
core/java/android/speech/AlternativeSpan.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.speech; parcelable AlternativeSpan;
core/java/android/speech/AlternativeSpan.java 0 → 100644 +327 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.speech; import android.annotation.NonNull; import android.os.Parcelable; import com.android.internal.util.DataClass; import com.android.internal.util.Preconditions; import java.util.ArrayList; import java.util.List; /** * List of alternative hypotheses for a specific span of a speech recognition result string. * * <p> A single {@link SpeechRecognizer} result is represented as a {@link String}. For a specific * span of the originally recognized result string, the recognizer may provide alternative * hypotheses of what it may have recognized. A span is specifically a substring and is thereby * defined by its start and end positions in the originally recognized string. Alternative * hypotheses are represented as strings which may replace that substring. * * <p> These alternatives can be used to enhance recognition by adding/re-ranking/applying or in * other ways manipulating the SpeechRecognizer results before powering dictation features. */ @DataClass( genBuilder = true, genConstructor = false, genEqualsHashCode = true, genParcelable = true, genToString = true ) @DataClass.Suppress( {"Builder.setStartPosition", "Builder.setEndPosition", "Builder.addAlternative"}) public final class AlternativeSpan implements Parcelable { /** * The start position of the span of the originally recognized string. * * <p> Must be set to a non-negative value before building. */ private final int mStartPosition; /** * The exclusive end position of the span of the originally recognized string. * * <p> Must be set to a value greater than the start of the span before building. */ private final int mEndPosition; /** * All the alternatives for the [mStart, mEnd) span. * * <p> Must not be empty. If the recognizer does not produce an alternative, this list will * contain a single empty string. * * <p> The alternatives may be strings of different lengths than the span they can replace. */ @NonNull @DataClass.PluralOf("alternative") private final List<String> mAlternatives; private static List<String> defaultAlternatives() { return new ArrayList<>(); } private void onConstructed() { Preconditions.checkArgumentNonnegative(mStartPosition, "The range start must be non-negative."); Preconditions.checkArgument(mStartPosition < mEndPosition, "Illegal range [%d, %d), must be start < end.", mStartPosition, mEndPosition); Preconditions.checkCollectionNotEmpty(mAlternatives, "List of alternative strings must not be empty."); } // 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/speech/AlternativeSpan.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 */ AlternativeSpan( int startPosition, int endPosition, @NonNull List<String> alternatives) { this.mStartPosition = startPosition; this.mEndPosition = endPosition; this.mAlternatives = alternatives; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mAlternatives); onConstructed(); } /** * The start position of the span of the originally recognized string. * * <p> Must be set to a non-negative value before building. */ @DataClass.Generated.Member public int getStartPosition() { return mStartPosition; } /** * The exclusive end position of the span of the originally recognized string. * * <p> Must be set to a value greater than the start of the span before building. */ @DataClass.Generated.Member public int getEndPosition() { return mEndPosition; } /** * All the alternatives for the [mStart, mEnd) span. * * <p> Must not be empty. If the recognizer does not produce an alternative, this list will * contain a single empty string. * * <p> The alternatives may be strings of different lengths than the span they can replace. */ @DataClass.Generated.Member public @NonNull List<String> getAlternatives() { return mAlternatives; } @Override @DataClass.Generated.Member public String toString() { // You can override field toString logic by defining methods like: // String fieldNameToString() { ... } return "AlternativeSpan { " + "startPosition = " + mStartPosition + ", " + "endPosition = " + mEndPosition + ", " + "alternatives = " + mAlternatives + " }"; } @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(AlternativeSpan other) { ... } // boolean fieldNameEquals(FieldType otherValue) { ... } if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; @SuppressWarnings("unchecked") AlternativeSpan that = (AlternativeSpan) o; //noinspection PointlessBooleanExpression return true && mStartPosition == that.mStartPosition && mEndPosition == that.mEndPosition && java.util.Objects.equals(mAlternatives, that.mAlternatives); } @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 + mStartPosition; _hash = 31 * _hash + mEndPosition; _hash = 31 * _hash + java.util.Objects.hashCode(mAlternatives); 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) { ... } dest.writeInt(mStartPosition); dest.writeInt(mEndPosition); dest.writeStringList(mAlternatives); } @Override @DataClass.Generated.Member public int describeContents() { return 0; } /** @hide */ @SuppressWarnings({"unchecked", "RedundantCast"}) @DataClass.Generated.Member /* package-private */ AlternativeSpan(@NonNull android.os.Parcel in) { // You can override field unparcelling by defining methods like: // static FieldType unparcelFieldName(Parcel in) { ... } int startPosition = in.readInt(); int endPosition = in.readInt(); List<String> alternatives = new ArrayList<>(); in.readStringList(alternatives); this.mStartPosition = startPosition; this.mEndPosition = endPosition; this.mAlternatives = alternatives; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mAlternatives); onConstructed(); } @DataClass.Generated.Member public static final @NonNull Parcelable.Creator<AlternativeSpan> CREATOR = new Parcelable.Creator<AlternativeSpan>() { @Override public AlternativeSpan[] newArray(int size) { return new AlternativeSpan[size]; } @Override public AlternativeSpan createFromParcel(@NonNull android.os.Parcel in) { return new AlternativeSpan(in); } }; /** * A builder for {@link AlternativeSpan} */ @SuppressWarnings("WeakerAccess") @DataClass.Generated.Member public static final class Builder { private int mStartPosition; private int mEndPosition; private @NonNull List<String> mAlternatives; private long mBuilderFieldsSet = 0L; /** * Creates a new Builder. * * @param startPosition * The start position of the span of the originally recognized string. * * <p> Must be set to a non-negative value before building. * @param endPosition * The exclusive end position of the span of the originally recognized string. * * <p> Must be set to a value greater than the start of the span before building. */ public Builder( int startPosition, int endPosition) { mStartPosition = startPosition; mEndPosition = endPosition; } /** * All the alternatives for the [mStart, mEnd) span. * * <p> Must not be empty. If the recognizer does not produce an alternative, this list will * contain a single empty string. * * <p> The alternatives may be strings of different lengths than the span they can replace. */ @DataClass.Generated.Member public @NonNull Builder setAlternatives(@NonNull List<String> value) { checkNotUsed(); mBuilderFieldsSet |= 0x4; mAlternatives = value; return this; } /** Builds the instance. This builder should not be touched after calling this! */ public @NonNull AlternativeSpan build() { checkNotUsed(); mBuilderFieldsSet |= 0x8; // Mark builder used if ((mBuilderFieldsSet & 0x4) == 0) { mAlternatives = defaultAlternatives(); } AlternativeSpan o = new AlternativeSpan( mStartPosition, mEndPosition, mAlternatives); return o; } private void checkNotUsed() { if ((mBuilderFieldsSet & 0x8) != 0) { throw new IllegalStateException( "This Builder should not be reused. Use a new Builder instance instead"); } } } @DataClass.Generated( time = 1655225556488L, codegenVersion = "1.0.23", sourceFile = "frameworks/base/core/java/android/speech/AlternativeSpan.java", inputSignatures = "private final int mStartPosition\nprivate final int mEndPosition\nprivate final @android.annotation.NonNull @com.android.internal.util.DataClass.PluralOf(\"alternative\") java.util.List<java.lang.String> mAlternatives\nprivate static java.util.List<java.lang.String> defaultAlternatives()\nprivate void onConstructed()\nclass AlternativeSpan extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genBuilder=true, genConstructor=false, genEqualsHashCode=true, genParcelable=true, genToString=true)") @Deprecated private void __metadata() {} //@formatter:on // End of generated code }
core/java/android/speech/AlternativeSpans.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.speech; parcelable AlternativeSpans;
core/java/android/speech/AlternativeSpans.java 0 → 100644 +224 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.speech; import android.annotation.NonNull; import android.os.Parcelable; import com.android.internal.util.DataClass; import java.util.ArrayList; import java.util.List; /** * List of {@link AlternativeSpan} for a specific speech recognition result. * * <p> A single {@link SpeechRecognizer} result is represented as a {@link String}. Each element * in this list is an {@link AlternativeSpan} object representing alternative hypotheses for a * specific span (substring) of the originally recognized string. */ @DataClass( genBuilder = true, genConstructor = false, genEqualsHashCode = true, genParcelable = true, genToString = true ) @DataClass.Suppress({"Builder.addSpan"}) public final class AlternativeSpans implements Parcelable { /** List of {@link AlternativeSpan} for a specific speech recognition result. */ @NonNull @DataClass.PluralOf("span") private final List<AlternativeSpan> mSpans; private static List<AlternativeSpan> defaultSpans() { return new ArrayList<>(); } // 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/speech/AlternativeSpans.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 */ AlternativeSpans( @NonNull List<AlternativeSpan> spans) { this.mSpans = spans; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mSpans); // onConstructed(); // You can define this method to get a callback } /** * List of {@link AlternativeSpan} for a specific speech recognition result. */ @DataClass.Generated.Member public @NonNull List<AlternativeSpan> getSpans() { return mSpans; } @Override @DataClass.Generated.Member public String toString() { // You can override field toString logic by defining methods like: // String fieldNameToString() { ... } return "AlternativeSpans { " + "spans = " + mSpans + " }"; } @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(AlternativeSpans other) { ... } // boolean fieldNameEquals(FieldType otherValue) { ... } if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; @SuppressWarnings("unchecked") AlternativeSpans that = (AlternativeSpans) o; //noinspection PointlessBooleanExpression return true && java.util.Objects.equals(mSpans, that.mSpans); } @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(mSpans); 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) { ... } dest.writeParcelableList(mSpans, flags); } @Override @DataClass.Generated.Member public int describeContents() { return 0; } /** @hide */ @SuppressWarnings({"unchecked", "RedundantCast"}) @DataClass.Generated.Member /* package-private */ AlternativeSpans(@NonNull android.os.Parcel in) { // You can override field unparcelling by defining methods like: // static FieldType unparcelFieldName(Parcel in) { ... } List<AlternativeSpan> spans = new ArrayList<>(); in.readParcelableList(spans, AlternativeSpan.class.getClassLoader()); this.mSpans = spans; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mSpans); // onConstructed(); // You can define this method to get a callback } @DataClass.Generated.Member public static final @NonNull Parcelable.Creator<AlternativeSpans> CREATOR = new Parcelable.Creator<AlternativeSpans>() { @Override public AlternativeSpans[] newArray(int size) { return new AlternativeSpans[size]; } @Override public AlternativeSpans createFromParcel(@NonNull android.os.Parcel in) { return new AlternativeSpans(in); } }; /** * A builder for {@link AlternativeSpans} */ @SuppressWarnings("WeakerAccess") @DataClass.Generated.Member public static final class Builder { private @NonNull List<AlternativeSpan> mSpans; private long mBuilderFieldsSet = 0L; public Builder() { } /** * List of {@link AlternativeSpan} for a specific speech recognition result. */ @DataClass.Generated.Member public @NonNull Builder setSpans(@NonNull List<AlternativeSpan> value) { checkNotUsed(); mBuilderFieldsSet |= 0x1; mSpans = value; return this; } /** Builds the instance. This builder should not be touched after calling this! */ public @NonNull AlternativeSpans build() { checkNotUsed(); mBuilderFieldsSet |= 0x2; // Mark builder used if ((mBuilderFieldsSet & 0x1) == 0) { mSpans = defaultSpans(); } AlternativeSpans o = new AlternativeSpans( mSpans); 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 = 1655151024975L, codegenVersion = "1.0.23", sourceFile = "frameworks/base/core/java/android/speech/AlternativeSpans.java", inputSignatures = "private final @android.annotation.NonNull @com.android.internal.util.DataClass.PluralOf(\"span\") java.util.List<android.speech.AlternativeSpan> mSpans\nprivate static java.util.List<android.speech.AlternativeSpan> defaultSpans()\nclass AlternativeSpans extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genBuilder=true, genConstructor=false, genEqualsHashCode=true, genParcelable=true, genToString=true)") @Deprecated private void __metadata() {} //@formatter:on // End of generated code }