diff options
| author | 2024-05-09 23:27:41 +0000 | |
|---|---|---|
| committer | 2024-07-23 18:18:40 +0000 | |
| commit | 905eb983f1486326fd000a1fb7f0337b4b49b51c (patch) | |
| tree | c1cb4a54588cea2e80e02b44531f5dd27a55107d | |
| parent | ea068bf33f651470352259f58d771c55f3719bde (diff) | |
Expose GenericSoundModel as SystemApi.
API-Coverage-Bug:342000786
Bug: 339267254
Flag: android.media.soundtrigger.sound_trigger_generic_model_api
Test: Build image for Pixel Watch devices.
Change-Id: I598708a7c4280f4577e6e2ec2a36fbdbe20cb5bd
| -rw-r--r-- | core/api/system-current.txt | 8 | ||||
| -rw-r--r-- | core/java/android/hardware/soundtrigger/SoundTrigger.java | 24 |
2 files changed, 27 insertions, 5 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 50d97cf0626f..961a895af9f6 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -6679,6 +6679,14 @@ package android.hardware.soundtrigger { field public static final int STATUS_OK = 0; // 0x0 } + @FlaggedApi("android.media.soundtrigger.sound_trigger_generic_model_api") public static final class SoundTrigger.GenericSoundModel extends android.hardware.soundtrigger.SoundTrigger.SoundModel implements android.os.Parcelable { + ctor public SoundTrigger.GenericSoundModel(@NonNull java.util.UUID, @NonNull java.util.UUID, @Nullable byte[], int); + ctor public SoundTrigger.GenericSoundModel(@NonNull java.util.UUID, @NonNull java.util.UUID, @Nullable byte[]); + method public int describeContents(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.hardware.soundtrigger.SoundTrigger.GenericSoundModel> CREATOR; + } + public static final class SoundTrigger.Keyphrase implements android.os.Parcelable { ctor public SoundTrigger.Keyphrase(int, int, @NonNull java.util.Locale, @NonNull String, @Nullable int[]); method public int describeContents(); diff --git a/core/java/android/hardware/soundtrigger/SoundTrigger.java b/core/java/android/hardware/soundtrigger/SoundTrigger.java index bf7f3f4ed5c1..e33a5c9e979a 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.ElapsedRealtimeLong; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.NonNull; @@ -874,10 +875,9 @@ public class SoundTrigger { /***************************************************************************** * A GenericSoundModel is a specialized {@link SoundModel} for non-voice sound * patterns. - * - * @hide ****************************************************************************/ - public static class GenericSoundModel extends SoundModel implements Parcelable { + @FlaggedApi(android.media.soundtrigger.Flags.FLAG_SOUND_TRIGGER_GENERIC_MODEL_API) + public static final class GenericSoundModel extends SoundModel implements Parcelable { public static final @android.annotation.NonNull Parcelable.Creator<GenericSoundModel> CREATOR = new Parcelable.Creator<GenericSoundModel>() { @@ -890,13 +890,27 @@ public class SoundTrigger { } }; + /** + * Constructor for {@link GenericSoundModel} with version. + * + * @param uuid Unique identifier for this sound model. + * @param vendorUuid Unique vendor identifier for this sound model. + * @param data Opaque data for this sound model. + * @param version Vendor-specific version number of this sound model. + */ public GenericSoundModel(@NonNull UUID uuid, @NonNull UUID vendorUuid, @Nullable byte[] data, int version) { super(uuid, Objects.requireNonNull(vendorUuid, "vendorUuid cannot be null"), TYPE_GENERIC_SOUND, data, version); } - @UnsupportedAppUsage + /** + * Constructor for {@link GenericSoundModel} without version. The version is set to -1. + * + * @param uuid Unique identifier for this sound model. + * @param vendorUuid Unique vendor identifier for this sound model. + * @param data Opaque data for this sound model. + */ public GenericSoundModel(@NonNull UUID uuid, @NonNull UUID vendorUuid, @Nullable byte[] data) { this(uuid, vendorUuid, data, -1); @@ -920,7 +934,7 @@ public class SoundTrigger { } @Override - public void writeToParcel(Parcel dest, int flags) { + public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeString(getUuid().toString()); if (getVendorUuid() == null) { dest.writeInt(-1); |