Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e66dcbf3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Revert "add DetectedPhrase API"" into udc-dev am: 6b30fa20

parents 40e006ce 6b30fa20
Loading
Loading
Loading
Loading
+3 −20
Original line number Diff line number Diff line
@@ -13056,21 +13056,6 @@ package android.service.voice {
    method public int getStart();
  }
  public final class DetectedPhrase implements android.os.Parcelable {
    method public int describeContents();
    method public int getId();
    method @Nullable public String getPhrase();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.service.voice.DetectedPhrase> CREATOR;
  }
  public static final class DetectedPhrase.Builder {
    ctor public DetectedPhrase.Builder();
    method @NonNull public android.service.voice.DetectedPhrase build();
    method @NonNull public android.service.voice.DetectedPhrase.Builder setId(int);
    method @NonNull public android.service.voice.DetectedPhrase.Builder setPhrase(@NonNull String);
  }
  public abstract class DetectorFailure implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public String getErrorMessage();
@@ -13112,14 +13097,13 @@ package android.service.voice {
    method @NonNull public java.util.List<android.service.voice.HotwordAudioStream> getAudioStreams();
    method public int getBackgroundAudioPower();
    method public int getConfidenceLevel();
    method @NonNull public android.service.voice.DetectedPhrase getDetectedPhrase();
    method @NonNull public android.os.PersistableBundle getExtras();
    method public int getHotwordDurationMillis();
    method public int getHotwordOffsetMillis();
    method @Deprecated public int getHotwordPhraseId();
    method public int getHotwordPhraseId();
    method public static int getMaxBackgroundAudioPower();
    method public static int getMaxBundleSize();
    method @Deprecated public static int getMaxHotwordPhraseId();
    method public static int getMaxHotwordPhraseId();
    method public static int getMaxScore();
    method @Nullable public android.media.MediaSyncEvent getMediaSyncEvent();
    method public int getPersonalizedScore();
@@ -13150,12 +13134,11 @@ package android.service.voice {
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setAudioStreams(@NonNull java.util.List<android.service.voice.HotwordAudioStream>);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setBackgroundAudioPower(int);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setConfidenceLevel(int);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setDetectedPhrase(@NonNull android.service.voice.DetectedPhrase);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setExtras(@NonNull android.os.PersistableBundle);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setHotwordDetectionPersonalized(boolean);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setHotwordDurationMillis(int);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setHotwordOffsetMillis(int);
    method @Deprecated @NonNull public android.service.voice.HotwordDetectedResult.Builder setHotwordPhraseId(int);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setHotwordPhraseId(int);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setMediaSyncEvent(@NonNull android.media.MediaSyncEvent);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setPersonalizedScore(int);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setScore(int);
+0 −19
Original line number Diff line number Diff line
/*
 * 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 DetectedPhrase;
+0 −286
Original line number Diff line number Diff line
/*
 * 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.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.os.Parcelable;

import com.android.internal.util.DataClass;
import com.android.internal.util.Preconditions;

/**
 * Details about the phrase used to generate a {@link HotwordDetectedResult}
 *
 * @hide
 */
@DataClass(
        genConstructor = false,
        genBuilder = true,
        genEqualsHashCode = true,
        genHiddenConstDefs = true,
        genParcelable = true,
        genToString = true
)
@SystemApi
public final class DetectedPhrase implements Parcelable {

    /**
     * An ID representing the keyphrase that triggered the successful detection.
     */
    private int mId = 0;

    static int defaultHotwordPhraseId() {
        return 0;
    }

    /**
     * A string representing exactly what was heard and interpreted by the service leading to
     * a successful detection.
     *
     * <p>Can be null if not set in {@link DetectedPhrase.Builder}
     */
    @Nullable
    private String mPhrase = null;

    /**
     * Provides an instance of {@link DetectedPhrase.Builder} with state corresponding to
     * this instance.
     * @hide
     */
    public DetectedPhrase.Builder buildUpon() {
        return new DetectedPhrase.Builder()
                .setId(mId)
                .setPhrase(mPhrase);
    }

    private void onConstructed() {
        Preconditions.checkArgumentNonnegative(mId, "hotwordPhraseId");
    }



    // 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/DetectedPhrase.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 */ DetectedPhrase(
            int id,
            @Nullable String phrase) {
        this.mId = id;
        this.mPhrase = phrase;

        onConstructed();
    }

    /**
     * An ID representing the keyphrase that triggered the successful detection.
     */
    @DataClass.Generated.Member
    public int getId() {
        return mId;
    }

    /**
     * A string representing exactly what was heard and interpreted by the service leading to
     * a successful detection.
     *
     * <p>Can be null if not set in {@link DetectedPhrase.Builder}
     */
    @DataClass.Generated.Member
    public @Nullable String getPhrase() {
        return mPhrase;
    }

    @Override
    @DataClass.Generated.Member
    public String toString() {
        // You can override field toString logic by defining methods like:
        // String fieldNameToString() { ... }

        return "DetectedPhrase { " +
                "id = " + mId + ", " +
                "phrase = " + mPhrase +
        " }";
    }

    @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(DetectedPhrase other) { ... }
        // boolean fieldNameEquals(FieldType otherValue) { ... }

        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        @SuppressWarnings("unchecked")
        DetectedPhrase that = (DetectedPhrase) o;
        //noinspection PointlessBooleanExpression
        return true
                && mId == that.mId
                && java.util.Objects.equals(mPhrase, that.mPhrase);
    }

    @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 + mId;
        _hash = 31 * _hash + java.util.Objects.hashCode(mPhrase);
        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 (mPhrase != null) flg |= 0x2;
        dest.writeByte(flg);
        dest.writeInt(mId);
        if (mPhrase != null) dest.writeString(mPhrase);
    }

    @Override
    @DataClass.Generated.Member
    public int describeContents() { return 0; }

    /** @hide */
    @SuppressWarnings({"unchecked", "RedundantCast"})
    @DataClass.Generated.Member
    /* package-private */ DetectedPhrase(@NonNull android.os.Parcel in) {
        // You can override field unparcelling by defining methods like:
        // static FieldType unparcelFieldName(Parcel in) { ... }

        byte flg = in.readByte();
        int id = in.readInt();
        String phrase = (flg & 0x2) == 0 ? null : in.readString();

        this.mId = id;
        this.mPhrase = phrase;

        onConstructed();
    }

    @DataClass.Generated.Member
    public static final @NonNull Parcelable.Creator<DetectedPhrase> CREATOR
            = new Parcelable.Creator<DetectedPhrase>() {
        @Override
        public DetectedPhrase[] newArray(int size) {
            return new DetectedPhrase[size];
        }

        @Override
        public DetectedPhrase createFromParcel(@NonNull android.os.Parcel in) {
            return new DetectedPhrase(in);
        }
    };

    /**
     * A builder for {@link DetectedPhrase}
     */
    @SuppressWarnings("WeakerAccess")
    @DataClass.Generated.Member
    public static final class Builder {

        private int mId;
        private @Nullable String mPhrase;

        private long mBuilderFieldsSet = 0L;

        public Builder() {
        }

        /**
         * An ID representing the keyphrase that triggered the successful detection.
         */
        @DataClass.Generated.Member
        public @NonNull Builder setId(int value) {
            checkNotUsed();
            mBuilderFieldsSet |= 0x1;
            mId = value;
            return this;
        }

        /**
         * A string representing exactly what was heard and interpreted by the service leading to
         * a successful detection.
         *
         * <p>Can be null if not set in {@link DetectedPhrase.Builder}
         */
        @DataClass.Generated.Member
        public @NonNull Builder setPhrase(@NonNull String value) {
            checkNotUsed();
            mBuilderFieldsSet |= 0x2;
            mPhrase = value;
            return this;
        }

        /** Builds the instance. This builder should not be touched after calling this! */
        public @NonNull DetectedPhrase build() {
            checkNotUsed();
            mBuilderFieldsSet |= 0x4; // Mark builder used

            if ((mBuilderFieldsSet & 0x1) == 0) {
                mId = 0;
            }
            if ((mBuilderFieldsSet & 0x2) == 0) {
                mPhrase = null;
            }
            DetectedPhrase o = new DetectedPhrase(
                    mId,
                    mPhrase);
            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 = 1676870329959L,
            codegenVersion = "1.0.23",
            sourceFile = "frameworks/base/core/java/android/service/voice/DetectedPhrase.java",
            inputSignatures = "private  int mId\nprivate @android.annotation.Nullable java.lang.String mPhrase\nstatic  int defaultHotwordPhraseId()\npublic  android.service.voice.DetectedPhrase.Builder buildUpon()\nprivate  void onConstructed()\nclass DetectedPhrase 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

}