diff options
| author | 2022-03-21 13:42:45 -0700 | |
|---|---|---|
| committer | 2022-03-22 22:53:57 +0000 | |
| commit | 4b1a9dbcff425dbebc82a88a7cd20bf4890d72c2 (patch) | |
| tree | 8c8b038d8968563563ab5ab80e6b2ee00e05ce03 | |
| parent | 55eb3067b29146e0841d0abd6fa160d66d0faa6f (diff) | |
add IntRange to KeyphraseRecognitionExtra APIs
added coarseConfidenceLevel IntRange
Bug: 220128045
Test: atest AlwaysOnHotwordDetectorEventPayloadTest
Change-Id: I2b0b7cbb6bc446fdfbb9241eed763fd4f4d33531
| -rw-r--r-- | core/api/system-current.txt | 2 | ||||
| -rw-r--r-- | core/java/android/hardware/soundtrigger/SoundTrigger.java | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 61309e3e9222..dd0cbef47594 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -5247,7 +5247,7 @@ package android.hardware.soundtrigger { public static final class SoundTrigger.KeyphraseRecognitionExtra implements android.os.Parcelable { method public int describeContents(); - method public int getCoarseConfidenceLevel(); + method @IntRange(from=0, to=100) public int getCoarseConfidenceLevel(); method public int getKeyphraseId(); method public int getRecognitionModes(); method public void writeToParcel(@NonNull android.os.Parcel, int); diff --git a/core/java/android/hardware/soundtrigger/SoundTrigger.java b/core/java/android/hardware/soundtrigger/SoundTrigger.java index c36390917cf1..a9d665c8b8a5 100644 --- a/core/java/android/hardware/soundtrigger/SoundTrigger.java +++ b/core/java/android/hardware/soundtrigger/SoundTrigger.java @@ -29,6 +29,7 @@ import static android.system.OsConstants.EPIPE; import static java.util.Objects.requireNonNull; import android.annotation.IntDef; +import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; @@ -1630,7 +1631,8 @@ public class SoundTrigger { * @hide */ @UnsupportedAppUsage - public KeyphraseRecognitionExtra(int id, int recognitionModes, int coarseConfidenceLevel, + public KeyphraseRecognitionExtra(int id, int recognitionModes, + @IntRange(from = 0, to = 100) int coarseConfidenceLevel, @Nullable ConfidenceLevel[] confidenceLevels) { this.id = id; this.recognitionModes = recognitionModes; @@ -1660,6 +1662,7 @@ public class SoundTrigger { * * <p>The confidence level is expressed in percent (0% -100%). */ + @IntRange(from = 0, to = 100) public int getCoarseConfidenceLevel() { return coarseConfidenceLevel; } |