From 4e4b8a8402112a5b3f92ab0a2982f8b254f304e3 Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Wed, 24 Jul 2024 13:39:36 -0700 Subject: [PATCH] Include bubble bar location in taskbar announcement When bubble bar has bubbles, it will be expanded together with taskbar. Include information about bubble bar appearing together with the taskbar announcement. During expand include the location of the bubble bar, whether it is on the left or right. Bug: 344675357 Flag: com.android.wm.shell.enable_bubble_bar Test: manual, enable talkback and check that taskbar expand announcement includes information about bubble bar, check that when bar is on left, announcement includes left and bar is right, announcement says right Change-Id: I116ed531fe7032940478451508b37f4fd0bc98ff --- quickstep/res/values/strings.xml | 10 +++++-- .../launcher3/taskbar/TaskbarView.java | 27 +++++++++++++++++-- .../taskbar/TaskbarViewCallbacks.java | 18 +++++++++++++ 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml index 98a27839d2..3e252e120b 100644 --- a/quickstep/res/values/strings.xml +++ b/quickstep/res/values/strings.xml @@ -299,10 +299,16 @@ Quick Settings Taskbar - + Taskbar shown - + + Taskbar & bubbles left shown + + Taskbar & bubbles right shown + Taskbar hidden + + Taskbar & bubbles hidden Navigation bar diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index c42d6c6c1c..e58069a7e4 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.AssistStateManager; 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 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar @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 3c646cb7fa..e6cac2f9db 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.InputDevice; 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 @@ public class TaskbarViewCallbacks { 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; + } }