am 6feba6b6: am 0b230ea6: am efd4ea01: Merge "Address API review comment:AlwaysOnHotwordDetector" into lmp-dev

* commit '6feba6b61ecddcb93a2b33a2ea52daad6cf70bd5':
  Address API review comment:AlwaysOnHotwordDetector
This commit is contained in:
Dharmesh Mokani
2014-09-05 17:18:26 +00:00
committed by Android Git Automerger
3 changed files with 44 additions and 5 deletions

View File

@@ -27422,9 +27422,9 @@ package android.service.textservice {
package android.service.voice {
public class AlwaysOnHotwordDetector {
method public android.content.Intent createIntentToEnroll();
method public android.content.Intent createIntentToReEnroll();
method public android.content.Intent createIntentToUnEnroll();
method public android.content.Intent createEnrollIntent();
method public android.content.Intent createReEnrollIntent();
method public android.content.Intent createUnEnrollIntent();
method public int getSupportedRecognitionModes();
method public boolean startRecognition(int);
method public boolean stopRecognition();

View File

@@ -450,7 +450,7 @@ public class AlwaysOnHotwordDetector {
* This intent must be invoked using {@link Activity#startActivityForResult(Intent, int)}.
* Starting re-enrollment is only valid if the keyphrase is un-enrolled,
* i.e. {@link #STATE_KEYPHRASE_UNENROLLED},
* otherwise {@link #createIntentToReEnroll()} should be preferred.
* otherwise {@link #createReEnrollIntent()} should be preferred.
*
* @return An {@link Intent} to start enrollment for the given keyphrase.
* @throws UnsupportedOperationException if managing they keyphrase isn't supported.
@@ -460,6 +460,19 @@ public class AlwaysOnHotwordDetector {
* This may happen if another detector has been instantiated or the
* {@link VoiceInteractionService} hosting this detector has been shut down.
*/
public Intent createEnrollIntent() {
if (DBG) Slog.d(TAG, "createEnrollIntent");
synchronized (mLock) {
return getManageIntentLocked(MANAGE_ACTION_ENROLL);
}
}
/**
* FIXME: Remove once the prebuilts are updated.
*
* @hide
*/
@Deprecated
public Intent createIntentToEnroll() {
if (DBG) Slog.d(TAG, "createIntentToEnroll");
synchronized (mLock) {
@@ -481,6 +494,19 @@ public class AlwaysOnHotwordDetector {
* This may happen if another detector has been instantiated or the
* {@link VoiceInteractionService} hosting this detector has been shut down.
*/
public Intent createUnEnrollIntent() {
if (DBG) Slog.d(TAG, "createUnEnrollIntent");
synchronized (mLock) {
return getManageIntentLocked(MANAGE_ACTION_UN_ENROLL);
}
}
/**
* FIXME: Remove once the prebuilts are updated.
*
* @hide
*/
@Deprecated
public Intent createIntentToUnEnroll() {
if (DBG) Slog.d(TAG, "createIntentToUnEnroll");
synchronized (mLock) {
@@ -502,6 +528,19 @@ public class AlwaysOnHotwordDetector {
* This may happen if another detector has been instantiated or the
* {@link VoiceInteractionService} hosting this detector has been shut down.
*/
public Intent createReEnrollIntent() {
if (DBG) Slog.d(TAG, "createReEnrollIntent");
synchronized (mLock) {
return getManageIntentLocked(MANAGE_ACTION_RE_ENROLL);
}
}
/**
* FIXME: Remove once the prebuilts are updated.
*
* @hide
*/
@Deprecated
public Intent createIntentToReEnroll() {
if (DBG) Slog.d(TAG, "createIntentToReEnroll");
synchronized (mLock) {

View File

@@ -92,7 +92,7 @@ public class MainInteractionService extends VoiceInteractionService {
break;
case AlwaysOnHotwordDetector.STATE_KEYPHRASE_UNENROLLED:
Log.i(TAG, "STATE_KEYPHRASE_UNENROLLED");
Intent enroll = mHotwordDetector.createIntentToEnroll();
Intent enroll = mHotwordDetector.createEnrollIntent();
Log.i(TAG, "Need to enroll with " + enroll);
break;
case AlwaysOnHotwordDetector.STATE_KEYPHRASE_ENROLLED: