blob: 9ce7ed1562cef5933a672d802df29a63488ceea2 [file] [log] [blame]
Dianne Hackborn91097de2014-04-04 18:02:06 -07001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17package com.android.internal.app;
18
Jorim Jaggi225d3b52015-04-01 11:18:57 -070019import android.content.ComponentName;
Dianne Hackborn91097de2014-04-04 18:02:06 -070020import android.content.Intent;
Dianne Hackborn18f0d352014-04-25 17:06:18 -070021import android.os.Bundle;
Dianne Hackborn91097de2014-04-04 18:02:06 -070022
jiayuzhou21a353b2018-08-16 16:09:43 -070023import com.android.internal.app.IVoiceActionCheckCallback;
Jorim Jaggi225d3b52015-04-01 11:18:57 -070024import com.android.internal.app.IVoiceInteractionSessionShowCallback;
Dianne Hackborn91097de2014-04-04 18:02:06 -070025import com.android.internal.app.IVoiceInteractor;
Annie Chinecb9f3e2016-06-27 16:01:52 -070026import com.android.internal.app.IVoiceInteractionSessionListener;
Sandeep Siddhartha05589722014-07-17 16:21:54 -070027import android.hardware.soundtrigger.IRecognitionStatusCallback;
28import android.hardware.soundtrigger.SoundTrigger;
Dianne Hackborn91097de2014-04-04 18:02:06 -070029import android.service.voice.IVoiceInteractionService;
30import android.service.voice.IVoiceInteractionSession;
31
32interface IVoiceInteractionManagerService {
Dianne Hackbornffeecb12015-02-25 11:08:11 -080033 void showSession(IVoiceInteractionService service, in Bundle sessionArgs, int flags);
Dianne Hackbornc03c9162014-05-02 10:45:59 -070034 boolean deliverNewSession(IBinder token, IVoiceInteractionSession session,
Dianne Hackborn18f0d352014-04-25 17:06:18 -070035 IVoiceInteractor interactor);
Dianne Hackbornffeecb12015-02-25 11:08:11 -080036 boolean showSessionFromSession(IBinder token, in Bundle sessionArgs, int flags);
37 boolean hideSessionFromSession(IBinder token);
Dianne Hackbornc03c9162014-05-02 10:45:59 -070038 int startVoiceActivity(IBinder token, in Intent intent, String resolvedType);
Winson Chung83471632016-12-13 11:02:12 -080039 int startAssistantActivity(IBinder token, in Intent intent, String resolvedType);
Dianne Hackborn3d07c942015-03-13 18:02:54 -070040 void setKeepAwake(IBinder token, boolean keepAwake);
Dianne Hackborn4e88bcd2015-07-01 13:41:03 -070041 void closeSystemDialogs(IBinder token);
Dianne Hackbornc03c9162014-05-02 10:45:59 -070042 void finish(IBinder token);
Dianne Hackborn1de11862015-07-15 14:20:51 -070043 void setDisabledShowContext(int flags);
44 int getDisabledShowContext();
Dianne Hackborn17f69352015-07-17 18:04:14 -070045 int getUserDisabledShowContext();
Sandeepd7018202014-07-10 15:15:39 -070046
47 /**
Sandeep Siddhartha8cf8f712014-09-15 12:51:08 -070048 * Gets the registered Sound model for keyphrase detection for the current user.
49 * May be null if no matching sound model exists.
50 *
51 * @param keyphraseId The unique identifier for the keyphrase.
52 * @param bcp47Locale The BCP47 language tag for the keyphrase's locale.
Sandeepd7018202014-07-10 15:15:39 -070053 */
Sandeep Siddhartha8cf8f712014-09-15 12:51:08 -070054 SoundTrigger.KeyphraseSoundModel getKeyphraseSoundModel(int keyphraseId, in String bcp47Locale);
Sandeepd7018202014-07-10 15:15:39 -070055 /**
Sandeep Siddhartha8cf8f712014-09-15 12:51:08 -070056 * Add/Update the given keyphrase sound model.
Sandeepd7018202014-07-10 15:15:39 -070057 */
Sandeep Siddhartha05589722014-07-17 16:21:54 -070058 int updateKeyphraseSoundModel(in SoundTrigger.KeyphraseSoundModel model);
Sandeep Siddhartha452a6422014-07-25 10:49:34 -070059 /**
Sandeep Siddhartha8cf8f712014-09-15 12:51:08 -070060 * Deletes the given keyphrase sound model for the current user.
61 *
62 * @param keyphraseId The unique identifier for the keyphrase.
63 * @param bcp47Locale The BCP47 language tag for the keyphrase's locale.
Sandeep Siddhartha452a6422014-07-25 10:49:34 -070064 */
Sandeep Siddhartha8cf8f712014-09-15 12:51:08 -070065 int deleteKeyphraseSoundModel(int keyphraseId, in String bcp47Locale);
Sandeep Siddhartha05589722014-07-17 16:21:54 -070066
67 /**
68 * Gets the properties of the DSP hardware on this device, null if not present.
69 */
70 SoundTrigger.ModuleProperties getDspModuleProperties(in IVoiceInteractionService service);
71 /**
Sandeep Siddhartha8cf8f712014-09-15 12:51:08 -070072 * Indicates if there's a keyphrase sound model available for the given keyphrase ID.
73 * This performs the check for the current user.
74 *
75 * @param service The current VoiceInteractionService.
76 * @param keyphraseId The unique identifier for the keyphrase.
77 * @param bcp47Locale The BCP47 language tag for the keyphrase's locale.
78 */
79 boolean isEnrolledForKeyphrase(IVoiceInteractionService service, int keyphraseId,
80 String bcp47Locale);
81 /**
Sandeep Siddhartha05589722014-07-17 16:21:54 -070082 * Starts a recognition for the given keyphrase.
83 */
84 int startRecognition(in IVoiceInteractionService service, int keyphraseId,
Sandeep Siddhartha8cf8f712014-09-15 12:51:08 -070085 in String bcp47Locale, in IRecognitionStatusCallback callback,
Sandeep Siddhartha05589722014-07-17 16:21:54 -070086 in SoundTrigger.RecognitionConfig recognitionConfig);
87 /**
88 * Stops a recognition for the given keyphrase.
89 */
90 int stopRecognition(in IVoiceInteractionService service, int keyphraseId,
91 in IRecognitionStatusCallback callback);
Jorim Jaggi25e12ab2015-04-02 11:46:28 -070092
93 /**
Jorim Jaggi225d3b52015-04-01 11:18:57 -070094 * @return the component name for the currently active voice interaction service
95 */
96 ComponentName getActiveServiceComponentName();
97
98 /**
Jorim Jaggi25e12ab2015-04-02 11:46:28 -070099 * Shows the session for the currently active service. Used to start a new session from system
100 * affordances.
Jorim Jaggi225d3b52015-04-01 11:18:57 -0700101 *
Jorim Jaggi165ce062015-07-06 16:18:11 -0700102 * @param args the bundle to pass as arguments to the voice interaction session
Dianne Hackborn17f69352015-07-17 18:04:14 -0700103 * @param sourceFlags flags indicating the source of this show
104 * @param showCallback optional callback to be notified when the session was shown
105 * @param activityToken optional token of activity that needs to be on top
Jorim Jaggi25e12ab2015-04-02 11:46:28 -0700106 */
Dianne Hackborn17f69352015-07-17 18:04:14 -0700107 boolean showSessionForActiveService(in Bundle args, int sourceFlags,
108 IVoiceInteractionSessionShowCallback showCallback, IBinder activityToken);
Jorim Jaggi25e12ab2015-04-02 11:46:28 -0700109
110 /**
Jorim Jaggib835dd72015-06-08 12:28:42 -0700111 * Hides the session from the active service, if it is showing.
112 */
113 void hideCurrentSession();
114
115 /**
Selim Cineke70d6532015-04-24 16:46:13 -0700116 * Notifies the active service that a launch was requested from the Keyguard. This will only
117 * be called if {@link #activeServiceSupportsLaunchFromKeyguard()} returns true.
118 */
119 void launchVoiceAssistFromKeyguard();
120
121 /**
Jorim Jaggi25e12ab2015-04-02 11:46:28 -0700122 * Indicates whether there is a voice session running (but not necessarily showing).
123 */
124 boolean isSessionRunning();
Jorim Jaggi0b68ff42015-04-02 11:21:39 -0700125
126 /**
127 * Indicates whether the currently active voice interaction service is capable of handling the
128 * assist gesture.
129 */
Jorim Jaggi5f560d02015-04-30 11:49:29 -0700130 boolean activeServiceSupportsAssist();
Selim Cineke70d6532015-04-24 16:46:13 -0700131
132 /**
133 * Indicates whether the currently active voice interaction service is capable of being launched
134 * from the lockscreen.
135 */
136 boolean activeServiceSupportsLaunchFromKeyguard();
Jorim Jaggi19695d92015-07-20 15:51:40 -0700137
138 /**
139 * Called when the lockscreen got shown.
140 */
141 void onLockscreenShown();
Annie Chinecb9f3e2016-06-27 16:01:52 -0700142
143 /**
144 * Register a voice interaction listener.
145 */
146 void registerVoiceInteractionSessionListener(IVoiceInteractionSessionListener listener);
jiayuzhou21a353b2018-08-16 16:09:43 -0700147
148 /**
149 * Checks the availability of a set of voice actions for the current active voice service.
150 * Returns all supported voice actions.
151 */
152 void getActiveServiceSupportedActions(in List<String> voiceActions,
153 in IVoiceActionCheckCallback callback);
Matt Casey4cff16f2019-01-14 14:56:06 -0500154
155 /**
James O'Leary9c9dd982019-02-08 15:49:06 -0500156 * Provide hints for showing UI.
Matt Casey4cff16f2019-01-14 14:56:06 -0500157 */
James O'Leary9c9dd982019-02-08 15:49:06 -0500158 void setUiHints(in IVoiceInteractionService service, in Bundle hints);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700159}