From dfc7fd7818cda46b914c8a9d69d1ba00443ffe5b Mon Sep 17 00:00:00 2001 From: Adam Skory Date: Mon, 5 Aug 2013 19:23:41 -0700 Subject: 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 --- core/java/android/app/ApplicationThreadNative.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'core/java/android/app/ApplicationThreadNative.java') diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index 6f18e84..df5b476 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -599,13 +599,14 @@ public abstract class ApplicationThreadNative extends Binder return true; } - case REQUEST_ACTIVITY_EXTRAS_TRANSACTION: + case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: { data.enforceInterface(IApplicationThread.descriptor); IBinder activityToken = data.readStrongBinder(); IBinder requestToken = data.readStrongBinder(); int requestType = data.readInt(); - requestActivityExtras(activityToken, requestToken, requestType); + int index = data.readInt(); + requestAssistContextExtras(activityToken, requestToken, requestType, index); reply.writeNoException(); return true; } @@ -1238,14 +1239,16 @@ class ApplicationThreadProxy implements IApplicationThread { } @Override - public void requestActivityExtras(IBinder activityToken, IBinder requestToken, int requestType) - throws RemoteException { + public void requestAssistContextExtras(IBinder activityToken, IBinder requestToken, + int requestType, int index) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); data.writeStrongBinder(activityToken); data.writeStrongBinder(requestToken); data.writeInt(requestType); - mRemote.transact(REQUEST_ACTIVITY_EXTRAS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); + data.writeInt(index); + mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, null, + IBinder.FLAG_ONEWAY); data.recycle(); } -- cgit v1.1