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

Commit fa384e31 authored by Atneya Nair's avatar Atneya Nair Committed by Android (Google) Code Review
Browse files

Merge "Deprecate get/update/deleteModel and STDetector"

parents 01ce4136 7ad0475d
Loading
Loading
Loading
Loading
+26 −26
Original line number Diff line number Diff line
@@ -7255,40 +7255,40 @@ package android.media.soundtrigger {
    method public final void operationFinished(@Nullable java.util.UUID, int);
  }
  public final class SoundTriggerDetector {
    method @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public boolean startRecognition(int);
    method @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public boolean stopRecognition();
    field public static final int RECOGNITION_FLAG_ALLOW_MULTIPLE_TRIGGERS = 2; // 0x2
    field public static final int RECOGNITION_FLAG_CAPTURE_TRIGGER_AUDIO = 1; // 0x1
    field public static final int RECOGNITION_FLAG_ENABLE_AUDIO_ECHO_CANCELLATION = 4; // 0x4
    field public static final int RECOGNITION_FLAG_ENABLE_AUDIO_NOISE_SUPPRESSION = 8; // 0x8
    field public static final int RECOGNITION_FLAG_RUN_IN_BATTERY_SAVER = 16; // 0x10
  }
  public abstract static class SoundTriggerDetector.Callback {
    ctor public SoundTriggerDetector.Callback();
    method public abstract void onAvailabilityChanged(int);
    method public abstract void onDetected(@NonNull android.media.soundtrigger.SoundTriggerDetector.EventPayload);
    method public abstract void onError();
    method public abstract void onRecognitionPaused();
    method public abstract void onRecognitionResumed();
  }
  public static class SoundTriggerDetector.EventPayload {
    method @Nullable public android.media.AudioFormat getCaptureAudioFormat();
    method @Nullable public byte[] getTriggerAudio();
  @Deprecated public final class SoundTriggerDetector {
    method @Deprecated @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public boolean startRecognition(int);
    method @Deprecated @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public boolean stopRecognition();
    field @Deprecated public static final int RECOGNITION_FLAG_ALLOW_MULTIPLE_TRIGGERS = 2; // 0x2
    field @Deprecated public static final int RECOGNITION_FLAG_CAPTURE_TRIGGER_AUDIO = 1; // 0x1
    field @Deprecated public static final int RECOGNITION_FLAG_ENABLE_AUDIO_ECHO_CANCELLATION = 4; // 0x4
    field @Deprecated public static final int RECOGNITION_FLAG_ENABLE_AUDIO_NOISE_SUPPRESSION = 8; // 0x8
    field @Deprecated public static final int RECOGNITION_FLAG_RUN_IN_BATTERY_SAVER = 16; // 0x10
  }
  @Deprecated public abstract static class SoundTriggerDetector.Callback {
    ctor @Deprecated public SoundTriggerDetector.Callback();
    method @Deprecated public abstract void onAvailabilityChanged(int);
    method @Deprecated public abstract void onDetected(@NonNull android.media.soundtrigger.SoundTriggerDetector.EventPayload);
    method @Deprecated public abstract void onError();
    method @Deprecated public abstract void onRecognitionPaused();
    method @Deprecated public abstract void onRecognitionResumed();
  }
  @Deprecated public static class SoundTriggerDetector.EventPayload {
    method @Deprecated @Nullable public android.media.AudioFormat getCaptureAudioFormat();
    method @Deprecated @Nullable public byte[] getTriggerAudio();
  }
  public final class SoundTriggerManager {
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public android.media.soundtrigger.SoundTriggerDetector createSoundTriggerDetector(java.util.UUID, @NonNull android.media.soundtrigger.SoundTriggerDetector.Callback, @Nullable android.os.Handler);
    method @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public void deleteModel(java.util.UUID);
    method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public android.media.soundtrigger.SoundTriggerDetector createSoundTriggerDetector(java.util.UUID, @NonNull android.media.soundtrigger.SoundTriggerDetector.Callback, @Nullable android.os.Handler);
    method @Deprecated @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public void deleteModel(java.util.UUID);
    method public int getDetectionServiceOperationsTimeout();
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public android.media.soundtrigger.SoundTriggerManager.Model getModel(java.util.UUID);
    method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public android.media.soundtrigger.SoundTriggerManager.Model getModel(java.util.UUID);
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public android.hardware.soundtrigger.SoundTrigger.ModuleProperties getModuleProperties();
    method @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public int getParameter(@NonNull java.util.UUID, int);
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public android.hardware.soundtrigger.SoundTrigger.ModelParamRange queryParameter(@Nullable java.util.UUID, int);
    method @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public int setParameter(@Nullable java.util.UUID, int, int);
    method @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public void updateModel(android.media.soundtrigger.SoundTriggerManager.Model);
    method @Deprecated @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public void updateModel(android.media.soundtrigger.SoundTriggerManager.Model);
  }
  public static class SoundTriggerManager.Model {
+6 −1
Original line number Diff line number Diff line
@@ -49,9 +49,10 @@ import java.util.UUID;
 * not voice-based. The voice-based recognition models should utilize the {@link
 * VoiceInteractionService} instead. Access to this class is protected by a permission
 * granted only to system or privileged apps.
 *
 * @deprecated use {@link SoundTriggerManager} directly
 * @hide
 */
@Deprecated
@SystemApi
public final class SoundTriggerDetector {
    private static final boolean DBG = false;
@@ -292,8 +293,10 @@ public final class SoundTriggerDetector {
    /**
     * Starts recognition on the associated sound model. Result is indicated via the
     * {@link Callback}.
     * @deprecated use {@link SoundTriggerManager} directly
     * @return Indicates whether the call succeeded or not.
     */
    @Deprecated
    @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER)
    public boolean startRecognition(@RecognitionFlags int recognitionFlags) {
        if (DBG) {
@@ -329,7 +332,9 @@ public final class SoundTriggerDetector {

    /**
     * Stops recognition for the associated model.
     * @deprecated use {@link SoundTriggerManager} directly
     */
    @Deprecated
    @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER)
    public boolean stopRecognition() {
        int status = STATUS_OK;
+12 −0
Original line number Diff line number Diff line
@@ -104,8 +104,11 @@ public final class SoundTriggerManager {

    /**
     * Updates the given sound trigger model.
     * @deprecated replace with {@link #loadSoundModel}
     * SoundTriggerService model database will be removed
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER)
    @Deprecated
    public void updateModel(Model model) {
        try {
            mSoundTriggerSession.updateSoundModel(model.getGenericSoundModel());
@@ -119,9 +122,11 @@ public final class SoundTriggerManager {
     *
     * @param soundModelId UUID associated with a loaded model
     * @return {@link SoundTriggerManager.Model} associated with UUID soundModelId
     * @deprecated SoundTriggerService model database will be removed
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER)
    @Nullable
    @Deprecated
    public Model getModel(UUID soundModelId) {
        try {
            GenericSoundModel model =
@@ -138,8 +143,11 @@ public final class SoundTriggerManager {

    /**
     * Deletes the sound model represented by the provided UUID.
     * @deprecated replace with {@link #unloadSoundModel}
     * SoundTriggerService model database will be removed
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER)
    @Deprecated
    public void deleteModel(UUID soundModelId) {
        try {
            mSoundTriggerSession.deleteSoundModel(new ParcelUuid(soundModelId));
@@ -159,8 +167,12 @@ public final class SoundTriggerManager {
     * @param handler The Handler to use for the callback operations. A null value will use the
     * current thread's Looper.
     * @return Instance of {@link SoundTriggerDetector} or null on error.
     * @deprecated Use {@link SoundTriggerManager} directly. SoundTriggerDetector does not
     * ensure callbacks are delivered, and its model state is prone to mismatch.
     * It will be removed in a subsequent release.
     */
    @Nullable
    @Deprecated
    @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER)
    public SoundTriggerDetector createSoundTriggerDetector(UUID soundModelId,
            @NonNull SoundTriggerDetector.Callback callback, @Nullable Handler handler) {