Extend assist context to foreground services
Add Service.onProvideAssistData(Bundle) which will be
called on foreground Services that have the new attr
in their manifest of provideAssistData = true;
Rename private reference to e.g. "getTopActivityExtras"
as "getAssistContextExtras" - do not rename the relevant
permission, since it is already public.
In ActivityManagerService, request extras both from the
top activity and from any foreground services with the
above attribute. Extend PendingActivityExtras as
PendingAssistExtras with a list of Services from which
extras are expected.
Reduce the timeout to or reporting extras from 4 sec to
just 500 ms.
Bug: 9526331
Change-Id: Ia03b96e8189033a68ae9c514c8cea0199a19bce8
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 205ca6b..ff350b9 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1152,9 +1152,10 @@
/**
* Activity Action: Perform assist action.
* <p>
- * Input: {@link #EXTRA_ASSIST_PACKAGE} and {@link #EXTRA_ASSIST_CONTEXT} can provide
- * additional optional contextual information about where the user was when they requested
- * the assist.
+ * Input: {@link #EXTRA_ASSIST_PACKAGE}, {@link #EXTRA_ASSIST_CONTEXT},
+ * {@link #EXTRA_ASSIST_SERVICES_PACKAGES}, and {@link #EXTRA_ASSIST_SERVICES_CONTEXTS} can
+ * provide additional optional contextual information about where the user was when they
+ * requested the assist.
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
@@ -1163,9 +1164,10 @@
/**
* Activity Action: Perform voice assist action.
* <p>
- * Input: {@link #EXTRA_ASSIST_PACKAGE} and {@link #EXTRA_ASSIST_CONTEXT} can provide
- * additional optional contextual information about where the user was when they requested
- * the voice assist.
+ * Input: {@link #EXTRA_ASSIST_PACKAGE}, {@link #EXTRA_ASSIST_CONTEXT},
+ * {@link #EXTRA_ASSIST_SERVICES_PACKAGES}, and {@link #EXTRA_ASSIST_SERVICES_CONTEXTS} can
+ * provide additional optional contextual information about where the user was when they
+ * requested the voice assist.
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
@@ -1189,6 +1191,25 @@
= "android.intent.extra.ASSIST_CONTEXT";
/**
+ * An optional field on {@link #ACTION_ASSIST} and {@link #ACTION_VOICE_ASSIST}
+ * containing an the names of the application package of foreground services at the time
+ * of the assist request. This is an array of {@link String}s, with one entry
+ * per service.
+ */
+ public static final String EXTRA_ASSIST_SERVICES_PACKAGES
+ = "android.intent.extra.ASSIST_SERVICES_PACKAGES";
+
+ /**
+ * An optional field on {@link #ACTION_ASSIST} and {@link #ACTION_VOICE_ASSIST}
+ * containing additional contextual information supplied by the current
+ * foreground services at the time of the assist request. This is an array
+ * of {@link Bundle}s of additional data, with one {@link Bundle} per service.
+ */
+ public static final String EXTRA_ASSIST_SERVICES_CONTEXTS
+ = "android.intent.extra.ASSIST_SERVICES_CONTEXTS";
+
+
+ /**
* Activity Action: List all available applications
* <p>Input: Nothing.
* <p>Output: nothing.