diff options
| author | Dianne Hackborn <hackbod@google.com> | 2010-11-22 15:59:56 -0800 |
|---|---|---|
| committer | Dianne Hackborn <hackbod@google.com> | 2010-11-22 18:35:55 -0800 |
| commit | 621e17de87f18003aba2dedb719a2941020a7902 (patch) | |
| tree | 978b402ced5bd03d3b4f6eaa9fbaaf186427823c /core/java/android/app/ActivityManagerNative.java | |
| parent | 703c5f39c58168829e8d8f7ed7b5aea3f4fb600b (diff) | |
Implement issue #3221502: New APIs to support new back stack / task navigation
What this adds:
- A new Intent activity flag to completely replace an existing task.
- A new Intent activity flag to bring the current home task up behind
a new task being started/brought to the foreground.
- New versions of startActivity() that take an array of Intents to be
started, allowing applications to start a task in a specific state.
- A public moveTaskToFront() method on ActivityManager, with a new flag
that allows the caller to have the task moved to the front with the
current home task immediately behind it.
Change-Id: Ie8028d09acffb5349d98043c67676daba09f75c8
Diffstat (limited to 'core/java/android/app/ActivityManagerNative.java')
| -rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 91 |
1 files changed, 80 insertions, 11 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 8cc6428f7ba3..273e3c64ab1e 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -492,7 +492,8 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM case MOVE_TASK_TO_FRONT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int task = data.readInt(); - moveTaskToFront(task); + int fl = data.readInt(); + moveTaskToFront(task, fl); reply.writeNoException(); return true; } @@ -791,13 +792,19 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM IBinder token = data.readStrongBinder(); String resultWho = data.readString(); int requestCode = data.readInt(); - Intent requestIntent = data.readInt() != 0 - ? Intent.CREATOR.createFromParcel(data) : null; - String requestResolvedType = data.readString(); + Intent[] requestIntents; + String[] requestResolvedTypes; + if (data.readInt() != 0) { + requestIntents = data.createTypedArray(Intent.CREATOR); + requestResolvedTypes = data.createStringArray(); + } else { + requestIntents = null; + requestResolvedTypes = null; + } int fl = data.readInt(); IIntentSender res = getIntentSender(type, packageName, token, - resultWho, requestCode, requestIntent, - requestResolvedType, fl); + resultWho, requestCode, requestIntents, + requestResolvedTypes, fl); reply.writeNoException(); reply.writeStrongBinder(res != null ? res.asBinder() : null); return true; @@ -1355,6 +1362,33 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } + case START_ACTIVITIES_IN_PACKAGE_TRANSACTION: + { + data.enforceInterface(IActivityManager.descriptor); + int uid = data.readInt(); + Intent[] intents = data.createTypedArray(Intent.CREATOR); + String[] resolvedTypes = data.createStringArray(); + IBinder resultTo = data.readStrongBinder(); + int result = startActivitiesInPackage(uid, intents, resolvedTypes, resultTo); + reply.writeNoException(); + reply.writeInt(result); + return true; + } + + case START_ACTIVITIES_TRANSACTION: + { + data.enforceInterface(IActivityManager.descriptor); + IBinder b = data.readStrongBinder(); + IApplicationThread app = ApplicationThreadNative.asInterface(b); + Intent[] intents = data.createTypedArray(Intent.CREATOR); + String[] resolvedTypes = data.createStringArray(); + IBinder resultTo = data.readStrongBinder(); + int result = startActivities(app, intents, resolvedTypes, resultTo); + reply.writeNoException(); + reply.writeInt(result); + return true; + } + } return super.onTransact(code, data, reply, flags); @@ -1829,12 +1863,13 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); return list; } - public void moveTaskToFront(int task) throws RemoteException + public void moveTaskToFront(int task, int flags) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeInt(task); + data.writeInt(flags); mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); @@ -2283,7 +2318,7 @@ class ActivityManagerProxy implements IActivityManager } public IIntentSender getIntentSender(int type, String packageName, IBinder token, String resultWho, - int requestCode, Intent intent, String resolvedType, int flags) + int requestCode, Intent[] intents, String[] resolvedTypes, int flags) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -2293,13 +2328,13 @@ class ActivityManagerProxy implements IActivityManager data.writeStrongBinder(token); data.writeString(resultWho); data.writeInt(requestCode); - if (intent != null) { + if (intents != null) { data.writeInt(1); - intent.writeToParcel(data, 0); + data.writeTypedArray(intents, 0); + data.writeStringArray(resolvedTypes); } else { data.writeInt(0); } - data.writeString(resolvedType); data.writeInt(flags); mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0); reply.readException(); @@ -3026,5 +3061,39 @@ class ActivityManagerProxy implements IActivityManager return res; } + public int startActivities(IApplicationThread caller, + Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(caller != null ? caller.asBinder() : null); + data.writeTypedArray(intents, 0); + data.writeStringArray(resolvedTypes); + data.writeStrongBinder(resultTo); + mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0); + reply.readException(); + int result = reply.readInt(); + reply.recycle(); + data.recycle(); + return result; + } + + public int startActivitiesInPackage(int uid, + Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeInt(uid); + data.writeTypedArray(intents, 0); + data.writeStringArray(resolvedTypes); + data.writeStrongBinder(resultTo); + mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0); + reply.readException(); + int result = reply.readInt(); + reply.recycle(); + data.recycle(); + return result; + } + private IBinder mRemote; } |
