Merge "Include bubble bar location in taskbar announcement" into main
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user