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

Commit a433af6b authored by Sandeep Siddhartha's avatar Sandeep Siddhartha
Browse files

Add code for isKeyphraseActive and some logging to help debug issues

Change-Id: I89f2090be5a5fe5f7c0da1648a0d46a093893fe2
parent 1375e73e
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
        int status = SoundTrigger.listModules(modules);
        mActiveListeners = new SparseArray<>(1);
        if (status != SoundTrigger.STATUS_OK || modules.size() == 0) {
            // TODO: Figure out how to handle errors in listing the modules here.
            Slog.w(TAG, "listModules status=" + status + ", # of modules=" + modules.size());
            dspInfo = null;
            mModuleProperties = null;
            mModule = null;
@@ -98,9 +98,12 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
     * @return True, if a recognition for the given {@link Keyphrase} is active.
     */
    public synchronized boolean isKeyphraseActive(Keyphrase keyphrase) {
        // TODO: Check if the recognition for the keyphrase is currently active.
        if (keyphrase == null) {
            Slog.w(TAG, "isKeyphraseActive requires a non-null keyphrase");
            return false;
        }
        return mActiveListeners.get(keyphrase.id) != null;
    }

    /**
     * Starts recognition for the given {@link Keyphrase}.