From 17f693520da8977c4a60f5b4be3be035cba7146c Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Fri, 17 Jul 2015 18:04:14 -0700 Subject: Fix issue #22531747: Assist info should declare if user has disabled... ...context and/or screenshot Added new API to find out what contextual data has been globally disabled. Also updated various documentation to make it clear what kind of contextual data you will get (and when it will be null). Also added a new Activity.showAssist() API because... well, I was already in there, it was easy to do, it is safe, and maybe people will build cool things with it. Change-Id: Ia553d6bcdd098dc0fce4b9237fbfaca9652fc74b --- core/java/android/app/Activity.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'core/java/android/app/Activity.java') diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 96c7f84..8d4ce62 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -1545,6 +1545,24 @@ public class Activity extends ContextThemeWrapper } /** + * Ask to have the current assistant shown to the user. This only works if the calling + * activity is the current foreground activity. It is the same as calling + * {@link android.service.voice.VoiceInteractionService#showSession + * VoiceInteractionService.showSession} and requesting all of the possible context. + * The receiver will always see + * {@link android.service.voice.VoiceInteractionSession#SHOW_SOURCE_APPLICATION} set. + * @return Returns true if the assistant was successfully invoked, else false. For example + * false will be returned if the caller is not the current top activity. + */ + public boolean showAssist(Bundle args) { + try { + return ActivityManagerNative.getDefault().showAssistFromActivity(mToken, args); + } catch (RemoteException e) { + } + return false; + } + + /** * Called when you are no longer visible to the user. You will next * receive either {@link #onRestart}, {@link #onDestroy}, or nothing, * depending on later user activity. -- cgit v1.1