summaryrefslogtreecommitdiffstats
path: root/core/java/android/service/voice
diff options
context:
space:
mode:
authorSandeep Siddhartha <sansid@google.com>2014-09-15 12:51:08 -0700
committerSandeep Siddhartha <sansid@google.com>2014-09-15 19:59:09 -0700
commit8cf8f71644643601fe8c3e9538fd00412b1ae8b1 (patch)
treef515c4f47399becbe7a7edd708b737499a6dc8ec /core/java/android/service/voice
parenta2f945e227d8059e3ff9c41676146b057cd7ddbe (diff)
downloadframeworks_base-8cf8f71644643601fe8c3e9538fd00412b1ae8b1.zip
frameworks_base-8cf8f71644643601fe8c3e9538fd00412b1ae8b1.tar.gz
frameworks_base-8cf8f71644643601fe8c3e9538fd00412b1ae8b1.tar.bz2
Fix issues with multiple languages and multi-users
For multi-user the issue was looking into the user ID of the current process instead of the active user. The current process was the system process and the call to UserManager was returning a user handle that wasn't of any use while trying to map sound models to a user. For language, the issue was that we were incorrectly just looking up the model based on the keyphrase id, however we should have also taken the enrolled model's locale into account. Explicitly document that for model management the string representation of locales is a BCP47 language tag. Remove debug logging. Bug: 16798166 Bug: 17462570 Bug: 17463511 Change-Id: Ieffb3e218de63f6e7f40af9705dced481a35b0ad
Diffstat (limited to 'core/java/android/service/voice')
-rw-r--r--core/java/android/service/voice/AlwaysOnHotwordDetector.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/core/java/android/service/voice/AlwaysOnHotwordDetector.java b/core/java/android/service/voice/AlwaysOnHotwordDetector.java
index 8aa2689..ac7d539 100644
--- a/core/java/android/service/voice/AlwaysOnHotwordDetector.java
+++ b/core/java/android/service/voice/AlwaysOnHotwordDetector.java
@@ -170,8 +170,7 @@ public class AlwaysOnHotwordDetector {
= SoundTrigger.RECOGNITION_MODE_USER_IDENTIFICATION;
static final String TAG = "AlwaysOnHotwordDetector";
- // TODO: Set to false.
- static final boolean DBG = true;
+ static final boolean DBG = false;
private static final int STATUS_ERROR = SoundTrigger.STATUS_ERROR;
private static final int STATUS_OK = SoundTrigger.STATUS_OK;
@@ -575,7 +574,7 @@ public class AlwaysOnHotwordDetector {
int code = STATUS_ERROR;
try {
code = mModelManagementService.startRecognition(mVoiceInteractionService,
- mKeyphraseMetadata.id, mInternalCallback,
+ mKeyphraseMetadata.id, mLocale.toLanguageTag(), mInternalCallback,
new RecognitionConfig(captureTriggerAudio, allowMultipleTriggers,
recognitionExtra, null /* additional data */));
} catch (RemoteException e) {
@@ -690,7 +689,7 @@ public class AlwaysOnHotwordDetector {
if (availability == STATE_NOT_READY
|| availability == STATE_KEYPHRASE_UNENROLLED
|| availability == STATE_KEYPHRASE_ENROLLED) {
- enrolled = internalGetIsEnrolled(mKeyphraseMetadata.id);
+ enrolled = internalGetIsEnrolled(mKeyphraseMetadata.id, mLocale);
if (!enrolled) {
availability = STATE_KEYPHRASE_UNENROLLED;
} else {
@@ -741,10 +740,10 @@ public class AlwaysOnHotwordDetector {
/**
* @return The corresponding {@link KeyphraseSoundModel} or null if none is found.
*/
- private boolean internalGetIsEnrolled(int keyphraseId) {
+ private boolean internalGetIsEnrolled(int keyphraseId, Locale locale) {
try {
return mModelManagementService.isEnrolledForKeyphrase(
- mVoiceInteractionService, keyphraseId);
+ mVoiceInteractionService, keyphraseId, locale.toLanguageTag());
} catch (RemoteException e) {
Slog.w(TAG, "RemoteException in listRegisteredKeyphraseSoundModels!", e);
}