summaryrefslogtreecommitdiffstats
path: root/services/voiceinteraction
diff options
context:
space:
mode:
authorSandeep Siddhartha <sansid@google.com>2014-08-01 11:32:03 -0700
committerSandeep Siddhartha <sansid@google.com>2014-08-01 17:46:27 -0700
commit2c0273e50a3162595e9a54030166f2369b039a5a (patch)
tree6075295a33de952b996038ffdf10f22594a1cf4b /services/voiceinteraction
parentfc0fc0e341f2a2d707d5a8eafd65db34bdffb35c (diff)
downloadframeworks_base-2c0273e50a3162595e9a54030166f2369b039a5a.zip
frameworks_base-2c0273e50a3162595e9a54030166f2369b039a5a.tar.gz
frameworks_base-2c0273e50a3162595e9a54030166f2369b039a5a.tar.bz2
Add a flag for multiple triggers with same recognition session
Also annotate the flags with @IntDef to make things clearer and safer Add more debug logging Revert to start/stop being synchronous since telephony and microphone will need to be handled internally. Bug: 16731586 Bug: 16514535 Bug: 16549061 Change-Id: I83695d52e9547269c95d443e4d921c9238b7401e
Diffstat (limited to 'services/voiceinteraction')
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java
index 0eac1c4..938efaa 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java
@@ -65,6 +65,8 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
private int mCurrentSoundModelHandle = INVALID_SOUND_MODEL_HANDLE;
private UUID mCurrentSoundModelUuid = null;
+ // FIXME: Ideally this should not be stored if allowMultipleTriggers happens at a lower layer.
+ private RecognitionConfig mRecognitionConfig = null;
SoundTriggerHelper() {
ArrayList <ModuleProperties> modules = new ArrayList<>();
@@ -174,6 +176,7 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
// Everything went well!
mCurrentSoundModelHandle = soundModelHandle;
mCurrentSoundModelUuid = soundModel.uuid;
+ mRecognitionConfig = recognitionConfig;
// Register the new listener. This replaces the old one.
// There can only be a maximum of one active listener for a keyphrase
// at any given time.
@@ -221,12 +224,12 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
int status = mModule.stopRecognition(mCurrentSoundModelHandle);
if (status != SoundTrigger.STATUS_OK) {
Slog.w(TAG, "stopRecognition call failed with " + status);
- return STATUS_ERROR;
+ return status;
}
status = mModule.unloadSoundModel(mCurrentSoundModelHandle);
if (status != SoundTrigger.STATUS_OK) {
Slog.w(TAG, "unloadSoundModel call failed with " + status);
- return STATUS_ERROR;
+ return status;
}
mCurrentSoundModelHandle = INVALID_SOUND_MODEL_HANDLE;
@@ -284,6 +287,17 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
Slog.w(TAG, "received onRecognition event without any listener for it");
return;
}
+
+ // FIXME: Remove this block if the lower layer supports multiple triggers.
+ if (mRecognitionConfig != null
+ && mRecognitionConfig.allowMultipleTriggers) {
+ int status = mModule.startRecognition(
+ mCurrentSoundModelHandle, mRecognitionConfig);
+ if (status != STATUS_OK) {
+ Slog.w(TAG, "Error in restarting recognition after a trigger");
+ listener.onError(status);
+ }
+ }
}
} catch (RemoteException e) {
Slog.w(TAG, "RemoteException in onDetectionStopped");