Merge "Include bubble bar location in taskbar announcement" into main
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index 63412e9..8bcbb33 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -299,10 +299,16 @@
<string name="taskbar_button_quick_settings">Quick Settings</string>
<!-- Accessibility title for the Taskbar window. [CHAR_LIMIT=NONE] -->
<string name="taskbar_a11y_title">Taskbar</string>
- <!-- Accessibility title for the Taskbar window appeared. [CHAR_LIMIT=NONE] -->
+ <!-- Accessibility title for the Taskbar window appeared. [CHAR_LIMIT=30] -->
<string name="taskbar_a11y_shown_title">Taskbar shown</string>
- <!-- Accessibility title for the Taskbar window being close. [CHAR_LIMIT=NONE] -->
+ <!-- Accessibility title for the Taskbar window appearing together with bubble bar on left. [CHAR_LIMIT=30] -->
+ <string name="taskbar_a11y_shown_with_bubbles_left_title">Taskbar & bubbles left shown</string>
+ <!-- Accessibility title for the Taskbar window appearing together with bubble bar on right. [CHAR_LIMIT=30] -->
+ <string name="taskbar_a11y_shown_with_bubbles_right_title">Taskbar & bubbles right shown</string>
+ <!-- Accessibility title for the Taskbar window being closed. [CHAR_LIMIT=30] -->
<string name="taskbar_a11y_hidden_title">Taskbar hidden</string>
+ <!-- Accessibility title for the Taskbar window being closed together with bubble bar. [CHAR_LIMIT=30] -->
+ <string name="taskbar_a11y_hidden_with_bubbles_title">Taskbar & bubbles hidden</string>
<!-- Accessibility title for the Taskbar window on phones. [CHAR_LIMIT=NONE] -->
<string name="taskbar_phone_a11y_title">Navigation bar</string>
<!-- Text in popup dialog for user to switch between always showing Taskbar or not. [CHAR LIMIT=30] -->
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
index c42d6c6..e58069a 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
@@ -72,6 +72,7 @@
import com.android.quickstep.util.DesktopTask;
import com.android.quickstep.util.GroupTask;
import com.android.systemui.shared.recents.model.Task;
+import com.android.wm.shell.common.bubbles.BubbleBarLocation;
import java.util.List;
import java.util.function.Predicate;
@@ -246,12 +247,34 @@
@Override
public boolean performAccessibilityActionInternal(int action, Bundle arguments) {
if (action == AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS) {
- announceForAccessibility(mContext.getString(R.string.taskbar_a11y_shown_title));
+ announceTaskbarShown();
} else if (action == AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS) {
- announceForAccessibility(mContext.getString(R.string.taskbar_a11y_hidden_title));
+ announceTaskbarHidden();
}
return super.performAccessibilityActionInternal(action, arguments);
+ }
+ private void announceTaskbarShown() {
+ BubbleBarLocation bubbleBarLocation = mControllerCallbacks.getBubbleBarLocationIfVisible();
+ if (bubbleBarLocation == null) {
+ announceForAccessibility(mContext.getString(R.string.taskbar_a11y_shown_title));
+ } else if (bubbleBarLocation.isOnLeft(isLayoutRtl())) {
+ announceForAccessibility(
+ mContext.getString(R.string.taskbar_a11y_shown_with_bubbles_left_title));
+ } else {
+ announceForAccessibility(
+ mContext.getString(R.string.taskbar_a11y_shown_with_bubbles_right_title));
+ }
+ }
+
+ private void announceTaskbarHidden() {
+ BubbleBarLocation bubbleBarLocation = mControllerCallbacks.getBubbleBarLocationIfVisible();
+ if (bubbleBarLocation == null) {
+ announceForAccessibility(mContext.getString(R.string.taskbar_a11y_hidden_title));
+ } else {
+ announceForAccessibility(
+ mContext.getString(R.string.taskbar_a11y_hidden_with_bubbles_title));
+ }
}
protected void announceAccessibilityChanges() {
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewCallbacks.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewCallbacks.java
index 3c646cb..e6cac2f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewCallbacks.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewCallbacks.java
@@ -23,8 +23,12 @@
import android.view.MotionEvent;
import android.view.View;
+import androidx.annotation.Nullable;
+
import com.android.internal.jank.Cuj;
+import com.android.launcher3.taskbar.bubbles.BubbleBarViewController;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
+import com.android.wm.shell.common.bubbles.BubbleBarLocation;
/**
* Callbacks for {@link TaskbarView} to interact with its controller.
@@ -104,4 +108,18 @@
mControllers.taskbarScrimViewController.onTaskbarVisibilityChanged(
mTaskbarView.getVisibility());
}
+
+ /**
+ * Get current location of bubble bar, if it is visible.
+ * Returns {@code null} if bubble bar is not shown.
+ */
+ @Nullable
+ public BubbleBarLocation getBubbleBarLocationIfVisible() {
+ BubbleBarViewController bubbleBarViewController =
+ mControllers.bubbleControllers.map(c -> c.bubbleBarViewController).orElse(null);
+ if (bubbleBarViewController != null && bubbleBarViewController.isBubbleBarVisible()) {
+ return bubbleBarViewController.getBubbleBarLocation();
+ }
+ return null;
+ }
}