191097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn/*
291097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn * Copyright (C) 2014 The Android Open Source Project
391097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn *
491097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn * Licensed under the Apache License, Version 2.0 (the "License");
591097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn * you may not use this file except in compliance with the License.
691097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn * You may obtain a copy of the License at
791097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn *
891097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn *      http://www.apache.org/licenses/LICENSE-2.0
991097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn *
1091097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn * Unless required by applicable law or agreed to in writing, software
1191097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn * distributed under the License is distributed on an "AS IS" BASIS,
1291097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1391097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn * See the License for the specific language governing permissions and
1491097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn * limitations under the License.
1591097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn */
1691097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn
1791097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackbornpackage com.android.internal.app;
1891097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn
1991097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackbornimport android.content.Intent;
2018f0d357f9693fe787a3e3777d8fdf01357a6e3fDianne Hackbornimport android.os.Bundle;
2191097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn
2291097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackbornimport com.android.internal.app.IVoiceInteractor;
23055897208d659e9734a82def88be4a806ff55448Sandeep Siddharthaimport android.hardware.soundtrigger.IRecognitionStatusCallback;
24055897208d659e9734a82def88be4a806ff55448Sandeep Siddharthaimport android.hardware.soundtrigger.SoundTrigger;
2591097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackbornimport android.service.voice.IVoiceInteractionService;
2691097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackbornimport android.service.voice.IVoiceInteractionSession;
2791097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn
2891097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborninterface IVoiceInteractionManagerService {
29c03c9167c2d9a1e22fb2b176b00a0524177fb037Dianne Hackborn    void startSession(IVoiceInteractionService service, in Bundle sessionArgs);
30c03c9167c2d9a1e22fb2b176b00a0524177fb037Dianne Hackborn    boolean deliverNewSession(IBinder token, IVoiceInteractionSession session,
3118f0d357f9693fe787a3e3777d8fdf01357a6e3fDianne Hackborn            IVoiceInteractor interactor);
32c03c9167c2d9a1e22fb2b176b00a0524177fb037Dianne Hackborn    int startVoiceActivity(IBinder token, in Intent intent, String resolvedType);
33c03c9167c2d9a1e22fb2b176b00a0524177fb037Dianne Hackborn    void finish(IBinder token);
34d7018200312e4e4dc3f67cf33dc90bf7ce585844Sandeep
35d7018200312e4e4dc3f67cf33dc90bf7ce585844Sandeep    /**
368cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     * Gets the registered Sound model for keyphrase detection for the current user.
378cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     * May be null if no matching sound model exists.
388cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     *
398cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     * @param keyphraseId The unique identifier for the keyphrase.
408cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     * @param bcp47Locale The BCP47 language tag  for the keyphrase's locale.
41d7018200312e4e4dc3f67cf33dc90bf7ce585844Sandeep     */
428cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha    SoundTrigger.KeyphraseSoundModel getKeyphraseSoundModel(int keyphraseId, in String bcp47Locale);
43d7018200312e4e4dc3f67cf33dc90bf7ce585844Sandeep    /**
448cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     * Add/Update the given keyphrase sound model.
45d7018200312e4e4dc3f67cf33dc90bf7ce585844Sandeep     */
46055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha    int updateKeyphraseSoundModel(in SoundTrigger.KeyphraseSoundModel model);
47452a642430e3f8abfa053e48893dd0edfb12799bSandeep Siddhartha    /**
488cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     * Deletes the given keyphrase sound model for the current user.
498cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     *
508cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     * @param keyphraseId The unique identifier for the keyphrase.
518cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     * @param bcp47Locale The BCP47 language tag  for the keyphrase's locale.
52452a642430e3f8abfa053e48893dd0edfb12799bSandeep Siddhartha     */
538cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha    int deleteKeyphraseSoundModel(int keyphraseId, in String bcp47Locale);
54055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha
55055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha    /**
56055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha     * Gets the properties of the DSP hardware on this device, null if not present.
57055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha     */
58055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha    SoundTrigger.ModuleProperties getDspModuleProperties(in IVoiceInteractionService service);
59055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha    /**
608cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     * Indicates if there's a keyphrase sound model available for the given keyphrase ID.
618cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     * This performs the check for the current user.
628cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     *
638cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     * @param service The current VoiceInteractionService.
648cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     * @param keyphraseId The unique identifier for the keyphrase.
658cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     * @param bcp47Locale The BCP47 language tag  for the keyphrase's locale.
668cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha     */
678cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha    boolean isEnrolledForKeyphrase(IVoiceInteractionService service, int keyphraseId,
688cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha            String bcp47Locale);
698cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha    /**
70055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha     * Starts a recognition for the given keyphrase.
71055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha     */
72055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha    int startRecognition(in IVoiceInteractionService service, int keyphraseId,
738cf8f71644643601fe8c3e9538fd00412b1ae8b1Sandeep Siddhartha            in String bcp47Locale, in IRecognitionStatusCallback callback,
74055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha            in SoundTrigger.RecognitionConfig recognitionConfig);
75055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha    /**
76055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha     * Stops a recognition for the given keyphrase.
77055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha     */
78055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha    int stopRecognition(in IVoiceInteractionService service, int keyphraseId,
79055897208d659e9734a82def88be4a806ff55448Sandeep Siddhartha            in IRecognitionStatusCallback callback);
8091097de49b0f683b00e26a75dbc0ac6082344137Dianne Hackborn}
81