Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19b210c9 authored by Dharmesh Mokani's avatar Dharmesh Mokani Committed by Android (Google) Code Review
Browse files

Merge "Address API review comment:AlwaysOnHotwordDetector" into lmp-dev

parents 235c1596 ae686a51
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -27177,9 +27177,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();
+40 −1
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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: