Adapt TaskbarOverflow tests to check items added overflow view

Adds a step to verify that TaskbarOverflowView items get set to the list
of the least recent tasks. Adds test cases for an edge case where
taskbar hits max number of items event without recent tasks
(b/379774843).
Has a fix for a further edge case where taskbar overflow view could be
created with a single item (in which case we can just show that item
directly).

Bug: 379774843
Flag: com.android.launcher3.taskbar_overflow
Test: atest TaskbarOverflowTest

Change-Id: I004676da3e17f26b8110d14d39589c84a9f384d8
This commit is contained in:
Toni Barzic committed 2024-12-06 19:39:47 +00:00
1 parent 9fdf9efdd2
commit 7bea1821d4
3 files changed
+74 -1

No files matched your search

@@ -35,6 +35,7 @@ import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import androidx.core.graphics.ColorUtils;
import com.android.app.animation.Interpolators;
@@ -315,6 +316,11 @@ public class TaskbarOverflowView extends FrameLayout implements Reorderable {
invalidate();
}
@VisibleForTesting
public List<Integer> getItemIds() {
return mItems.stream().map(task -> task.key.id).toList();
}
/**
* Called when a task is updated. If the task is contained within the view, it's cached value
* gets updated. If the task is shown within the icon, invalidates the view, so the task icon