Remove all external usages of GroupTask.task1/2 from Launcher3

See go/refactor-group-task for details. This CL removes all the usages
of `task1` and `task2` from `GroupTask` in Launcher3. Follow-up CLs will
remove it from NexusLauncher and remove the fields altogether.

Bug: 388593902
Test: m
Flag: EXEMPT pure refactor with no behavior change.
Change-Id: I902c8135b3a0aae95acf25267b3bcbf286bd4e7d
This commit is contained in:
Ahmed Fakhry
2025-01-28 02:55:59 +00:00
parent 51a340a3c4
commit b6ecf5889e
16 changed files with 191 additions and 144 deletions
@@ -70,6 +70,7 @@ import com.android.launcher3.util.LauncherBindableItemsContainer;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ActivityContext;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.SingleTask;
import com.android.quickstep.views.TaskViewType;
import com.android.systemui.shared.recents.model.Task;
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
@@ -657,9 +658,10 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
final Set<GroupTask> recentTasksSet = new ArraySet<>(recentTasks);
for (GroupTask task : recentTasks) {
if (mTaskbarOverflowView != null && overflownTasks != null
&& overflownTasks.size() < itemsToAddToOverflow) {
&& overflownTasks.size() < itemsToAddToOverflow
&& task instanceof SingleTask singleTask) {
// TODO(b/343289567 and b/316004172): support app pairs and desktop mode.
overflownTasks.add(task.task1);
overflownTasks.add(singleTask.getTask());
if (overflownTasks.size() == itemsToAddToOverflow) {
mTaskbarOverflowView.setItems(overflownTasks);
}
@@ -733,18 +735,22 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
&& tagClass.isInstance(getChildAt(mNextViewIndex).getTag());
}
/** Binds the GroupTask to the BubbleTextView to be ready to present to the user. */
/** Binds the SingleTask to the BubbleTextView to be ready to present to the user. */
public void applyGroupTaskToBubbleTextView(BubbleTextView btv, GroupTask groupTask) {
// TODO(b/343289567): support app pairs.
Task task1 = groupTask.task1;
if (!(groupTask instanceof SingleTask singleTask)) {
// TODO(b/343289567 and b/316004172): support app pairs and desktop mode.
return;
}
Task task = singleTask.getTask();
// TODO(b/344038728): use FastBitmapDrawable instead of Drawable, to get disabled state
// while dragging.
Drawable taskIcon = groupTask.task1.icon;
Drawable taskIcon = task.icon;
if (taskIcon != null) {
taskIcon = taskIcon.getConstantState().newDrawable().mutate();
}
btv.applyIconAndLabel(taskIcon, task1.titleDescription);
btv.setTag(groupTask);
btv.applyIconAndLabel(taskIcon, task.titleDescription);
btv.setTag(singleTask);
}
/**