summaryrefslogtreecommitdiffstats
path: root/core/java/android/app/Instrumentation.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-11-22 15:59:56 -0800
committerDianne Hackborn <hackbod@google.com>2010-11-22 18:35:55 -0800
commit621e17de87f18003aba2dedb719a2941020a7902 (patch)
tree978b402ced5bd03d3b4f6eaa9fbaaf186427823c /core/java/android/app/Instrumentation.java
parent703c5f39c58168829e8d8f7ed7b5aea3f4fb600b (diff)
downloadframeworks_base-621e17de87f18003aba2dedb719a2941020a7902.zip
frameworks_base-621e17de87f18003aba2dedb719a2941020a7902.tar.gz
frameworks_base-621e17de87f18003aba2dedb719a2941020a7902.tar.bz2
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/Instrumentation.java')
-rw-r--r--core/java/android/app/Instrumentation.java42
1 files changed, 40 insertions, 2 deletions
diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java
index 1deb9fb..ad811d8 100644
--- a/core/java/android/app/Instrumentation.java
+++ b/core/java/android/app/Instrumentation.java
@@ -1354,8 +1354,8 @@ public class Instrumentation {
* {@hide}
*/
public ActivityResult execStartActivity(
- Context who, IBinder contextThread, IBinder token, Activity target,
- Intent intent, int requestCode) {
+ Context who, IBinder contextThread, IBinder token, Activity target,
+ Intent intent, int requestCode) {
IApplicationThread whoThread = (IApplicationThread) contextThread;
if (mActivityMonitors != null) {
synchronized (mSync) {
@@ -1386,6 +1386,44 @@ public class Instrumentation {
/**
* Like {@link #execStartActivity(Context, IBinder, IBinder, Activity, Intent, int)},
+ * but accepts an array of activities to be started. Note that active
+ * {@link ActivityMonitor} objects only match against the first activity in
+ * the array.
+ *
+ * {@hide}
+ */
+ public void execStartActivities(Context who, IBinder contextThread,
+ IBinder token, Activity target, Intent[] intents) {
+ IApplicationThread whoThread = (IApplicationThread) contextThread;
+ if (mActivityMonitors != null) {
+ synchronized (mSync) {
+ final int N = mActivityMonitors.size();
+ for (int i=0; i<N; i++) {
+ final ActivityMonitor am = mActivityMonitors.get(i);
+ if (am.match(who, null, intents[0])) {
+ am.mHits++;
+ if (am.isBlocking()) {
+ return;
+ }
+ break;
+ }
+ }
+ }
+ }
+ try {
+ String[] resolvedTypes = new String[intents.length];
+ for (int i=0; i<intents.length; i++) {
+ resolvedTypes[i] = intents[i].resolveTypeIfNeeded(who.getContentResolver());
+ }
+ int result = ActivityManagerNative.getDefault()
+ .startActivities(whoThread, intents, resolvedTypes, token);
+ checkStartActivityResult(result, intents[0]);
+ } catch (RemoteException e) {
+ }
+ }
+
+ /**
+ * Like {@link #execStartActivity(Context, IBinder, IBinder, Activity, Intent, int)},
* but for calls from a {#link Fragment}.
*
* @param who The Context from which the activity is being started.