2D Recents: Slightly darken header to differentiate from thumbnail

Bug: 34771148
Test: Locally on sw600dp device, sent screenshot to UX to confirm
Change-Id: I74282c6ed81d3b48d554f9acf55d4fafca2c73f4
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
index 8d550ac..d34f5c4 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
@@ -646,6 +646,10 @@
                 synchronized (mHeaderBarLock) {
                     if (mHeaderBar.getMeasuredWidth() != taskViewWidth ||
                             mHeaderBar.getMeasuredHeight() != mTaskBarHeight) {
+                        if (mDummyStackView.useGridLayout()) {
+                            mHeaderBar.setShouldDarkenBackgroundColor(true);
+                            mHeaderBar.setNoUserInteractionState();
+                        }
                         mHeaderBar.forceLayout();
                         mHeaderBar.measure(
                                 MeasureSpec.makeMeasureSpec(taskViewWidth, MeasureSpec.EXACTLY),
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 d33a91c..315c3144 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -151,7 +151,7 @@
     @ViewDebug.ExportedProperty(deepExport=true, prefix="thumbnail_")
     protected TaskViewThumbnail mThumbnailView;
     @ViewDebug.ExportedProperty(deepExport=true, prefix="header_")
-    TaskViewHeader mHeaderView;
+    protected TaskViewHeader mHeaderView;
     private View mActionButtonView;
     private View mIncompatibleAppToastView;
     private TaskViewCallbacks mCb;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
index 0777163..dc666e9 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
@@ -91,6 +91,9 @@
             if (mColor != color || Float.compare(mDimAlpha, dimAlpha) != 0) {
                 mColor = color;
                 mDimAlpha = dimAlpha;
+                if (mShouldDarkenBackgroundColor) {
+                    color = getSecondaryColor(color, false /* useLightOverlayColor */);
+                }
                 mBackgroundPaint.setColor(color);
 
                 ColorUtils.colorToHSL(color, mTmpHSL);
@@ -179,6 +182,10 @@
     // Header dim, which is only used when task view hardware layers are not used
     private Paint mDimLayerPaint = new Paint();
 
+    // Whether the background color should be darkened to differentiate from the primary color.
+    // Used in grid layout.
+    private boolean mShouldDarkenBackgroundColor = false;
+
     private CountDownTimer mFocusTimerCountDown;
 
     public TaskViewHeader(Context context) {
@@ -443,6 +450,13 @@
     }
 
     /**
+     * Sets whether the background color should be darkened to differentiate from the primary color.
+     */
+    public void setShouldDarkenBackgroundColor(boolean flag) {
+        mShouldDarkenBackgroundColor = flag;
+    }
+
+    /**
      * Binds the bar view to the task.
      */
     public void bindToTask(Task t, boolean touchExplorationEnabled, boolean disabledInSafeMode) {
@@ -557,7 +571,7 @@
      * Mark this task view that the user does has not interacted with the stack after a certain
      * time.
      */
-    void setNoUserInteractionState() {
+    public void setNoUserInteractionState() {
         mDismissButton.setVisibility(View.VISIBLE);
         mDismissButton.animate().cancel();
         mDismissButton.setAlpha(1f);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/grid/GridTaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/grid/GridTaskView.java
index 6300400..2907276 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/grid/GridTaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/grid/GridTaskView.java
@@ -53,6 +53,7 @@
         mThumbnailView.setOverlayHeaderOnThumbnailActionBar(false);
         mThumbnailView.updateThumbnailScale();
         mThumbnailView.setTranslationY(mHeaderHeight);
+        mHeaderView.setShouldDarkenBackgroundColor(true);
     }
 
     @Override