2 * Copyright (C) 2014 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.internal.app;
19 import android.content.ComponentName;
20 import android.content.Intent;
21 import android.os.Bundle;
23 import com.android.internal.app.IVoiceInteractionSessionShowCallback;
24 import com.android.internal.app.IVoiceInteractor;
25 import com.android.internal.app.IVoiceInteractionSessionListener;
26 import android.hardware.soundtrigger.IRecognitionStatusCallback;
27 import android.hardware.soundtrigger.SoundTrigger;
28 import android.service.voice.IVoiceInteractionService;
29 import android.service.voice.IVoiceInteractionSession;
31 interface IVoiceInteractionManagerService {
32 void showSession(IVoiceInteractionService service, in Bundle sessionArgs, int flags);
33 boolean deliverNewSession(IBinder token, IVoiceInteractionSession session,
34 IVoiceInteractor interactor);
35 boolean showSessionFromSession(IBinder token, in Bundle sessionArgs, int flags);
36 boolean hideSessionFromSession(IBinder token);
37 int startVoiceActivity(IBinder token, in Intent intent, String resolvedType);
38 void setKeepAwake(IBinder token, boolean keepAwake);
39 void closeSystemDialogs(IBinder token);
40 void finish(IBinder token);
41 void setDisabledShowContext(int flags);
42 int getDisabledShowContext();
43 int getUserDisabledShowContext();
46 * Gets the registered Sound model for keyphrase detection for the current user.
47 * May be null if no matching sound model exists.
49 * @param keyphraseId The unique identifier for the keyphrase.
50 * @param bcp47Locale The BCP47 language tag for the keyphrase's locale.
52 SoundTrigger.KeyphraseSoundModel getKeyphraseSoundModel(int keyphraseId, in String bcp47Locale);
54 * Add/Update the given keyphrase sound model.
56 int updateKeyphraseSoundModel(in SoundTrigger.KeyphraseSoundModel model);
58 * Deletes the given keyphrase sound model for the current user.
60 * @param keyphraseId The unique identifier for the keyphrase.
61 * @param bcp47Locale The BCP47 language tag for the keyphrase's locale.
63 int deleteKeyphraseSoundModel(int keyphraseId, in String bcp47Locale);
66 * Gets the properties of the DSP hardware on this device, null if not present.
68 SoundTrigger.ModuleProperties getDspModuleProperties(in IVoiceInteractionService service);
70 * Indicates if there's a keyphrase sound model available for the given keyphrase ID.
71 * This performs the check for the current user.
73 * @param service The current VoiceInteractionService.
74 * @param keyphraseId The unique identifier for the keyphrase.
75 * @param bcp47Locale The BCP47 language tag for the keyphrase's locale.
77 boolean isEnrolledForKeyphrase(IVoiceInteractionService service, int keyphraseId,
80 * Starts a recognition for the given keyphrase.
82 int startRecognition(in IVoiceInteractionService service, int keyphraseId,
83 in String bcp47Locale, in IRecognitionStatusCallback callback,
84 in SoundTrigger.RecognitionConfig recognitionConfig);
86 * Stops a recognition for the given keyphrase.
88 int stopRecognition(in IVoiceInteractionService service, int keyphraseId,
89 in IRecognitionStatusCallback callback);
92 * @return the component name for the currently active voice interaction service
94 ComponentName getActiveServiceComponentName();
97 * Shows the session for the currently active service. Used to start a new session from system
100 * @param args the bundle to pass as arguments to the voice interaction session
101 * @param sourceFlags flags indicating the source of this show
102 * @param showCallback optional callback to be notified when the session was shown
103 * @param activityToken optional token of activity that needs to be on top
105 boolean showSessionForActiveService(in Bundle args, int sourceFlags,
106 IVoiceInteractionSessionShowCallback showCallback, IBinder activityToken);
109 * Hides the session from the active service, if it is showing.
111 void hideCurrentSession();
114 * Notifies the active service that a launch was requested from the Keyguard. This will only
115 * be called if {@link #activeServiceSupportsLaunchFromKeyguard()} returns true.
117 void launchVoiceAssistFromKeyguard();
120 * Indicates whether there is a voice session running (but not necessarily showing).
122 boolean isSessionRunning();
125 * Indicates whether the currently active voice interaction service is capable of handling the
128 boolean activeServiceSupportsAssist();
131 * Indicates whether the currently active voice interaction service is capable of being launched
132 * from the lockscreen.
134 boolean activeServiceSupportsLaunchFromKeyguard();
137 * Called when the lockscreen got shown.
139 void onLockscreenShown();
142 * Register a voice interaction listener.
144 void registerVoiceInteractionSessionListener(IVoiceInteractionSessionListener listener);