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

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

Merge "Use .equals() to compare two UUIDs in SoundTriggerHelper, rather than ==" into nyc-dev

am: 7d5c6955

* commit '7d5c6955':
  Use .equals() to compare two UUIDs in SoundTriggerHelper, rather than ==

Change-Id: I7d21e0959c8ea8c1928c9065c1ff28d8e9a4c93c
parents 884e8e07 7d5c6955
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -188,13 +188,13 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
            }

            // Process existing model first.
            if (model != null && model.getModelId() != soundModel.uuid) {
            if (model != null && !model.getModelId().equals(soundModel.uuid)) {
                // The existing model has a different UUID, should be replaced.
                int status = cleanUpExistingKeyphraseModel(model);
                removeKeyphraseModelLocked(keyphraseId);
                if (status != STATUS_OK) {
                    return status;
                }
                removeKeyphraseModelLocked(keyphraseId);
                model = null;
            }

@@ -478,8 +478,6 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
            } else {
                // Clear the ModelData state if successful.
                modelData.clearState();
                modelData.clearCallback();
                modelData.setRecognitionConfig(null);
            }
        }
        return status;
@@ -498,15 +496,12 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
            // Stop all recognition models.
            for (ModelData model : mModelDataMap.values()) {
                if (model.isModelStarted()) {
                    model.setRequested(false);
                    int status = stopRecognitionLocked(model,
                            false /* do not notify for synchronous calls */);
                    if (status != STATUS_OK) {
                        Slog.w(TAG, "Error stopping keyphrase model: " + model.getHandle());
                    }
                    model.clearState();
                    model.clearCallback();
                    model.setRecognitionConfig(null);
                }
            }
            internalClearGlobalStateLocked();
@@ -849,7 +844,6 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
    private void internalClearModelStateLocked() {
        for (ModelData modelData : mModelDataMap.values()) {
            modelData.clearState();
            modelData.clearCallback();
        }
    }

@@ -1194,6 +1188,9 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
        synchronized void clearState() {
            mModelState = MODEL_NOTLOADED;
            mModelHandle = INVALID_VALUE;
            mRecognitionConfig = null;
            mRequested = false;
            mCallback = null;
        }

        synchronized void clearCallback() {