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

Commit 5b860719 authored by Evan Rosky's avatar Evan Rosky
Browse files

Handle edge-case where no focusables exist

cluster navigation was previously crashing if there was
nothing focusable..

Bug: 37438383
Test: Added CTS: ContentPaneFocusTest#testNoFocusablesInContent
      Ran against support-v7-demos Toolbar demos to verify
      crash didn't occur

Change-Id: Ia1382cec138a948d080aeded4d38735983df2152
parent 11139e91
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4665,7 +4665,8 @@ public final class ViewRootImpl implements ViewParent,
            if (focused == null && mView.restoreDefaultFocus()) {
                return true;
            }
            View cluster = focused.keyboardNavigationClusterSearch(null, direction);
            View cluster = focused == null ? keyboardNavigationClusterSearch(null, direction)
                    : focused.keyboardNavigationClusterSearch(null, direction);

            // Since requestFocus only takes "real" focus directions (and therefore also
            // restoreFocusInCluster), convert forward/backward focus into FOCUS_DOWN.