Merge "The VIS should return an AOHD regardless of keyphrase availability." into oc-mr1-dev

This commit is contained in:
TreeHugger Robot
2017-08-24 16:08:21 +00:00
committed by Android (Google) Code Review

View File

@@ -262,8 +262,7 @@ public class VoiceInteractionService extends Service {
* @param keyphrase The keyphrase that's being used, for example "Hello Android". * @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 locale The locale for which the enrollment needs to be performed.
* @param callback The callback to notify of detection events. * @param callback The callback to notify of detection events.
* @return An always-on hotword detector for the given keyphrase and locale. Is null if the * @return An always-on hotword detector for the given keyphrase and locale.
* keyphrase and locale is not supported.
*/ */
public final AlwaysOnHotwordDetector createAlwaysOnHotwordDetector( public final AlwaysOnHotwordDetector createAlwaysOnHotwordDetector(
String keyphrase, Locale locale, AlwaysOnHotwordDetector.Callback callback) { String keyphrase, Locale locale, AlwaysOnHotwordDetector.Callback callback) {
@@ -273,11 +272,9 @@ public class VoiceInteractionService extends Service {
synchronized (mLock) { synchronized (mLock) {
// Allow only one concurrent recognition via the APIs. // Allow only one concurrent recognition via the APIs.
safelyShutdownHotwordDetector(); safelyShutdownHotwordDetector();
if (isKeyphraseAndLocaleSupportedForHotword(keyphrase, locale)) {
mHotwordDetector = new AlwaysOnHotwordDetector(keyphrase, locale, callback, mHotwordDetector = new AlwaysOnHotwordDetector(keyphrase, locale, callback,
mKeyphraseEnrollmentInfo, mInterface, mSystemService); mKeyphraseEnrollmentInfo, mInterface, mSystemService);
} }
}
return mHotwordDetector; return mHotwordDetector;
} }