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

Commit 40a29161 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Disabling accessibility focus on all children when shortcuts is open"...

Merge "Disabling accessibility focus on all children when shortcuts is open" into ub-launcher3-calgary
parents f0cb6018 7d552c8b
Loading
Loading
Loading
Loading
+21 −11
Original line number Diff line number Diff line
@@ -374,21 +374,31 @@ public class DragLayer extends InsettableFrameLayout {

    @Override
    public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
        Folder currentFolder = mLauncher.getWorkspace().getOpenFolder();
        if (currentFolder != null) {
            if (child == currentFolder) {
        // Shortcuts can appear above folder
        View topView = mLauncher.getOpenShortcutsContainer();
        if (topView != null) {
            return handleTopViewSendAccessibilityEvent(topView, child, event);
        }

        topView = mLauncher.getWorkspace().getOpenFolder();
        if (topView != null) {
            return handleTopViewSendAccessibilityEvent(topView, child, event);
        }
        return super.onRequestSendAccessibilityEvent(child, event);
    }

    private boolean handleTopViewSendAccessibilityEvent(
            View topView, View child, AccessibilityEvent event) {
        if (child == topView) {
            return super.onRequestSendAccessibilityEvent(child, event);
        }
        if (isInAccessibleDrag() && child instanceof DropTargetBar) {
            return super.onRequestSendAccessibilityEvent(child, event);
        }
            // Skip propagating onRequestSendAccessibilityEvent all for other children
            // when a folder is open
        // Skip propagating onRequestSendAccessibilityEvent for all other children
        // which are not topView
        return false;
    }
        return super.onRequestSendAccessibilityEvent(child, event);
    }

    @Override
    public void addChildrenForAccessibility(ArrayList<View> childrenForAccessibility) {