blob: 420749e558e0f333c442eb126be855beaec85c50 [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 */
Andrei Oneafa152f92019-02-27 15:58:05 +000054 @UnsupportedAppUsage
Sandeep Siddhartha8cf8f712014-09-15 12:51:08 -070055 SoundTrigger.KeyphraseSoundModel getKeyphraseSoundModel(int keyphraseId, in String bcp47Locale);
Sandeepd7018202014-07-10 15:15:39 -070056 /**
Sandeep Siddhartha8cf8f712014-09-15 12:51:08 -070057 * Add/Update the given keyphrase sound model.
Sandeepd7018202014-07-10 15:15:39 -070058 */
Sandeep Siddhartha05589722014-07-17 16:21:54 -070059 int updateKeyphraseSoundModel(in SoundTrigger.KeyphraseSoundModel model);
Sandeep Siddhartha452a6422014-07-25 10:49:34 -070060 /**
Sandeep Siddhartha8cf8f712014-09-15 12:51:08 -070061 * Deletes the given keyphrase sound model for the current user.
62 *
63 * @param keyphraseId The unique identifier for the keyphrase.
64 * @param bcp47Locale The BCP47 language tag for the keyphrase's locale.
Sandeep Siddhartha452a6422014-07-25 10:49:34 -070065 */
Sandeep Siddhartha8cf8f712014-09-15 12:51:08 -070066 int deleteKeyphraseSoundModel(int keyphraseId, in String bcp47Locale);
Sandeep Siddhartha05589722014-07-17 16:21:54 -070067
68 /**
69 * Gets the properties of the DSP hardware on this device, null if not present.
70 */
71 SoundTrigger.ModuleProperties getDspModuleProperties(in IVoiceInteractionService service);
72 /**
Sandeep Siddhartha8cf8f712014-09-15 12:51:08 -070073 * Indicates if there's a keyphrase sound model available for the given keyphrase ID.
74 * This performs the check for the current user.
75 *
76 * @param service The current VoiceInteractionService.
77 * @param keyphraseId The unique identifier for the keyphrase.
78 * @param bcp47Locale The BCP47 language tag for the keyphrase's locale.
79 */
80 boolean isEnrolledForKeyphrase(IVoiceInteractionService service, int keyphraseId,
81 String bcp47Locale);
82 /**
Sandeep Siddhartha05589722014-07-17 16:21:54 -070083 * Starts a recognition for the given keyphrase.
84 */
85 int startRecognition(in IVoiceInteractionService service, int keyphraseId,
Sandeep Siddhartha8cf8f712014-09-15 12:51:08 -070086 in String bcp47Locale, in IRecognitionStatusCallback callback,
Sandeep Siddhartha05589722014-07-17 16:21:54 -070087 in SoundTrigger.RecognitionConfig recognitionConfig);
88 /**
89 * Stops a recognition for the given keyphrase.
90 */
91 int stopRecognition(in IVoiceInteractionService service, int keyphraseId,
92 in IRecognitionStatusCallback callback);
Jorim Jaggi25e12ab2015-04-02 11:46:28 -070093
94 /**
Jorim Jaggi225d3b52015-04-01 11:18:57 -070095 * @return the component name for the currently active voice interaction service
96 */
97 ComponentName getActiveServiceComponentName();
98
99 /**
Jorim Jaggi25e12ab2015-04-02 11:46:28 -0700100 * Shows the session for the currently active service. Used to start a new session from system
101 * affordances.
Jorim Jaggi225d3b52015-04-01 11:18:57 -0700102 *
Jorim Jaggi165ce062015-07-06 16:18:11 -0700103 * @param args the bundle to pass as arguments to the voice interaction session
Dianne Hackborn17f69352015-07-17 18:04:14 -0700104 * @param sourceFlags flags indicating the source of this show
105 * @param showCallback optional callback to be notified when the session was shown
106 * @param activityToken optional token of activity that needs to be on top
Jorim Jaggi25e12ab2015-04-02 11:46:28 -0700107 */
Dianne Hackborn17f69352015-07-17 18:04:14 -0700108 boolean showSessionForActiveService(in Bundle args, int sourceFlags,
109 IVoiceInteractionSessionShowCallback showCallback, IBinder activityToken);
Jorim Jaggi25e12ab2015-04-02 11:46:28 -0700110
111 /**
Jorim Jaggib835dd72015-06-08 12:28:42 -0700112 * Hides the session from the active service, if it is showing.
113 */
114 void hideCurrentSession();
115
116 /**
Selim Cineke70d6532015-04-24 16:46:13 -0700117 * Notifies the active service that a launch was requested from the Keyguard. This will only
118 * be called if {@link #activeServiceSupportsLaunchFromKeyguard()} returns true.
119 */
120 void launchVoiceAssistFromKeyguard();
121
122 /**
Jorim Jaggi25e12ab2015-04-02 11:46:28 -0700123 * Indicates whether there is a voice session running (but not necessarily showing).
124 */
125 boolean isSessionRunning();
Jorim Jaggi0b68ff42015-04-02 11:21:39 -0700126
127 /**
128 * Indicates whether the currently active voice interaction service is capable of handling the
129 * assist gesture.
130 */
Jorim Jaggi5f560d02015-04-30 11:49:29 -0700131 boolean activeServiceSupportsAssist();
Selim Cineke70d6532015-04-24 16:46:13 -0700132
133 /**
134 * Indicates whether the currently active voice interaction service is capable of being launched
135 * from the lockscreen.
136 */
137 boolean activeServiceSupportsLaunchFromKeyguard();
Jorim Jaggi19695d92015-07-20 15:51:40 -0700138
139 /**
140 * Called when the lockscreen got shown.
141 */
142 void onLockscreenShown();
Annie Chinecb9f3e2016-06-27 16:01:52 -0700143
144 /**
145 * Register a voice interaction listener.
146 */
147 void registerVoiceInteractionSessionListener(IVoiceInteractionSessionListener listener);
jiayuzhou21a353b2018-08-16 16:09:43 -0700148
149 /**
150 * Checks the availability of a set of voice actions for the current active voice service.
151 * Returns all supported voice actions.
152 */
153 void getActiveServiceSupportedActions(in List<String> voiceActions,
154 in IVoiceActionCheckCallback callback);
Matt Casey4cff16f2019-01-14 14:56:06 -0500155
156 /**
James O'Leary9c9dd982019-02-08 15:49:06 -0500157 * Provide hints for showing UI.
Matt Casey4cff16f2019-01-14 14:56:06 -0500158 */
James O'Leary9c9dd982019-02-08 15:49:06 -0500159 void setUiHints(in IVoiceInteractionService service, in Bundle hints);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700160}