summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/ActivityManager.java9
-rw-r--r--core/res/res/anim/launch_task_behind_source.xml8
-rw-r--r--packages/SystemUI/res/layout/recents_task_view.xml6
-rw-r--r--packages/SystemUI/res/values/dimens.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/Task.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java27
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskViewFooter.java (renamed from packages/SystemUI/src/com/android/systemui/recents/views/TaskFooterView.java)10
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java (renamed from packages/SystemUI/src/com/android/systemui/recents/views/TaskBarView.java)11
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java (renamed from packages/SystemUI/src/com/android/systemui/recents/views/TaskThumbnailView.java)10
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityManagerService.java1
-rw-r--r--services/core/java/com/android/server/am/TaskRecord.java20
15 files changed, 107 insertions, 50 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index fc200550..3bf8e2e 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -700,6 +700,13 @@ public class ActivityManager {
*/
public int affiliatedTaskId;
+ /**
+ * Task affiliation color of the source task with the affiliated task id.
+ *
+ * @hide
+ */
+ public int affiliatedTaskColor;
+
public RecentTaskInfo() {
}
@@ -732,6 +739,7 @@ public class ActivityManager {
dest.writeLong(firstActiveTime);
dest.writeLong(lastActiveTime);
dest.writeInt(affiliatedTaskId);
+ dest.writeInt(affiliatedTaskColor);
}
public void readFromParcel(Parcel source) {
@@ -747,6 +755,7 @@ public class ActivityManager {
firstActiveTime = source.readLong();
lastActiveTime = source.readLong();
affiliatedTaskId = source.readInt();
+ affiliatedTaskColor = source.readInt();
}
public static final Creator<RecentTaskInfo> CREATOR
diff --git a/core/res/res/anim/launch_task_behind_source.xml b/core/res/res/anim/launch_task_behind_source.xml
index 426ee5d..cd3e30a 100644
--- a/core/res/res/anim/launch_task_behind_source.xml
+++ b/core/res/res/anim/launch_task_behind_source.xml
@@ -37,20 +37,20 @@
android:interpolator="@interpolator/fast_out_slow_in"
android:duration="350" />
- <alpha android:fromAlpha="1.0" android:toAlpha="1.6"
+ <alpha android:fromAlpha="1.0" android:toAlpha="1.6666666666"
android:fillEnabled="true" android:fillBefore="false" android:fillAfter="true"
android:interpolator="@interpolator/decelerate_cubic"
android:startOffset="433"
android:duration="133"/>
- <translate android:fromYDelta="0%" android:toYDelta="-10%"
+ <translate android:fromYDelta="0%" android:toYDelta="-8.8888888888%"
android:fillEnabled="true" android:fillBefore="false" android:fillAfter="true"
android:interpolator="@interpolator/decelerate_cubic"
android:startOffset="433"
android:duration="350"/>
- <scale android:fromXScale="1.0" android:toXScale="1.1"
- android:fromYScale="1.0" android:toYScale="1.1"
+ <scale android:fromXScale="1.0" android:toXScale="1.1111111111"
+ android:fromYScale="1.0" android:toYScale="1.1111111111"
android:fillEnabled="true" android:fillBefore="false" android:fillAfter="true"
android:pivotX="50%p" android:pivotY="50%p"
android:interpolator="@interpolator/decelerate_cubic"
diff --git a/packages/SystemUI/res/layout/recents_task_view.xml b/packages/SystemUI/res/layout/recents_task_view.xml
index f8dfd65..4a5fffe 100644
--- a/packages/SystemUI/res/layout/recents_task_view.xml
+++ b/packages/SystemUI/res/layout/recents_task_view.xml
@@ -18,11 +18,11 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true">
- <com.android.systemui.recents.views.TaskThumbnailView
+ <com.android.systemui.recents.views.TaskViewThumbnail
android:id="@+id/task_view_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent" />
- <com.android.systemui.recents.views.TaskBarView
+ <com.android.systemui.recents.views.TaskViewHeader
android:id="@+id/task_view_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/recents_task_bar_height"
@@ -61,7 +61,7 @@
android:background="@drawable/recents_button_bg"
android:visibility="invisible"
android:src="@drawable/recents_dismiss_light" />
- </com.android.systemui.recents.views.TaskBarView>
+ </com.android.systemui.recents.views.TaskViewHeader>
<FrameLayout
android:id="@+id/lock_to_app_fab"
android:layout_width="48dp"
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 11a8063..4a4fa41 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -237,6 +237,9 @@
in dps over one second of time. -->
<dimen name="recents_animation_movement_in_dps_per_second">800dp</dimen>
+ <!-- The min alpha to apply to a task affiliation group color. -->
+ <item name="recents_task_affiliation_color_min_alpha_percentage" format="float" type="dimen">0.6</item>
+
<!-- Space reserved for the cards behind the top card in the top stack -->
<dimen name="top_stack_peek_amount">12dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
index cf0a1dc..980a4ae 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
@@ -86,6 +86,7 @@ public class RecentsConfiguration {
public int taskBarViewLightTextColor;
public int taskBarViewDarkTextColor;
public int taskBarViewHighlightColor;
+ public float taskBarViewAffiliationColorMinAlpha;
/** Task bar size & animations */
public int taskBarHeight;
@@ -221,6 +222,9 @@ public class RecentsConfiguration {
res.getColor(R.color.recents_task_bar_dark_text_color);
taskBarViewHighlightColor =
res.getColor(R.color.recents_task_bar_highlight_color);
+ TypedValue affMinAlphaPctValue = new TypedValue();
+ res.getValue(R.dimen.recents_task_affiliation_color_min_alpha_percentage, affMinAlphaPctValue, true);
+ taskBarViewAffiliationColorMinAlpha = affMinAlphaPctValue.getFloat();
// Task bar size & animations
taskBarHeight = res.getDimensionPixelSize(R.dimen.recents_task_bar_height);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
index f30e22a..8716184 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
@@ -339,8 +339,9 @@ public class RecentsTaskLoader {
// Create a new task
Task task = new Task(t.persistentId, (t.id > -1), t.baseIntent, t.affiliatedTaskId,
- activityLabel, activityIcon, activityColor, t.userId, t.firstActiveTime,
- t.lastActiveTime, (i == (taskCount - 1)), config.lockToAppEnabled);
+ t.affiliatedTaskColor, activityLabel, activityIcon, activityColor, t.userId,
+ t.firstActiveTime, t.lastActiveTime, (i == (taskCount - 1)),
+ config.lockToAppEnabled);
// Preload the specified number of apps
if (i >= (taskCount - preloadCount)) {
@@ -381,7 +382,7 @@ public class RecentsTaskLoader {
}
// Simulate the groupings that we describe
- stack.createAffiliatedGroupings();
+ stack.createAffiliatedGroupings(config);
// Start the task loader and add all the tasks we need to load
mLoader.start(context);
@@ -405,11 +406,11 @@ public class RecentsTaskLoader {
ActivityInfo info = ssp.getActivityInfo(t.baseIntent.getComponent(), t.userId);
if (info == null) continue;
- stack.addTask(new Task(t.persistentId, true, t.baseIntent, t.affiliatedTaskId, null,
- null, 0, 0, t.firstActiveTime, t.lastActiveTime, (i == (taskCount - 1)),
- config.lockToAppEnabled));
+ stack.addTask(new Task(t.persistentId, true, t.baseIntent, t.affiliatedTaskId,
+ t.affiliatedTaskColor, null, null, 0, 0, t.firstActiveTime, t.lastActiveTime,
+ (i == (taskCount - 1)), config.lockToAppEnabled));
}
- stack.createAffiliatedGroupings();
+ stack.createAffiliatedGroupings(config);
return stack;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
index 41874fc..f6c3a7e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
@@ -77,6 +77,7 @@ public class Task {
public TaskKey key;
public TaskGrouping group;
public int taskAffiliation;
+ public int taskAffiliationColor;
public boolean isLaunchTarget;
public Drawable applicationIcon;
public Drawable activityIcon;
@@ -95,16 +96,19 @@ public class Task {
// Only used by RecentsService for task rect calculations.
}
- public Task(int id, boolean isActive, Intent intent, int taskAffiliation, String activityTitle,
- Drawable activityIcon, int colorPrimary, int userId,
+ public Task(int id, boolean isActive, Intent intent, int taskAffiliation, int taskAffiliationColor,
+ String activityTitle, Drawable activityIcon, int colorPrimary, int userId,
long firstActiveTime, long lastActiveTime, boolean lockToThisTask,
boolean lockToTaskEnabled) {
+ boolean isInAffiliationGroup = (taskAffiliation != id);
+ boolean hasAffiliationGroupColor = isInAffiliationGroup && (taskAffiliationColor != 0);
this.key = new TaskKey(id, intent, userId, firstActiveTime, lastActiveTime);
this.taskAffiliation = taskAffiliation;
+ this.taskAffiliationColor = taskAffiliationColor;
this.activityLabel = activityTitle;
this.activityIcon = activityIcon;
- this.colorPrimary = colorPrimary;
- this.useLightOnPrimaryColor = Utilities.computeContrastBetweenColors(colorPrimary,
+ this.colorPrimary = hasAffiliationGroupColor ? taskAffiliationColor : colorPrimary;
+ this.useLightOnPrimaryColor = Utilities.computeContrastBetweenColors(this.colorPrimary,
Color.WHITE) > 3f;
this.isActive = isActive;
this.lockToThisTask = lockToTaskEnabled && lockToThisTask;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
index fd6303f..435eb42 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
@@ -16,7 +16,9 @@
package com.android.systemui.recents.model;
+import android.graphics.Color;
import com.android.systemui.recents.Constants;
+import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.misc.NamedCounter;
import java.util.ArrayList;
@@ -320,7 +322,7 @@ public class TaskStack {
/**
* Temporary: This method will simulate affiliation groups by
*/
- public void createAffiliatedGroupings() {
+ public void createAffiliatedGroupings(RecentsConfiguration config) {
if (Constants.DebugFlags.App.EnableSimulatedTaskGroups) {
HashMap<Task.TaskKey, Task> taskMap = new HashMap<Task.TaskKey, Task>();
// Sort all tasks by increasing firstActiveTime of the task
@@ -387,6 +389,7 @@ public class TaskStack {
mTaskList.set(tasks);
} else {
// Create the task groups
+ HashMap<Task.TaskKey, Task> tasksMap = new HashMap<Task.TaskKey, Task>();
ArrayList<Task> tasks = mTaskList.getTasks();
int taskCount = tasks.size();
for (int i = 0; i < taskCount; i++) {
@@ -401,6 +404,28 @@ public class TaskStack {
addGroup(group);
}
group.addTask(t);
+ tasksMap.put(t.key, t);
+ }
+ // Update the task colors for each of the groups
+ float minAlpha = config.taskBarViewAffiliationColorMinAlpha;
+ int taskGroupCount = mGroups.size();
+ for (int i = 0; i < taskGroupCount; i++) {
+ TaskGrouping group = mGroups.get(i);
+ taskCount = group.getTaskCount();
+ // Ignore the groups that only have one task
+ if (taskCount <= 1) continue;
+ // Calculate the group color distribution
+ int affiliationColor = tasksMap.get(group.mTaskKeys.get(0)).taskAffiliationColor;
+ float alphaStep = (1f - minAlpha) / taskCount;
+ float alpha = 1f;
+ for (int j = 0; j < taskCount; j++) {
+ Task t = tasksMap.get(group.mTaskKeys.get(j));
+ t.colorPrimary = Color.rgb(
+ (int) (alpha * Color.red(affiliationColor) + (1f - alpha) * 0xFF),
+ (int) (alpha * Color.green(affiliationColor) + (1f - alpha) * 0xFF),
+ (int) (alpha * Color.blue(affiliationColor) + (1f - alpha) * 0xFF));
+ alpha -= alphaStep;
+ }
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 57f1274..9e7dbf4 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -330,7 +330,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
// We can reuse the current task transforms to find the task rects
TaskViewTransform transform = mCurrentTaskTransforms.get(mStack.indexOfTask(tv.getTask()));
TaskViewTransform nextTransform = mCurrentTaskTransforms.get(mStack.indexOfTask(nextTv.getTask()));
- clipBottom = transform.rect.bottom - nextTransform.rect.top - 200;
+ clipBottom = transform.rect.bottom - nextTransform.rect.top;
}
}
tv.getViewBounds().setClipBottom(clipBottom);
@@ -430,9 +430,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
public void computeScroll() {
mStackScroller.computeScroll();
// Synchronize the views
- if (synchronizeStackViewsWithModel()) {
- clipTaskViews();
- }
+ synchronizeStackViewsWithModel();
+ clipTaskViews();
}
/** Computes the stack and task rects */
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index abf3c50..3b9bcc4 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -39,7 +39,7 @@ import com.android.systemui.recents.model.Task;
/* A task view */
public class TaskView extends FrameLayout implements Task.TaskCallbacks,
- TaskFooterView.TaskFooterViewCallbacks, View.OnClickListener, View.OnLongClickListener {
+ TaskViewFooter.TaskFooterViewCallbacks, View.OnClickListener, View.OnLongClickListener {
/** The TaskView callbacks */
interface TaskViewCallbacks {
public void onTaskViewAppIconClicked(TaskView tv);
@@ -67,9 +67,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
AnimateableViewBounds mViewBounds;
Paint mLayerPaint = new Paint();
- TaskThumbnailView mThumbnailView;
- TaskBarView mBarView;
- TaskFooterView mFooterView;
+ TaskViewThumbnail mThumbnailView;
+ TaskViewHeader mBarView;
+ TaskViewFooter mFooterView;
View mActionButtonView;
TaskViewCallbacks mCb;
@@ -124,8 +124,8 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
@Override
protected void onFinishInflate() {
// Bind the views
- mBarView = (TaskBarView) findViewById(R.id.task_view_bar);
- mThumbnailView = (TaskThumbnailView) findViewById(R.id.task_view_thumbnail);
+ mBarView = (TaskViewHeader) findViewById(R.id.task_view_bar);
+ mThumbnailView = (TaskViewThumbnail) findViewById(R.id.task_view_thumbnail);
mActionButtonView = findViewById(R.id.lock_to_app_fab);
if (mFooterView != null) {
mFooterView.setCallbacks(this);
@@ -712,7 +712,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
setOnClickListener(enabled ? this : null);
}
- /**** TaskFooterView.TaskFooterViewCallbacks ****/
+ /**** TaskViewFooter.TaskFooterViewCallbacks ****/
@Override
public void onTaskFooterHeightChanged(int height, int maxHeight) {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskFooterView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewFooter.java
index 881bbcf..324169e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskFooterView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewFooter.java
@@ -24,7 +24,7 @@ import com.android.systemui.recents.RecentsConfiguration;
/** The task footer view */
-public class TaskFooterView extends FrameLayout {
+public class TaskViewFooter extends FrameLayout {
interface TaskFooterViewCallbacks {
public void onTaskFooterHeightChanged(int height, int maxHeight);
@@ -37,19 +37,19 @@ public class TaskFooterView extends FrameLayout {
int mMaxFooterHeight;
ObjectAnimator mFooterAnimator;
- public TaskFooterView(Context context) {
+ public TaskViewFooter(Context context) {
this(context, null);
}
- public TaskFooterView(Context context, AttributeSet attrs) {
+ public TaskViewFooter(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
- public TaskFooterView(Context context, AttributeSet attrs, int defStyleAttr) {
+ public TaskViewFooter(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
- public TaskFooterView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ public TaskViewFooter(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
mConfig = RecentsConfiguration.getInstance();
mMaxFooterHeight = mConfig.taskViewLockToAppButtonHeight;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskBarView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
index 90bf12f..03fc16e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
@@ -28,7 +28,6 @@ import android.graphics.drawable.RippleDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewPropertyAnimator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
@@ -39,7 +38,7 @@ import com.android.systemui.recents.model.Task;
/* The task bar view */
-class TaskBarView extends FrameLayout {
+class TaskViewHeader extends FrameLayout {
RecentsConfiguration mConfig;
@@ -54,19 +53,19 @@ class TaskBarView extends FrameLayout {
static Paint sHighlightPaint;
- public TaskBarView(Context context) {
+ public TaskViewHeader(Context context) {
this(context, null);
}
- public TaskBarView(Context context, AttributeSet attrs) {
+ public TaskViewHeader(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
- public TaskBarView(Context context, AttributeSet attrs, int defStyleAttr) {
+ public TaskViewHeader(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
- public TaskBarView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ public TaskViewHeader(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
mConfig = RecentsConfiguration.getInstance();
setWillNotDraw(false);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskThumbnailView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java
index 1116d51..f836aa3 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskThumbnailView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java
@@ -25,24 +25,24 @@ import com.android.systemui.recents.model.Task;
/** The task thumbnail view */
-public class TaskThumbnailView extends FixedSizeImageView {
+public class TaskViewThumbnail extends FixedSizeImageView {
// Task bar clipping
Rect mClipRect = new Rect();
- public TaskThumbnailView(Context context) {
+ public TaskViewThumbnail(Context context) {
this(context, null);
}
- public TaskThumbnailView(Context context, AttributeSet attrs) {
+ public TaskViewThumbnail(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
- public TaskThumbnailView(Context context, AttributeSet attrs, int defStyleAttr) {
+ public TaskViewThumbnail(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
- public TaskThumbnailView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ public TaskViewThumbnail(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
setScaleType(ScaleType.FIT_XY);
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index e0d4aad..fed61b4 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -7471,6 +7471,7 @@ public final class ActivityManagerService extends ActivityManagerNative
rti.firstActiveTime = tr.firstActiveTime;
rti.lastActiveTime = tr.lastActiveTime;
rti.affiliatedTaskId = tr.mAffiliatedTaskId;
+ rti.affiliatedTaskColor = tr.mAffiliatedTaskColor;
return rti;
}
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 4a84941..d0ec106 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -68,6 +68,7 @@ final class TaskRecord {
private static final String ATTR_TASK_AFFILIATION = "task_affiliation";
private static final String ATTR_PREV_AFFILIATION = "prev_affiliation";
private static final String ATTR_NEXT_AFFILIATION = "next_affiliation";
+ private static final String ATTR_TASK_AFFILIATION_COLOR = "task_affiliation_color";
private static final String ATTR_CALLING_UID = "calling_uid";
private static final String ATTR_CALLING_PACKAGE = "calling_package";
private static final String LAST_ACTIVITY_ICON_SUFFIX = "_last_activity_icon_";
@@ -140,6 +141,7 @@ final class TaskRecord {
CharSequence lastDescription; // Last description captured for this item.
int mAffiliatedTaskId; // taskId of parent affiliation or self if no parent.
+ int mAffiliatedTaskColor; // color of the parent task affiliation.
TaskRecord mPrevAffiliate; // previous task in affiliated chain.
int mPrevAffiliateTaskId = -1; // previous id for persistence.
TaskRecord mNextAffiliate; // next task in affiliated chain.
@@ -172,7 +174,8 @@ final class TaskRecord {
String _lastDescription, ArrayList<ActivityRecord> activities, long _firstActiveTime,
long _lastActiveTime, long lastTimeMoved, boolean neverRelinquishIdentity,
ActivityManager.TaskDescription _lastTaskDescription, int taskAffiliation,
- int prevTaskId, int nextTaskId, int callingUid, String callingPackage) {
+ int prevTaskId, int nextTaskId, int taskAffiliationColor, int callingUid,
+ String callingPackage) {
mService = service;
mFilename = String.valueOf(_taskId) + TASK_THUMBNAIL_SUFFIX +
TaskPersister.IMAGE_EXTENSION;
@@ -199,6 +202,7 @@ final class TaskRecord {
mNeverRelinquishIdentity = neverRelinquishIdentity;
lastTaskDescription = _lastTaskDescription;
mAffiliatedTaskId = taskAffiliation;
+ mAffiliatedTaskColor = taskAffiliationColor;
mPrevAffiliateTaskId = prevTaskId;
mNextAffiliateTaskId = nextTaskId;
mCallingUid = callingUid;
@@ -326,6 +330,7 @@ final class TaskRecord {
void setTaskToAffiliateWith(TaskRecord taskToAffiliateWith) {
closeRecentsChain();
mAffiliatedTaskId = taskToAffiliateWith.mAffiliatedTaskId;
+ mAffiliatedTaskColor = taskToAffiliateWith.mAffiliatedTaskColor;
// Find the end
while (taskToAffiliateWith.mNextAffiliate != null) {
final TaskRecord nextRecents = taskToAffiliateWith.mNextAffiliate;
@@ -689,11 +694,14 @@ final class TaskRecord {
}
if (colorPrimary == 0) {
colorPrimary = r.taskDescription.getPrimaryColor();
-
}
}
}
lastTaskDescription = new ActivityManager.TaskDescription(label, icon, colorPrimary);
+ // Update the task affiliation color if we are the parent of the group
+ if (taskId == mAffiliatedTaskId) {
+ mAffiliatedTaskColor = lastTaskDescription.getPrimaryColor();
+ }
}
}
@@ -777,6 +785,7 @@ final class TaskRecord {
saveTaskDescription(lastTaskDescription, String.valueOf(taskId) +
LAST_ACTIVITY_ICON_SUFFIX + lastActiveTime, out);
}
+ out.attribute(null, ATTR_TASK_AFFILIATION_COLOR, String.valueOf(mAffiliatedTaskColor));
out.attribute(null, ATTR_TASK_AFFILIATION, String.valueOf(mAffiliatedTaskId));
out.attribute(null, ATTR_PREV_AFFILIATION, String.valueOf(mPrevAffiliateTaskId));
out.attribute(null, ATTR_NEXT_AFFILIATION, String.valueOf(mNextAffiliateTaskId));
@@ -831,6 +840,7 @@ final class TaskRecord {
final int outerDepth = in.getDepth();
ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription();
int taskAffiliation = -1;
+ int taskAffiliationColor = 0;
int prevTaskId = -1;
int nextTaskId = -1;
int callingUid = -1;
@@ -877,6 +887,8 @@ final class TaskRecord {
prevTaskId = Integer.valueOf(attrValue);
} else if (ATTR_NEXT_AFFILIATION.equals(attrName)) {
nextTaskId = Integer.valueOf(attrValue);
+ } else if (ATTR_TASK_AFFILIATION_COLOR.equals(attrName)) {
+ taskAffiliationColor = Integer.valueOf(attrValue);
} else if (ATTR_CALLING_UID.equals(attrName)) {
callingUid = Integer.valueOf(attrValue);
} else if (ATTR_CALLING_PACKAGE.equals(attrName)) {
@@ -921,8 +933,8 @@ final class TaskRecord {
affinityIntent, affinity, realActivity, origActivity, rootHasReset,
autoRemoveRecents, askedCompatMode, taskType, userId, lastDescription, activities,
firstActiveTime, lastActiveTime, lastTimeOnTop, neverRelinquishIdentity,
- taskDescription, taskAffiliation, prevTaskId, nextTaskId, callingUid,
- callingPackage);
+ taskDescription, taskAffiliation, prevTaskId, nextTaskId, taskAffiliationColor,
+ callingUid, callingPackage);
for (int activityNdx = activities.size() - 1; activityNdx >=0; --activityNdx) {
activities.get(activityNdx).task = task;