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

Commit fb45d8ed authored by Ahaan Ugale's avatar Ahaan Ugale Committed by Android (Google) Code Review
Browse files

Merge "Adjust HotwordDetectedResult with up-to-date information." into sc-dev

parents db99d266 966917e5
Loading
Loading
Loading
Loading
+21 −7
Original line number Diff line number Diff line
@@ -10513,9 +10513,11 @@ package android.service.voice {
  public final class HotwordDetectedResult implements android.os.Parcelable {
    method public int describeContents();
    method public int getByteOffset();
    method public int getAudioChannel();
    method public int getConfidenceLevel();
    method @NonNull public android.os.PersistableBundle getExtras();
    method public int getHotwordDurationMillis();
    method public int getHotwordOffsetMillis();
    method public int getHotwordPhraseId();
    method public static int getMaxBundleSize();
    method public static int getMaxHotwordPhraseId();
@@ -10523,19 +10525,31 @@ package android.service.voice {
    method @Nullable public android.media.MediaSyncEvent getMediaSyncEvent();
    method public int getPersonalizedScore();
    method public int getScore();
    method public boolean isPersonalizedHotwordDetection();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field public static final int BYTE_OFFSET_UNSET = -1; // 0xffffffff
    field public static final int AUDIO_CHANNEL_UNSET = -1; // 0xffffffff
    field public static final int CONFIDENCE_LEVEL_HIGH = 5; // 0x5
    field public static final int CONFIDENCE_LEVEL_LOW = 1; // 0x1
    field public static final int CONFIDENCE_LEVEL_LOW_MEDIUM = 2; // 0x2
    field public static final int CONFIDENCE_LEVEL_MEDIUM = 3; // 0x3
    field public static final int CONFIDENCE_LEVEL_MEDIUM_HIGH = 4; // 0x4
    field public static final int CONFIDENCE_LEVEL_NONE = 0; // 0x0
    field public static final int CONFIDENCE_LEVEL_VERY_HIGH = 6; // 0x6
    field @NonNull public static final android.os.Parcelable.Creator<android.service.voice.HotwordDetectedResult> CREATOR;
    field public static final int HOTWORD_OFFSET_UNSET = -1; // 0xffffffff
  }
  public static final class HotwordDetectedResult.Builder {
    ctor public HotwordDetectedResult.Builder();
    method @NonNull public android.service.voice.HotwordDetectedResult build();
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setByteOffset(int);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setAudioChannel(int);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setConfidenceLevel(int);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setExtras(@NonNull android.os.PersistableBundle);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setHotwordDurationMillis(int);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setHotwordOffsetMillis(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 setPersonalizedHotwordDetection(boolean);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setPersonalizedScore(int);
    method @NonNull public android.service.voice.HotwordDetectedResult.Builder setScore(int);
  }
@@ -10565,10 +10579,6 @@ package android.service.voice {
    method public boolean startRecognition(@NonNull android.os.ParcelFileDescriptor, @NonNull android.media.AudioFormat, @Nullable android.os.PersistableBundle);
    method public boolean stopRecognition();
    method public void updateState(@Nullable android.os.PersistableBundle, @Nullable android.os.SharedMemory);
    field public static final int CONFIDENCE_LEVEL_HIGH = 3; // 0x3
    field public static final int CONFIDENCE_LEVEL_LOW = 1; // 0x1
    field public static final int CONFIDENCE_LEVEL_MEDIUM = 2; // 0x2
    field public static final int CONFIDENCE_LEVEL_NONE = 0; // 0x0
  }
  public static interface HotwordDetector.Callback {
@@ -10585,6 +10595,10 @@ package android.service.voice {
    method public int describeContents();
    method public int getConfidenceLevel();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field public static final int CONFIDENCE_LEVEL_HIGH = 3; // 0x3
    field public static final int CONFIDENCE_LEVEL_LOW = 1; // 0x1
    field public static final int CONFIDENCE_LEVEL_MEDIUM = 2; // 0x2
    field public static final int CONFIDENCE_LEVEL_NONE = 0; // 0x0
    field @NonNull public static final android.os.Parcelable.Creator<android.service.voice.HotwordRejectedResult> CREATOR;
  }
+241 −47

File changed.

Preview size limit exceeded, changes collapsed.

+0 −23
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package android.service.voice;
import static android.Manifest.permission.CAPTURE_AUDIO_HOTWORD;
import static android.Manifest.permission.RECORD_AUDIO;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
@@ -37,28 +36,6 @@ import android.os.SharedMemory;
@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 {
    }

    /**
     * Starts hotword recognition.
     * <p>
+61 −13
Original line number Diff line number Diff line
@@ -16,8 +16,7 @@

package android.service.voice;

import static android.service.voice.HotwordDetector.CONFIDENCE_LEVEL_NONE;

import android.annotation.IntDef;
import android.annotation.SystemApi;
import android.os.Parcelable;

@@ -39,8 +38,30 @@ import com.android.internal.util.DataClass;
@SystemApi
public final class HotwordRejectedResult implements Parcelable {

    /** No confidence in hotword detector result. */
    public static final int CONFIDENCE_LEVEL_NONE = 0;

    /** Small confidence in hotword detector result. */
    public static final int CONFIDENCE_LEVEL_LOW = 1;

    /** Medium confidence in hotword detector result. */
    public static final int CONFIDENCE_LEVEL_MEDIUM = 2;

    /** High confidence in hotword detector result. */
    public static final 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 {
    }

    /** Confidence level in the trigger outcome. */
    @HotwordDetector.HotwordConfidenceLevelValue
    @HotwordConfidenceLevelValue
    private final int mConfidenceLevel;
    private static int defaultConfidenceLevel() {
        return CONFIDENCE_LEVEL_NONE;
@@ -48,7 +69,7 @@ public final class HotwordRejectedResult implements Parcelable {



    // Code below generated by codegen v1.0.22.
    // Code below generated by codegen v1.0.23.
    //
    // DO NOT MODIFY!
    // CHECKSTYLE:OFF Generated code
@@ -61,12 +82,39 @@ public final class HotwordRejectedResult implements Parcelable {
    //@formatter:off


    /** @hide */
    @IntDef(prefix = "CONFIDENCE_LEVEL_", value = {
        CONFIDENCE_LEVEL_NONE,
        CONFIDENCE_LEVEL_LOW,
        CONFIDENCE_LEVEL_MEDIUM,
        CONFIDENCE_LEVEL_HIGH
    })
    @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE)
    @DataClass.Generated.Member
    public @interface ConfidenceLevel {}

    /** @hide */
    @DataClass.Generated.Member
    public static String confidenceLevelToString(@ConfidenceLevel int value) {
        switch (value) {
            case CONFIDENCE_LEVEL_NONE:
                    return "CONFIDENCE_LEVEL_NONE";
            case CONFIDENCE_LEVEL_LOW:
                    return "CONFIDENCE_LEVEL_LOW";
            case CONFIDENCE_LEVEL_MEDIUM:
                    return "CONFIDENCE_LEVEL_MEDIUM";
            case CONFIDENCE_LEVEL_HIGH:
                    return "CONFIDENCE_LEVEL_HIGH";
            default: return Integer.toHexString(value);
        }
    }

    @DataClass.Generated.Member
    /* package-private */ HotwordRejectedResult(
            @HotwordDetector.HotwordConfidenceLevelValue int confidenceLevel) {
            @HotwordConfidenceLevelValue int confidenceLevel) {
        this.mConfidenceLevel = confidenceLevel;
        com.android.internal.util.AnnotationValidations.validate(
                HotwordDetector.HotwordConfidenceLevelValue.class, null, mConfidenceLevel);
                HotwordConfidenceLevelValue.class, null, mConfidenceLevel);

        // onConstructed(); // You can define this method to get a callback
    }
@@ -75,7 +123,7 @@ public final class HotwordRejectedResult implements Parcelable {
     * Confidence level in the trigger outcome.
     */
    @DataClass.Generated.Member
    public @HotwordDetector.HotwordConfidenceLevelValue int getConfidenceLevel() {
    public @HotwordConfidenceLevelValue int getConfidenceLevel() {
        return mConfidenceLevel;
    }

@@ -141,7 +189,7 @@ public final class HotwordRejectedResult implements Parcelable {

        this.mConfidenceLevel = confidenceLevel;
        com.android.internal.util.AnnotationValidations.validate(
                HotwordDetector.HotwordConfidenceLevelValue.class, null, mConfidenceLevel);
                HotwordConfidenceLevelValue.class, null, mConfidenceLevel);

        // onConstructed(); // You can define this method to get a callback
    }
@@ -168,7 +216,7 @@ public final class HotwordRejectedResult implements Parcelable {
    @DataClass.Generated.Member
    public static final class Builder {

        private @HotwordDetector.HotwordConfidenceLevelValue int mConfidenceLevel;
        private @HotwordConfidenceLevelValue int mConfidenceLevel;

        private long mBuilderFieldsSet = 0L;

@@ -179,7 +227,7 @@ public final class HotwordRejectedResult implements Parcelable {
         * Confidence level in the trigger outcome.
         */
        @DataClass.Generated.Member
        public @android.annotation.NonNull Builder setConfidenceLevel(@HotwordDetector.HotwordConfidenceLevelValue int value) {
        public @android.annotation.NonNull Builder setConfidenceLevel(@HotwordConfidenceLevelValue int value) {
            checkNotUsed();
            mBuilderFieldsSet |= 0x1;
            mConfidenceLevel = value;
@@ -208,10 +256,10 @@ public final class HotwordRejectedResult implements Parcelable {
    }

    @DataClass.Generated(
            time = 1616108967315L,
            codegenVersion = "1.0.22",
            time = 1621551683210L,
            codegenVersion = "1.0.23",
            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)")
            inputSignatures = "public static final  int CONFIDENCE_LEVEL_NONE\npublic static final  int CONFIDENCE_LEVEL_LOW\npublic static final  int CONFIDENCE_LEVEL_MEDIUM\npublic static final  int CONFIDENCE_LEVEL_HIGH\nprivate final @android.service.voice.HotwordRejectedResult.HotwordConfidenceLevelValue int mConfidenceLevel\nprivate static  int defaultConfidenceLevel()\nclass HotwordRejectedResult extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genConstructor=false, genHiddenBuilder=true, genEqualsHashCode=true, genHiddenConstDefs=true, genParcelable=true, genToString=true)")
    @Deprecated
    private void __metadata() {}