Dianne Hackborn | 91097de | 2014-04-04 18:02:06 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.internal.app; |
| 18 | |
Jorim Jaggi | 225d3b5 | 2015-04-01 11:18:57 -0700 | [diff] [blame] | 19 | import android.content.ComponentName; |
Dianne Hackborn | 91097de | 2014-04-04 18:02:06 -0700 | [diff] [blame] | 20 | import android.content.Intent; |
Dianne Hackborn | 18f0d35 | 2014-04-25 17:06:18 -0700 | [diff] [blame] | 21 | import android.os.Bundle; |
Dianne Hackborn | 91097de | 2014-04-04 18:02:06 -0700 | [diff] [blame] | 22 | |
jiayuzhou | 21a353b | 2018-08-16 16:09:43 -0700 | [diff] [blame] | 23 | import com.android.internal.app.IVoiceActionCheckCallback; |
Jorim Jaggi | 225d3b5 | 2015-04-01 11:18:57 -0700 | [diff] [blame] | 24 | import com.android.internal.app.IVoiceInteractionSessionShowCallback; |
Dianne Hackborn | 91097de | 2014-04-04 18:02:06 -0700 | [diff] [blame] | 25 | import com.android.internal.app.IVoiceInteractor; |
Annie Chin | ecb9f3e | 2016-06-27 16:01:52 -0700 | [diff] [blame] | 26 | import com.android.internal.app.IVoiceInteractionSessionListener; |
Sandeep Siddhartha | 0558972 | 2014-07-17 16:21:54 -0700 | [diff] [blame] | 27 | import android.hardware.soundtrigger.IRecognitionStatusCallback; |
| 28 | import android.hardware.soundtrigger.SoundTrigger; |
Dianne Hackborn | 91097de | 2014-04-04 18:02:06 -0700 | [diff] [blame] | 29 | import android.service.voice.IVoiceInteractionService; |
| 30 | import android.service.voice.IVoiceInteractionSession; |
| 31 | |
| 32 | interface IVoiceInteractionManagerService { |
Dianne Hackborn | ffeecb1 | 2015-02-25 11:08:11 -0800 | [diff] [blame] | 33 | void showSession(IVoiceInteractionService service, in Bundle sessionArgs, int flags); |
Dianne Hackborn | c03c916 | 2014-05-02 10:45:59 -0700 | [diff] [blame] | 34 | boolean deliverNewSession(IBinder token, IVoiceInteractionSession session, |
Dianne Hackborn | 18f0d35 | 2014-04-25 17:06:18 -0700 | [diff] [blame] | 35 | IVoiceInteractor interactor); |
Dianne Hackborn | ffeecb1 | 2015-02-25 11:08:11 -0800 | [diff] [blame] | 36 | boolean showSessionFromSession(IBinder token, in Bundle sessionArgs, int flags); |
| 37 | boolean hideSessionFromSession(IBinder token); |
Dianne Hackborn | c03c916 | 2014-05-02 10:45:59 -0700 | [diff] [blame] | 38 | int startVoiceActivity(IBinder token, in Intent intent, String resolvedType); |
Winson Chung | 8347163 | 2016-12-13 11:02:12 -0800 | [diff] [blame] | 39 | int startAssistantActivity(IBinder token, in Intent intent, String resolvedType); |
Dianne Hackborn | 3d07c94 | 2015-03-13 18:02:54 -0700 | [diff] [blame] | 40 | void setKeepAwake(IBinder token, boolean keepAwake); |
Dianne Hackborn | 4e88bcd | 2015-07-01 13:41:03 -0700 | [diff] [blame] | 41 | void closeSystemDialogs(IBinder token); |
Dianne Hackborn | c03c916 | 2014-05-02 10:45:59 -0700 | [diff] [blame] | 42 | void finish(IBinder token); |
Dianne Hackborn | 1de1186 | 2015-07-15 14:20:51 -0700 | [diff] [blame] | 43 | void setDisabledShowContext(int flags); |
| 44 | int getDisabledShowContext(); |
Dianne Hackborn | 17f6935 | 2015-07-17 18:04:14 -0700 | [diff] [blame] | 45 | int getUserDisabledShowContext(); |
Sandeep | d701820 | 2014-07-10 15:15:39 -0700 | [diff] [blame] | 46 | |
| 47 | /** |
Sandeep Siddhartha | 8cf8f71 | 2014-09-15 12:51:08 -0700 | [diff] [blame] | 48 | * 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. |
Sandeep | d701820 | 2014-07-10 15:15:39 -0700 | [diff] [blame] | 53 | */ |
Sandeep Siddhartha | 8cf8f71 | 2014-09-15 12:51:08 -0700 | [diff] [blame] | 54 | SoundTrigger.KeyphraseSoundModel getKeyphraseSoundModel(int keyphraseId, in String bcp47Locale); |
Sandeep | d701820 | 2014-07-10 15:15:39 -0700 | [diff] [blame] | 55 | /** |
Sandeep Siddhartha | 8cf8f71 | 2014-09-15 12:51:08 -0700 | [diff] [blame] | 56 | * Add/Update the given keyphrase sound model. |
Sandeep | d701820 | 2014-07-10 15:15:39 -0700 | [diff] [blame] | 57 | */ |
Sandeep Siddhartha | 0558972 | 2014-07-17 16:21:54 -0700 | [diff] [blame] | 58 | int updateKeyphraseSoundModel(in SoundTrigger.KeyphraseSoundModel model); |
Sandeep Siddhartha | 452a642 | 2014-07-25 10:49:34 -0700 | [diff] [blame] | 59 | /** |
Sandeep Siddhartha | 8cf8f71 | 2014-09-15 12:51:08 -0700 | [diff] [blame] | 60 | * 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 Siddhartha | 452a642 | 2014-07-25 10:49:34 -0700 | [diff] [blame] | 64 | */ |
Sandeep Siddhartha | 8cf8f71 | 2014-09-15 12:51:08 -0700 | [diff] [blame] | 65 | int deleteKeyphraseSoundModel(int keyphraseId, in String bcp47Locale); |
Sandeep Siddhartha | 0558972 | 2014-07-17 16:21:54 -0700 | [diff] [blame] | 66 | |
| 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 Siddhartha | 8cf8f71 | 2014-09-15 12:51:08 -0700 | [diff] [blame] | 72 | * 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 Siddhartha | 0558972 | 2014-07-17 16:21:54 -0700 | [diff] [blame] | 82 | * Starts a recognition for the given keyphrase. |
| 83 | */ |
| 84 | int startRecognition(in IVoiceInteractionService service, int keyphraseId, |
Sandeep Siddhartha | 8cf8f71 | 2014-09-15 12:51:08 -0700 | [diff] [blame] | 85 | in String bcp47Locale, in IRecognitionStatusCallback callback, |
Sandeep Siddhartha | 0558972 | 2014-07-17 16:21:54 -0700 | [diff] [blame] | 86 | 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 Jaggi | 25e12ab | 2015-04-02 11:46:28 -0700 | [diff] [blame] | 92 | |
| 93 | /** |
Jorim Jaggi | 225d3b5 | 2015-04-01 11:18:57 -0700 | [diff] [blame] | 94 | * @return the component name for the currently active voice interaction service |
| 95 | */ |
| 96 | ComponentName getActiveServiceComponentName(); |
| 97 | |
| 98 | /** |
Jorim Jaggi | 25e12ab | 2015-04-02 11:46:28 -0700 | [diff] [blame] | 99 | * Shows the session for the currently active service. Used to start a new session from system |
| 100 | * affordances. |
Jorim Jaggi | 225d3b5 | 2015-04-01 11:18:57 -0700 | [diff] [blame] | 101 | * |
Jorim Jaggi | 165ce06 | 2015-07-06 16:18:11 -0700 | [diff] [blame] | 102 | * @param args the bundle to pass as arguments to the voice interaction session |
Dianne Hackborn | 17f6935 | 2015-07-17 18:04:14 -0700 | [diff] [blame] | 103 | * @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 Jaggi | 25e12ab | 2015-04-02 11:46:28 -0700 | [diff] [blame] | 106 | */ |
Dianne Hackborn | 17f6935 | 2015-07-17 18:04:14 -0700 | [diff] [blame] | 107 | boolean showSessionForActiveService(in Bundle args, int sourceFlags, |
| 108 | IVoiceInteractionSessionShowCallback showCallback, IBinder activityToken); |
Jorim Jaggi | 25e12ab | 2015-04-02 11:46:28 -0700 | [diff] [blame] | 109 | |
| 110 | /** |
Jorim Jaggi | b835dd7 | 2015-06-08 12:28:42 -0700 | [diff] [blame] | 111 | * Hides the session from the active service, if it is showing. |
| 112 | */ |
| 113 | void hideCurrentSession(); |
| 114 | |
| 115 | /** |
Selim Cinek | e70d653 | 2015-04-24 16:46:13 -0700 | [diff] [blame] | 116 | * 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 Jaggi | 25e12ab | 2015-04-02 11:46:28 -0700 | [diff] [blame] | 122 | * Indicates whether there is a voice session running (but not necessarily showing). |
| 123 | */ |
| 124 | boolean isSessionRunning(); |
Jorim Jaggi | 0b68ff4 | 2015-04-02 11:21:39 -0700 | [diff] [blame] | 125 | |
| 126 | /** |
| 127 | * Indicates whether the currently active voice interaction service is capable of handling the |
| 128 | * assist gesture. |
| 129 | */ |
Jorim Jaggi | 5f560d0 | 2015-04-30 11:49:29 -0700 | [diff] [blame] | 130 | boolean activeServiceSupportsAssist(); |
Selim Cinek | e70d653 | 2015-04-24 16:46:13 -0700 | [diff] [blame] | 131 | |
| 132 | /** |
| 133 | * Indicates whether the currently active voice interaction service is capable of being launched |
| 134 | * from the lockscreen. |
| 135 | */ |
| 136 | boolean activeServiceSupportsLaunchFromKeyguard(); |
Jorim Jaggi | 19695d9 | 2015-07-20 15:51:40 -0700 | [diff] [blame] | 137 | |
| 138 | /** |
| 139 | * Called when the lockscreen got shown. |
| 140 | */ |
| 141 | void onLockscreenShown(); |
Annie Chin | ecb9f3e | 2016-06-27 16:01:52 -0700 | [diff] [blame] | 142 | |
| 143 | /** |
| 144 | * Register a voice interaction listener. |
| 145 | */ |
| 146 | void registerVoiceInteractionSessionListener(IVoiceInteractionSessionListener listener); |
jiayuzhou | 21a353b | 2018-08-16 16:09:43 -0700 | [diff] [blame] | 147 | |
| 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 Casey | 4cff16f | 2019-01-14 14:56:06 -0500 | [diff] [blame] | 154 | |
| 155 | /** |
James O'Leary | 9c9dd98 | 2019-02-08 15:49:06 -0500 | [diff] [blame] | 156 | * Provide hints for showing UI. |
Matt Casey | 4cff16f | 2019-01-14 14:56:06 -0500 | [diff] [blame] | 157 | */ |
James O'Leary | 9c9dd98 | 2019-02-08 15:49:06 -0500 | [diff] [blame] | 158 | void setUiHints(in IVoiceInteractionService service, in Bundle hints); |
Dianne Hackborn | 91097de | 2014-04-04 18:02:06 -0700 | [diff] [blame] | 159 | } |