Merge "Improve launcher tracing around unfold animation" into tm-qpr-dev
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index d339d28..0d8391b 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -304,7 +304,7 @@
<dimen name="taskbar_nav_threshold_v2">30dp</dimen>
<dimen name="taskbar_app_window_threshold_v2">100dp</dimen>
- <dimen name="taskbar_home_overview_threshold_v2">200dp</dimen>
+ <dimen name="taskbar_home_overview_threshold_v2">180dp</dimen>
<!-- Taskbar 3 button spacing -->
<dimen name="taskbar_button_space_inbetween">24dp</dimen>
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
index b680a15..87fa6f3 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
@@ -31,6 +31,7 @@
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
+import com.android.quickstep.views.TaskView.TaskIdAttributeContainer;
import com.android.systemui.shared.recents.model.Task;
import java.io.PrintWriter;
@@ -202,12 +203,16 @@
// null checks as much. See comments at ag/21152798.
if (foundTaskView != null) {
// There is already a running app of this type, use that as second app.
+ // Get index of task (0 or 1), in case it's a GroupedTaskView
+ int indexOfTask = foundTaskView.getIndexOfTask(foundTask.key.id);
+ TaskIdAttributeContainer taskAttributes =
+ foundTaskView.getTaskIdAttributeContainers()[indexOfTask];
recents.confirmSplitSelect(
foundTaskView,
- foundTaskView.getTask(),
- foundTaskView.getIconView().getDrawable(),
- foundTaskView.getThumbnail(),
- foundTaskView.getThumbnail().getThumbnail(),
+ taskAttributes.getTask(),
+ taskAttributes.getIconView().getDrawable(),
+ taskAttributes.getThumbnailView(),
+ taskAttributes.getThumbnailView().getThumbnail(),
null /* intent */);
return;
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
index db584d8..38351a9 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
@@ -47,6 +47,7 @@
import com.android.launcher3.util.LauncherBindableItemsContainer;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.DoubleShadowBubbleTextView;
+import com.android.launcher3.views.IconButtonView;
import java.util.function.Predicate;
@@ -80,7 +81,7 @@
private @Nullable FolderIcon mLeaveBehindFolderIcon;
// Only non-null when device supports having an All Apps button.
- private @Nullable View mAllAppsButton;
+ private @Nullable IconButtonView mAllAppsButton;
// Only non-null when device supports having an All Apps button.
private @Nullable View mTaskbarDivider;
@@ -125,10 +126,14 @@
if (FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get()
&& !mActivityContext.getPackageManager().hasSystemFeature(FEATURE_PC)) {
- mAllAppsButton = LayoutInflater.from(context)
+ mAllAppsButton = (IconButtonView) LayoutInflater.from(context)
.inflate(R.layout.taskbar_all_apps_button, this, false);
mAllAppsButton.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding);
mAllAppsButton.setScaleX(mIsRtl ? -1 : 1);
+ mAllAppsButton.setForegroundTint(mActivityContext.getColor(
+ DisplayController.isTransientTaskbar(mActivityContext)
+ ? R.color.all_apps_button_color
+ : R.color.all_apps_button_color_dark));
if (FeatureFlags.ENABLE_TASKBAR_PINNING.get()) {
mTaskbarDivider = LayoutInflater.from(context).inflate(R.layout.taskbar_divider,
diff --git a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java
index e0262d0..0389d07 100644
--- a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java
+++ b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java
@@ -240,6 +240,7 @@
maybeResumeOrPauseBackgroundAnimation();
if (mSwipeProgress.value >= 1) {
finishAndRemoveTask();
+ dispatchLauncherAnimStartEnd();
}
}
@@ -251,6 +252,18 @@
}
}
+ /**
+ * Should be called when we have successfully reached Launcher, so we dispatch to animation
+ * listeners to ensure the state matches the visual animation that just occurred.
+ */
+ private void dispatchLauncherAnimStartEnd() {
+ if (mLauncherStartAnim != null) {
+ mLauncherStartAnim.dispatchOnStart();
+ mLauncherStartAnim.dispatchOnEnd();
+ mLauncherStartAnim = null;
+ }
+ }
+
@Override
protected void onDestroy() {
super.onDestroy();
@@ -259,6 +272,7 @@
if (mBackgroundAnimatorListener != null) {
mAnimatedBackground.removeAnimatorListener(mBackgroundAnimatorListener);
}
+ dispatchLauncherAnimStartEnd();
}
private AnimatedFloat createSwipeUpProxy(GestureState state) {
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index aa37fdd..b23c873 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -600,6 +600,19 @@
return mTaskIdContainer[1] != -1;
}
+ /**
+ * Finds the index of a given taskId within this TaskView, or -1 if the TaskView does not
+ * contain it. For grouped tasks (of two), this is 0 or 1; for solo tasks, it is 0.
+ */
+ public int getIndexOfTask(int taskId) {
+ for (int i = 0; i < mTaskIdContainer.length; i++) {
+ if (mTaskIdContainer[i] == taskId) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
public TaskThumbnailView getThumbnail() {
return mSnapshotView;
}
diff --git a/res/values-night-v31/colors.xml b/res/values-night-v31/colors.xml
index 54d6d88..2c1bc90 100644
--- a/res/values-night-v31/colors.xml
+++ b/res/values-night-v31/colors.xml
@@ -24,6 +24,4 @@
<color name="home_settings_thumb_off_color">@android:color/system_neutral2_300</color>
<color name="home_settings_track_on_color">@android:color/system_accent2_700</color>
<color name="home_settings_track_off_color">@android:color/system_neutral1_700</color>
-
- <color name="all_apps_button_color">?android:attr/textColorSecondary</color>
</resources>
\ No newline at end of file
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index 17fe419..4ba77fa 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -17,5 +17,5 @@
-->
<resources>
- <color name="all_apps_button_color">#BFC8CC</color>
+ <color name="all_apps_button_color">@color/all_apps_button_color_dark</color>
</resources>
\ No newline at end of file
diff --git a/res/values-v31/colors.xml b/res/values-v31/colors.xml
index cf4f000..63a5454 100644
--- a/res/values-v31/colors.xml
+++ b/res/values-v31/colors.xml
@@ -62,5 +62,6 @@
<color name="preload_icon_accent_color_dark">@android:color/system_accent1_300</color>
<color name="preload_icon_background_color_dark">@android:color/system_neutral2_700</color>
- <color name="all_apps_button_color">?android:attr/textColorSecondary</color>
+ <color name="all_apps_button_color_light">@android:color/system_neutral2_700</color>
+ <color name="all_apps_button_color_dark">@android:color/system_neutral2_200</color>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 9d6927b..ef7bf91 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -80,7 +80,9 @@
<color name="workspace_accent_color_light">#ff8df5e3</color>
<color name="workspace_accent_color_dark">#ff3d665f</color>
- <color name="all_apps_button_color">#40484B</color>
+ <color name="all_apps_button_color">@color/all_apps_button_color_light</color>
+ <color name="all_apps_button_color_light">#40484B</color>
+ <color name="all_apps_button_color_dark">#BFC8CC</color>
<color name="preload_icon_accent_color_light">#00668B</color>
<color name="preload_icon_background_color_light">#B5CAD7</color>
diff --git a/src/com/android/launcher3/views/IconButtonView.java b/src/com/android/launcher3/views/IconButtonView.java
index dd48c99..64e9327 100644
--- a/src/com/android/launcher3/views/IconButtonView.java
+++ b/src/com/android/launcher3/views/IconButtonView.java
@@ -30,6 +30,8 @@
import android.os.Build;
import android.util.AttributeSet;
+import androidx.annotation.ColorInt;
+
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.icons.BaseIconFactory;
import com.android.launcher3.icons.FastBitmapDrawable;
@@ -68,6 +70,14 @@
}
}
+ /** Updates the color of the icon's foreground layer. */
+ public void setForegroundTint(@ColorInt int tintColor) {
+ FastBitmapDrawable icon = getIcon();
+ if (icon instanceof IconDrawable) {
+ ((IconDrawable) icon).mFg.setTint(tintColor);
+ }
+ }
+
private static class IconDrawable extends FastBitmapDrawable {
private final Drawable mFg;
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index e1a2c1b..4b04c7e 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -124,6 +124,7 @@
}
@Test
+ @ScreenRecord
public void testPressHomeOnAllAppsContextMenu() throws Exception {
final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();