Loading core/java/android/hardware/soundtrigger/KeyphraseEnrollmentInfo.java +2 −1 Original line number Diff line number Diff line Loading @@ -341,7 +341,8 @@ public class KeyphraseEnrollmentInfo { } } } Slog.w(TAG, "No Enrollment application supports the given keyphrase/locale"); Slog.w(TAG, "No enrollment application supports the given keyphrase/locale: '" + keyphrase + "'/" + locale); return null; } Loading core/java/android/service/voice/VoiceInteractionService.java +20 −3 Original line number Diff line number Diff line Loading @@ -262,7 +262,8 @@ public class VoiceInteractionService extends Service { * @param keyphrase The keyphrase that's being used, for example "Hello Android". * @param locale The locale for which the enrollment needs to be performed. * @param callback The callback to notify of detection events. * @return An always-on hotword detector for the given keyphrase and locale. * @return An always-on hotword detector for the given keyphrase and locale. Is null if the * keyphrase and locale is not supported. */ public final AlwaysOnHotwordDetector createAlwaysOnHotwordDetector( String keyphrase, Locale locale, AlwaysOnHotwordDetector.Callback callback) { Loading @@ -272,9 +273,11 @@ public class VoiceInteractionService extends Service { synchronized (mLock) { // Allow only one concurrent recognition via the APIs. safelyShutdownHotwordDetector(); if (isKeyphraseAndLocaleSupportedForHotword(keyphrase, locale)) { mHotwordDetector = new AlwaysOnHotwordDetector(keyphrase, locale, callback, mKeyphraseEnrollmentInfo, mInterface, mSystemService); } } return mHotwordDetector; } Loading @@ -287,6 +290,20 @@ public class VoiceInteractionService extends Service { return mKeyphraseEnrollmentInfo; } /** * Checks if a given keyphrase and locale are supported to create an * {@link AlwaysOnHotwordDetector}. * * @return true if the keyphrase and locale combination is supported, false otherwise. * @hide */ public final boolean isKeyphraseAndLocaleSupportedForHotword(String keyphrase, Locale locale) { if (mKeyphraseEnrollmentInfo == null) { return false; } return mKeyphraseEnrollmentInfo.getKeyphraseMetadata(keyphrase, locale) != null; } private void safelyShutdownHotwordDetector() { try { synchronized (mLock) { Loading Loading
core/java/android/hardware/soundtrigger/KeyphraseEnrollmentInfo.java +2 −1 Original line number Diff line number Diff line Loading @@ -341,7 +341,8 @@ public class KeyphraseEnrollmentInfo { } } } Slog.w(TAG, "No Enrollment application supports the given keyphrase/locale"); Slog.w(TAG, "No enrollment application supports the given keyphrase/locale: '" + keyphrase + "'/" + locale); return null; } Loading
core/java/android/service/voice/VoiceInteractionService.java +20 −3 Original line number Diff line number Diff line Loading @@ -262,7 +262,8 @@ public class VoiceInteractionService extends Service { * @param keyphrase The keyphrase that's being used, for example "Hello Android". * @param locale The locale for which the enrollment needs to be performed. * @param callback The callback to notify of detection events. * @return An always-on hotword detector for the given keyphrase and locale. * @return An always-on hotword detector for the given keyphrase and locale. Is null if the * keyphrase and locale is not supported. */ public final AlwaysOnHotwordDetector createAlwaysOnHotwordDetector( String keyphrase, Locale locale, AlwaysOnHotwordDetector.Callback callback) { Loading @@ -272,9 +273,11 @@ public class VoiceInteractionService extends Service { synchronized (mLock) { // Allow only one concurrent recognition via the APIs. safelyShutdownHotwordDetector(); if (isKeyphraseAndLocaleSupportedForHotword(keyphrase, locale)) { mHotwordDetector = new AlwaysOnHotwordDetector(keyphrase, locale, callback, mKeyphraseEnrollmentInfo, mInterface, mSystemService); } } return mHotwordDetector; } Loading @@ -287,6 +290,20 @@ public class VoiceInteractionService extends Service { return mKeyphraseEnrollmentInfo; } /** * Checks if a given keyphrase and locale are supported to create an * {@link AlwaysOnHotwordDetector}. * * @return true if the keyphrase and locale combination is supported, false otherwise. * @hide */ public final boolean isKeyphraseAndLocaleSupportedForHotword(String keyphrase, Locale locale) { if (mKeyphraseEnrollmentInfo == null) { return false; } return mKeyphraseEnrollmentInfo.getKeyphraseMetadata(keyphrase, locale) != null; } private void safelyShutdownHotwordDetector() { try { synchronized (mLock) { Loading