Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c11fd79e authored by Ats Jenk's avatar Ats Jenk Committed by Android (Google) Code Review
Browse files

Merge "Include bubble bar location in taskbar announcement" into main

parents 4a6c90d5 4e4b8a84
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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 &#38; 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 &#38; 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 &#38; 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] -->
+25 −2
Original line number Diff line number Diff line
@@ -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() {
+18 −0
Original line number Diff line number Diff line
@@ -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;
    }
}