Polish the keyboard quick switch view and border animation colors

Flag: ENABLE_KEYBOARD_QUICK_SWITCH
Bug: 276336349
Test: keyboard quick switched on tablet and handheld
Change-Id: I2c21737db3fc4c332ffef9098e8d05d998cf3c39
diff --git a/quickstep/res/color-night/quick_switch_view_background.xml b/quickstep/res/color-night/quick_switch_view_background.xml
new file mode 100644
index 0000000..7280918
--- /dev/null
+++ b/quickstep/res/color-night/quick_switch_view_background.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 The Android Open Source Project
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+          http://www.apache.org/licenses/LICENSE-2.0
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:color="@android:color/system_neutral2_500"
+        android:lStar="80"/>
+</selector>
diff --git a/quickstep/res/color/quick_switch_view_background.xml b/quickstep/res/color/quick_switch_view_background.xml
new file mode 100644
index 0000000..0eb2a6b
--- /dev/null
+++ b/quickstep/res/color/quick_switch_view_background.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 The Android Open Source Project
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+          http://www.apache.org/licenses/LICENSE-2.0
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:color="@android:color/system_neutral2_500"
+        android:lStar="35"/>
+</selector>
diff --git a/quickstep/res/drawable/keyboard_quick_switch_overview_button_background.xml b/quickstep/res/drawable/keyboard_quick_switch_overview_button_background.xml
index 15843af..2a4f087 100644
--- a/quickstep/res/drawable/keyboard_quick_switch_overview_button_background.xml
+++ b/quickstep/res/drawable/keyboard_quick_switch_overview_button_background.xml
@@ -17,6 +17,6 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
     android:shape="rectangle">
-    <solid android:color="?androidprv:attr/materialColorSurfaceContainerHigh" />
+    <solid android:color="?androidprv:attr/materialColorSurfaceBright" />
     <corners android:radius="@dimen/keyboard_quick_switch_task_view_radius" />
 </shape>
diff --git a/quickstep/res/drawable/keyboard_quick_switch_view_background.xml b/quickstep/res/drawable/keyboard_quick_switch_view_background.xml
index 19aaed4..573c93a 100644
--- a/quickstep/res/drawable/keyboard_quick_switch_view_background.xml
+++ b/quickstep/res/drawable/keyboard_quick_switch_view_background.xml
@@ -16,6 +16,6 @@
 <shape
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
-    <solid android:color="?attr/overviewScrimColor" />
+    <solid android:color="@color/quick_switch_view_background" />
     <corners android:radius="@dimen/keyboard_quick_switch_view_radius" />
 </shape>
diff --git a/quickstep/res/layout-land/keyboard_quick_switch_taskview.xml b/quickstep/res/layout-land/keyboard_quick_switch_taskview.xml
index 174a704..ebcbdcd 100644
--- a/quickstep/res/layout-land/keyboard_quick_switch_taskview.xml
+++ b/quickstep/res/layout-land/keyboard_quick_switch_taskview.xml
@@ -23,7 +23,7 @@
     android:importantForAccessibility="yes"
     android:background="@drawable/keyboard_quick_switch_task_view_background"
     android:clipToOutline="true"
-    launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer">
+    launcher:borderColor="?androidprv:attr/materialColorOutline">
 
     <include
         layout="@layout/keyboard_quick_switch_thumbnail"
diff --git a/quickstep/res/layout/keyboard_quick_switch_overview.xml b/quickstep/res/layout/keyboard_quick_switch_overview.xml
index 7b34710..8c97c68 100644
--- a/quickstep/res/layout/keyboard_quick_switch_overview.xml
+++ b/quickstep/res/layout/keyboard_quick_switch_overview.xml
@@ -23,7 +23,7 @@
     android:background="@drawable/keyboard_quick_switch_overview_button_background"
     android:clipToOutline="true"
     android:importantForAccessibility="yes"
-    launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer">
+    launcher:borderColor="?androidprv:attr/materialColorOutline">
 
     <ImageView
         android:id="@+id/icon"
@@ -32,7 +32,7 @@
         android:layout_marginBottom="8dp"
         android:src="@drawable/ic_empty_recents"
 
-        app:tint="?android:attr/textColorPrimary"
+        app:tint="?androidprv:attr/materialColorOnSurface"
         app:layout_constraintVertical_chainStyle="packed"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toTopOf="@id/text"
diff --git a/quickstep/res/layout/keyboard_quick_switch_taskview.xml b/quickstep/res/layout/keyboard_quick_switch_taskview.xml
index 15b12dc..5e2d52a 100644
--- a/quickstep/res/layout/keyboard_quick_switch_taskview.xml
+++ b/quickstep/res/layout/keyboard_quick_switch_taskview.xml
@@ -23,7 +23,7 @@
     android:importantForAccessibility="yes"
     android:background="@drawable/keyboard_quick_switch_task_view_background"
     android:clipToOutline="true"
-    launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer">
+    launcher:borderColor="?androidprv:attr/materialColorOutline">
 
         <include
             layout="@layout/keyboard_quick_switch_thumbnail"
diff --git a/quickstep/res/layout/task.xml b/quickstep/res/layout/task.xml
index faafec7..e981730 100644
--- a/quickstep/res/layout/task.xml
+++ b/quickstep/res/layout/task.xml
@@ -24,7 +24,7 @@
     android:clipChildren="false"
     android:defaultFocusHighlightEnabled="false"
     android:focusable="true"
-    launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer">
+    launcher:borderColor="?androidprv:attr/materialColorOutline">
 
     <com.android.quickstep.views.TaskThumbnailView
         android:id="@+id/snapshot"
diff --git a/quickstep/res/layout/task_desktop.xml b/quickstep/res/layout/task_desktop.xml
index ccd2592..fd82c66 100644
--- a/quickstep/res/layout/task_desktop.xml
+++ b/quickstep/res/layout/task_desktop.xml
@@ -25,7 +25,7 @@
     android:clipToOutline="true"
     android:defaultFocusHighlightEnabled="false"
     android:focusable="true"
-    launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer">
+    launcher:borderColor="?androidprv:attr/materialColorOutline">
 
     <View
         android:id="@+id/background"
diff --git a/quickstep/res/layout/task_grouped.xml b/quickstep/res/layout/task_grouped.xml
index 66da6c5..65febba 100644
--- a/quickstep/res/layout/task_grouped.xml
+++ b/quickstep/res/layout/task_grouped.xml
@@ -29,7 +29,7 @@
     android:clipChildren="false"
     android:defaultFocusHighlightEnabled="false"
     android:focusable="true"
-    launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer">
+    launcher:borderColor="?androidprv:attr/materialColorOutline">
 
     <com.android.quickstep.views.TaskThumbnailView
         android:id="@+id/snapshot"
diff --git a/quickstep/res/values/styles.xml b/quickstep/res/values/styles.xml
index 8eea37f..f795b19 100644
--- a/quickstep/res/values/styles.xml
+++ b/quickstep/res/values/styles.xml
@@ -14,7 +14,8 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<resources>
+<resources
+    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
 
     <style name="TextAppearance.GestureTutorial"
         parent="android:TextAppearance.Material.Body1" />
@@ -234,7 +235,7 @@
     <style name="KeyboardQuickSwitchOverview">
         <item name="fontFamily">google-sans-text</item>
         <item name="android:textSize">14sp</item>
-        <item name="android:textColor">?android:attr/textColorPrimary</item>
+        <item name="android:textColor">?androidprv:attr/materialColorOnSurface</item>
         <item name="lineHeight">20sp</item>
     </style>
 
diff --git a/quickstep/src/com/android/quickstep/util/BorderAnimator.java b/quickstep/src/com/android/quickstep/util/BorderAnimator.java
index 1f1c15b..c30661c 100644
--- a/quickstep/src/com/android/quickstep/util/BorderAnimator.java
+++ b/quickstep/src/com/android/quickstep/util/BorderAnimator.java
@@ -26,7 +26,6 @@
 import androidx.annotation.NonNull;
 import androidx.annotation.Px;
 
-import com.android.launcher3.Utilities;
 import com.android.launcher3.anim.AnimatedFloat;
 import com.android.launcher3.anim.AnimatorListeners;
 import com.android.launcher3.anim.Interpolators;
@@ -61,7 +60,7 @@
     @NonNull private final Interpolator mInterpolator;
     @NonNull private final Paint mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
 
-    private int mAlignmentAdjustment;
+    private float mAlignmentAdjustment;
 
     @Nullable private Animator mRunningBorderAnimation;
 
@@ -106,16 +105,12 @@
     private void updateOutline() {
         float interpolatedProgress = mInterpolator.getInterpolation(
                 mBorderAnimationProgress.value);
-        mAlignmentAdjustment = (int) Utilities.mapBoundToRange(
-                mBorderAnimationProgress.value,
-                /* lowerBound= */ 0f,
-                /* upperBound= */ 1f,
-                /* toMin= */ 0f,
-                /* toMax= */ (float) (mBorderWidthPx / 2f),
-                mInterpolator);
+        float borderWidth = mBorderWidthPx * interpolatedProgress;
+        // Inset the border by half the width to create an inwards-growth animation
+        mAlignmentAdjustment = borderWidth / 2f;
 
         mBorderPaint.setAlpha(Math.round(255 * interpolatedProgress));
-        mBorderPaint.setStrokeWidth(Math.round(mBorderWidthPx * interpolatedProgress));
+        mBorderPaint.setStrokeWidth(borderWidth);
         mInvalidateViewCallback.run();
     }