Add content description to bubble bar and bubbles

Set content description on the bubble bar when it is collapsed. Only
allow focus on the bar itself. In collapsed mode, bubbles in the bar
can't be focused.
Content description for the bar matches what we have in floating mode.
We include the text for the first bubble and then how many bubbles are
there more.

Set content description on bubbles in bubble bar. When bubble bar is
expanded, only the bubbles are focusable.
Bubble content description matches the floating bubbles content
description. Includes the notification title and app name.

Bug: 344670947
Flag: com.android.wm.shell.enable_bubble_bar
Test: enable talkback, focus on bubble bar when it is collapsed, check
  that only bubble bar receives focus
Test: enable talkback and expand bubble bar, check that only the bubbles
  receive focus
Change-Id: Id931f0360b9ebadd01dd16b05b75546fcc4df803
This commit is contained in:
Ats Jenk
2024-06-04 11:55:27 -07:00
parent 1507a2c59e
commit cd4c9d153d
4 changed files with 66 additions and 1 deletions
@@ -21,6 +21,7 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Outline;
import android.graphics.Rect;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@@ -187,6 +188,16 @@ public class BubbleView extends ConstraintLayout {
mAppIcon.setImageBitmap(bubble.getBadge());
mDotColor = bubble.getDotColor();
mDotRenderer = new DotRenderer(mBubbleSize, bubble.getDotPath(), DEFAULT_PATH_SIZE);
String contentDesc = bubble.getInfo().getTitle();
if (TextUtils.isEmpty(contentDesc)) {
contentDesc = getResources().getString(R.string.bubble_bar_bubble_fallback_description);
}
String appName = bubble.getInfo().getAppName();
if (!TextUtils.isEmpty(appName)) {
contentDesc = getResources().getString(R.string.bubble_bar_bubble_description,
contentDesc, appName);
}
setContentDescription(contentDesc);
}
/**