Fix issue #21621920: VI: need mechanism to get current request
Add new APIs to associate a Request with a name, get all active
requests, and get active request by name.
Also add a new Activity.onProvideReferrer() which will allow
applications to propagate referrer information to the assistant
(and other apps they launch) in a consistent way.
Change-Id: I4ef74b5ed07447da9303a74a1bdf42e4966df363
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index dabcc50c..6ae21eb 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -2197,7 +2197,8 @@
Bundle extras = data.readBundle();
AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
AssistContent content = AssistContent.CREATOR.createFromParcel(data);
- reportAssistContextExtras(token, extras, structure, content);
+ Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
+ reportAssistContextExtras(token, extras, structure, content, referrer);
reply.writeNoException();
return true;
}
@@ -5367,7 +5368,7 @@
}
public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
- AssistContent content) throws RemoteException {
+ AssistContent content, Uri referrer) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
@@ -5375,6 +5376,12 @@
data.writeBundle(extras);
structure.writeToParcel(data, 0);
content.writeToParcel(data, 0);
+ if (referrer != null) {
+ data.writeInt(1);
+ referrer.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
reply.readException();
data.recycle();