Add task affiliation
Introduces new flag Intent.FLAG_ACTIVITY_LAUNCH_BEHIND which
causes the newly launched task to affiliate with the launching task.
(Later this flag will also launch the task behind the current task).
This shows up in a new member of the RecentTaskInfo class. This also
causes the recents list returned by getRecentsInfo to be rearranged
so that affiliated tasks are together.
Fixes bug 16157517.
Change-Id: Ia1386af50da2f01809278b62d249f05c6a0de951
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 3cf8f9a..e1d0b86 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -696,6 +696,12 @@
*/
public TaskDescription taskDescription;
+ /**
+ * Task affiliation for grouping with other tasks.
+ * @hide
+ */
+ public int affiliatedTaskId;
+
public RecentTaskInfo() {
}
@@ -727,6 +733,7 @@
dest.writeInt(userId);
dest.writeLong(firstActiveTime);
dest.writeLong(lastActiveTime);
+ dest.writeInt(affiliatedTaskId);
}
public void readFromParcel(Parcel source) {
@@ -741,6 +748,7 @@
userId = source.readInt();
firstActiveTime = source.readLong();
lastActiveTime = source.readLong();
+ affiliatedTaskId = source.readInt();
}
public static final Creator<RecentTaskInfo> CREATOR
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index e24dc84..4153a02 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -3810,6 +3810,18 @@
*/
public static final int FLAG_ACTIVITY_AUTO_REMOVE_FROM_RECENTS = 0x00002000;
/**
+ * If set along with FLAG_ACTIVITY_NEW_DOCUMENT then the task being launched will not be
+ * presented to the user but will instead be only available through the recents task list.
+ * In addition, the new task wil be affiliated with the launching activity's task.
+ * Affiliated tasks are grouped together in the recents task list.
+ *
+ * <p>This behavior is not supported for activities with {@link
+ * android.R.styleable#AndroidManifestActivity_launchMode launchMode} values of
+ * <code>singleInstance</code> or <code>singleTask</code>.
+ */
+ public static final int FLAG_ACTIVITY_LAUNCH_BEHIND = 0x00001000;
+
+ /**
* If set, when sending a broadcast only registered receivers will be
* called -- no BroadcastReceiver components will be launched.
*/