Update Taskbar Icon content description to include state description

This cl inlcudes: while user is in desktop mode, we will add state description(active, minimized) of each app icon to it's content description.

Test: Manual
Bug: 397555157
Flag: EXEMPT bugfix
Change-Id: Iaec18e7099108e8b076b76c637a41e29ed837265
This commit is contained in:
Jagrut Desai
2025-02-27 09:34:58 -08:00
parent 865982c634
commit 536097dec2
3 changed files with 40 additions and 2 deletions
@@ -83,6 +83,8 @@ import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.TaskItemInfo;
import com.android.launcher3.taskbar.bubbles.BubbleBarController;
import com.android.launcher3.taskbar.bubbles.BubbleControllers;
import com.android.launcher3.taskbar.customization.TaskbarAllAppsButtonContainer;
import com.android.launcher3.taskbar.customization.TaskbarDividerContainer;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.LauncherBindableItemsContainer;
@@ -735,10 +737,21 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
for (View iconView : getIconViews()) {
if (iconView instanceof BubbleTextView btv) {
btv.updateRunningState(getRunningAppState(btv));
if (shouldUpdateIconContentDescription(btv)) {
btv.setContentDescription(
btv.getContentDescription() + " " + btv.getIconStateDescription());
}
}
}
}
private boolean shouldUpdateIconContentDescription(BubbleTextView btv) {
boolean isInDesktopMode = mControllers.taskbarDesktopModeController.isInDesktopMode();
boolean isAllAppsButton = btv instanceof TaskbarAllAppsButtonContainer;
boolean isDividerButton = btv instanceof TaskbarDividerContainer;
return isInDesktopMode && !isAllAppsButton && !isDividerButton;
}
/**
* @return A set of Task ids of running apps that are pinned in the taskbar.
*/