Merge "Use .equals() to compare two UUIDs in SoundTriggerHelper, rather than ==" into nyc-dev
am: 7d5c695
* commit '7d5c6955208e82157e6e5ba42ba1d5f1507c6eb6':
Use .equals() to compare two UUIDs in SoundTriggerHelper, rather than ==
Change-Id: I7d21e0959c8ea8c1928c9065c1ff28d8e9a4c93c
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user