Update bubble a11y nav order in bubble bar

When swiping left, a11y focus should move to the bubble shown on left.
Same for swiping right. This should happen regardless of the side bubble
bar is placed on.

Bubble views get added to the container based on recency. The most
recent bubble is placed as child at index 0.
For example if we have bubbles (1)(2)(3)(+) and (1) is the most recent,
then the child index for (1) is 0. This is always the same, regardless
of bubble bar location.

Bubble bar location does affect how bubbles appear on screen. If the bar
is on the left, most recent bubble is shown on the right.
The on screen order for the above bubbles would be: (+)(3)(2)(1).
If the same bubble bar is on the right, bubble order would be:
(1)(2)(3)(+).

For a11y navigation we want to follow the order that bubbles are shown
on the screen. Default navigation order follows how the child views are
added to the parent container. For bubbles the child view order may not
match what is shown on screen. Due to this, we override the default
navigation order. And set up the previous and next elements to navigate
to based on bubble bar location and bubble order.

Bug: 344674605
Flag: com.android.wm.shell.enable_bubble_bar
Test: have bubble bar expanded on the right, swipe left and check that
  bubble on the left is selected, swipe right and check that bubble on
  the right is selected
Test: have bubble bar expanded on the left, swipe left and check that
  bubble on the left is selected, swipe right and check that bubble on
  the right is selected
Change-Id: Iae63ac13d5477883952b836f6872e4c7c7fb88c1
1 file changed