Merge "Use .equals() to compare two UUIDs in SoundTriggerHelper, rather than ==" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7d5c695520
@@ -188,13 +188,13 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Process existing model first.
|
// 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.
|
// The existing model has a different UUID, should be replaced.
|
||||||
int status = cleanUpExistingKeyphraseModel(model);
|
int status = cleanUpExistingKeyphraseModel(model);
|
||||||
removeKeyphraseModelLocked(keyphraseId);
|
|
||||||
if (status != STATUS_OK) {
|
if (status != STATUS_OK) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
removeKeyphraseModelLocked(keyphraseId);
|
||||||
model = null;
|
model = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,8 +478,6 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
|
|||||||
} else {
|
} else {
|
||||||
// Clear the ModelData state if successful.
|
// Clear the ModelData state if successful.
|
||||||
modelData.clearState();
|
modelData.clearState();
|
||||||
modelData.clearCallback();
|
|
||||||
modelData.setRecognitionConfig(null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
@@ -498,15 +496,12 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
|
|||||||
// Stop all recognition models.
|
// Stop all recognition models.
|
||||||
for (ModelData model : mModelDataMap.values()) {
|
for (ModelData model : mModelDataMap.values()) {
|
||||||
if (model.isModelStarted()) {
|
if (model.isModelStarted()) {
|
||||||
model.setRequested(false);
|
|
||||||
int status = stopRecognitionLocked(model,
|
int status = stopRecognitionLocked(model,
|
||||||
false /* do not notify for synchronous calls */);
|
false /* do not notify for synchronous calls */);
|
||||||
if (status != STATUS_OK) {
|
if (status != STATUS_OK) {
|
||||||
Slog.w(TAG, "Error stopping keyphrase model: " + model.getHandle());
|
Slog.w(TAG, "Error stopping keyphrase model: " + model.getHandle());
|
||||||
}
|
}
|
||||||
model.clearState();
|
model.clearState();
|
||||||
model.clearCallback();
|
|
||||||
model.setRecognitionConfig(null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internalClearGlobalStateLocked();
|
internalClearGlobalStateLocked();
|
||||||
@@ -849,7 +844,6 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
|
|||||||
private void internalClearModelStateLocked() {
|
private void internalClearModelStateLocked() {
|
||||||
for (ModelData modelData : mModelDataMap.values()) {
|
for (ModelData modelData : mModelDataMap.values()) {
|
||||||
modelData.clearState();
|
modelData.clearState();
|
||||||
modelData.clearCallback();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1194,6 +1188,9 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
|
|||||||
synchronized void clearState() {
|
synchronized void clearState() {
|
||||||
mModelState = MODEL_NOTLOADED;
|
mModelState = MODEL_NOTLOADED;
|
||||||
mModelHandle = INVALID_VALUE;
|
mModelHandle = INVALID_VALUE;
|
||||||
|
mRecognitionConfig = null;
|
||||||
|
mRequested = false;
|
||||||
|
mCallback = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized void clearCallback() {
|
synchronized void clearCallback() {
|
||||||
|
|||||||
Reference in New Issue
Block a user