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

Commit c7777df5 authored by Chris Thornton's avatar Chris Thornton Committed by android-build-merger
Browse files

Merge \\"SoundTriggerDetector should look at the return code to honour...

Merge \\"SoundTriggerDetector should look at the return code to honour success\\" into nyc-mr1-dev am: 9b550cb1
am: 0359337b

Change-Id: Idabd2180b88dbb8cef6039825cdebaf3026eaf8d
parents 2c67d6f6 0359337b
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -15,6 +15,7 @@
 */
 */


package android.media.soundtrigger;
package android.media.soundtrigger;
import static android.hardware.soundtrigger.SoundTrigger.STATUS_OK;


import android.annotation.IntDef;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.NonNull;
@@ -243,27 +244,29 @@ public final class SoundTriggerDetector {


        boolean allowMultipleTriggers =
        boolean allowMultipleTriggers =
                (recognitionFlags & RECOGNITION_FLAG_ALLOW_MULTIPLE_TRIGGERS) != 0;
                (recognitionFlags & RECOGNITION_FLAG_ALLOW_MULTIPLE_TRIGGERS) != 0;
        int status = STATUS_OK;
        try {
        try {
            mSoundTriggerService.startRecognition(new ParcelUuid(mSoundModelId),
            status = mSoundTriggerService.startRecognition(new ParcelUuid(mSoundModelId),
                    mRecognitionCallback, new RecognitionConfig(captureTriggerAudio,
                    mRecognitionCallback, new RecognitionConfig(captureTriggerAudio,
                        allowMultipleTriggers, null, null));
                        allowMultipleTriggers, null, null));
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            return false;
            return false;
        }
        }
        return true;
        return status == STATUS_OK;
    }
    }


    /**
    /**
     * Stops recognition for the associated model.
     * Stops recognition for the associated model.
     */
     */
    public boolean stopRecognition() {
    public boolean stopRecognition() {
        int status = STATUS_OK;
        try {
        try {
            mSoundTriggerService.stopRecognition(new ParcelUuid(mSoundModelId),
            status = mSoundTriggerService.stopRecognition(new ParcelUuid(mSoundModelId),
                    mRecognitionCallback);
                    mRecognitionCallback);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            return false;
            return false;
        }
        }
        return true;
        return status == STATUS_OK;
    }
    }


    /**
    /**