From dfed7c8338ce178bdcec984cbb38556e90c3c018 Mon Sep 17 00:00:00 2001 From: Toni Barzic Date: Wed, 20 Nov 2024 01:34:49 +0000 Subject: [PATCH] Handle edge case where overflow icon is overflowing In certain situations, space in taskbar may be restricted so even the overflow icon for running apps is technically overflowing available space (i.e. not fully within intended margins). In such cases the overflow icon was not rendered, as the size of the overflown icons was larger than the number of running app icons, so the list of icons for overflow icon was never fully initialized. Handle this case by capping the number of items to add to overflow icon to the number of available running apps. Bug: 379774843 Test: Enable three button navigation, increase the display scaling (to effectively reduce available space), and enter desktop session in portrait orientation. Verify the taskbar overflow icon shows up. Flag: com.android.launcher3.taskbar_overflow Change-Id: I06371637d1b01e99eaf30aec98ae0920aa248652 --- quickstep/src/com/android/launcher3/taskbar/TaskbarView.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 8816a6dd00..0fccd2b9b0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -473,8 +473,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar boolean supportsOverflow = Flags.taskbarOverflow(); int overflowSize = 0; + int numberOfSupportedRecents = 0; if (supportsOverflow) { - int numberOfSupportedRecents = 0; for (GroupTask task : recentTasks) { // TODO(b/343289567 and b/316004172): support app pairs and desktop mode. if (!task.supportsMultipleTasks()) { @@ -495,7 +495,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar List overflownTasks = null; // An extra item needs to be added to overflow button to account for the space taken up by // the overflow button. - final int itemsToAddToOverflow = overflowSize > 0 ? overflowSize + 1 : 0; + final int itemsToAddToOverflow = + (overflowSize > 0) ? Math.min(overflowSize + 1, numberOfSupportedRecents) : 0; if (overflowSize > 0) { overflownTasks = new ArrayList(itemsToAddToOverflow); }