diff options
Diffstat (limited to 'core')
6 files changed, 46 insertions, 0 deletions
diff --git a/core/java/android/service/voice/IVoiceInteractionService.aidl b/core/java/android/service/voice/IVoiceInteractionService.aidl index e8265a2..e3d68a6 100644 --- a/core/java/android/service/voice/IVoiceInteractionService.aidl +++ b/core/java/android/service/voice/IVoiceInteractionService.aidl @@ -23,4 +23,5 @@ oneway interface IVoiceInteractionService { void ready(); void soundModelsChanged(); void shutdown(); + void launchVoiceAssistFromKeyguard(); } diff --git a/core/java/android/service/voice/VoiceInteractionService.java b/core/java/android/service/voice/VoiceInteractionService.java index fee0c75..8c89ddb 100644 --- a/core/java/android/service/voice/VoiceInteractionService.java +++ b/core/java/android/service/voice/VoiceInteractionService.java @@ -98,6 +98,10 @@ public class VoiceInteractionService extends Service { @Override public void soundModelsChanged() { mHandler.sendEmptyMessage(MSG_SOUND_MODELS_CHANGED); } + @Override + public void launchVoiceAssistFromKeyguard() throws RemoteException { + mHandler.sendEmptyMessage(MSG_LAUNCH_VOICE_ASSIST_FROM_KEYGUARD); + } }; MyHandler mHandler; @@ -113,6 +117,7 @@ public class VoiceInteractionService extends Service { static final int MSG_READY = 1; static final int MSG_SHUTDOWN = 2; static final int MSG_SOUND_MODELS_CHANGED = 3; + static final int MSG_LAUNCH_VOICE_ASSIST_FROM_KEYGUARD = 4; class MyHandler extends Handler { @Override @@ -127,6 +132,9 @@ public class VoiceInteractionService extends Service { case MSG_SOUND_MODELS_CHANGED: onSoundModelsChangedInternal(); break; + case MSG_LAUNCH_VOICE_ASSIST_FROM_KEYGUARD: + onLaunchVoiceAssistFromKeyguard(); + break; default: super.handleMessage(msg); } @@ -134,6 +142,19 @@ public class VoiceInteractionService extends Service { } /** + * Called when a user has activated an affordance to launch voice assist from the Keyguard. + * + * <p>This method will only be called if the VoiceInteractionService has set + * {@link android.R.attr#supportsLaunchVoiceAssistFromKeyguard} and the Keyguard is showing.</p> + * + * <p>A valid implementation must start a new activity that should use {@link + * android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED} to display + * on top of the lock screen.</p> + */ + public void onLaunchVoiceAssistFromKeyguard() { + } + + /** * Check whether the given service component is the currently active * VoiceInteractionService. */ diff --git a/core/java/android/service/voice/VoiceInteractionServiceInfo.java b/core/java/android/service/voice/VoiceInteractionServiceInfo.java index 997d586..463eb5b 100644 --- a/core/java/android/service/voice/VoiceInteractionServiceInfo.java +++ b/core/java/android/service/voice/VoiceInteractionServiceInfo.java @@ -44,6 +44,7 @@ public class VoiceInteractionServiceInfo { private String mRecognitionService; private String mSettingsActivity; private boolean mSupportsAssist; + private boolean mSupportsLaunchFromKeyguard; public VoiceInteractionServiceInfo(PackageManager pm, ComponentName comp) throws PackageManager.NameNotFoundException { @@ -98,6 +99,9 @@ public class VoiceInteractionServiceInfo { mSupportsAssist = array.getBoolean( com.android.internal.R.styleable.VoiceInteractionService_supportsAssist, false); + mSupportsLaunchFromKeyguard = array.getBoolean(com.android.internal. + R.styleable.VoiceInteractionService_supportsLaunchVoiceAssistFromKeyguard, + false); array.recycle(); if (mSessionService == null) { mParseError = "No sessionService specified"; @@ -148,4 +152,8 @@ public class VoiceInteractionServiceInfo { public boolean getSupportsAssist() { return mSupportsAssist; } + + public boolean getSupportsLaunchFromKeyguard() { + return mSupportsLaunchFromKeyguard; + } } diff --git a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl index 4c6db24..644adb6 100644 --- a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl +++ b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl @@ -97,6 +97,12 @@ interface IVoiceInteractionManagerService { void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback); /** + * Notifies the active service that a launch was requested from the Keyguard. This will only + * be called if {@link #activeServiceSupportsLaunchFromKeyguard()} returns true. + */ + void launchVoiceAssistFromKeyguard(); + + /** * Indicates whether there is a voice session running (but not necessarily showing). */ boolean isSessionRunning(); @@ -106,4 +112,10 @@ interface IVoiceInteractionManagerService { * assist gesture. */ boolean activeServiceSupportsAssist(); + + /** + * Indicates whether the currently active voice interaction service is capable of being launched + * from the lockscreen. + */ + boolean activeServiceSupportsLaunchFromKeyguard(); } diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index fe5862b..2914817 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -7306,6 +7306,9 @@ <!-- Flag indicating whether this voice interaction service is capable of handling the assist action. --> <attr name="supportsAssist" format="boolean" /> + <!-- Flag indicating whether this voice interaction service is capable of being launched + from the keyguard. --> + <attr name="supportsLaunchVoiceAssistFromKeyguard" format="boolean" /> </declare-styleable> <!-- Use <code>voice-enrollment-application</code> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 91c3d2e..83ac6c1 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2685,4 +2685,5 @@ <public type="attr" name="assistBlocked" /> <public type="attr" name="stylusButtonPressable" /> + <public type="attr" name="supportsLaunchVoiceAssistFromKeyguard" /> </resources> |