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

Commit a099cc8b authored by Matthew Ng's avatar Matthew Ng
Browse files

Fixes tapping home button on right edge with quickstep layout

Reverted ag/4731597 since it was causing issue and instead hides the
menu container when none of its children are visible.

Change-Id: Ie48ef32f8a66392796cb0330faed6dff499bc1b1
Fixes: 114099654
Test: tap around the right edge
parent 2518b289
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@
    android:id="@+id/menu_container"
    android:layout_width="@dimen/navigation_key_width"
    android:layout_height="match_parent"
    android:focusable="false"
    android:importantForAccessibility="no"
    >
    <!-- Use nav button width & height=match_parent for parent FrameLayout and buttons because they
+11 −0
Original line number Diff line number Diff line
@@ -615,6 +615,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
                        ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0);
        getImeSwitchButton().setVisibility(showImeButton ? View.VISIBLE : View.INVISIBLE);
        getImeSwitchButton().setImageDrawable(mImeIcon);
        updateContextualContainerVisibility();

        // Update menu button, visibility logic in method
        setMenuVisibility(mShowMenu, true);
@@ -796,6 +797,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
                ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) == 0);

        getMenuButton().setVisibility(shouldShow ? View.VISIBLE : View.INVISIBLE);
        updateContextualContainerVisibility();
    }

    public void setAccessibilityButtonState(final boolean visible, final boolean longClickable) {
@@ -810,6 +812,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav

        getAccessibilityButton().setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
        getAccessibilityButton().setLongClickable(longClickable);
        updateContextualContainerVisibility();
    }

    public void updateRotateSuggestionButtonStyle(@StyleRes int style, boolean setIcon) {
@@ -839,6 +842,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav

        getRotateSuggestionButton().setVisibility(vis);
        mShowRotateButton = visible;
        updateContextualContainerVisibility();

        // Stop any active animations if hidden
        if (!visible && mRotateSuggestionIcon.canAnimate()) {
@@ -855,6 +859,13 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav

    public boolean isRotateButtonVisible() { return mShowRotateButton; }

    private void updateContextualContainerVisibility() {
        // Only show the menu container when one of its buttons are visible
        getMenuContainer().setVisibility((mShowAccessibilityButton || mShowRotateButton || mShowMenu
                || (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0)
                ? VISIBLE : INVISIBLE);
    }

    void hideRecentsOnboarding() {
        mRecentsOnboarding.hide(true);
    }
+0 −1
Original line number Diff line number Diff line
@@ -98,7 +98,6 @@ public class NearestTouchFrame extends FrameLayout {
        return mClickableChildren
                .stream()
                .filter(v -> v.isAttachedToWindow())
                .filter(v -> v.isFocusable())
                .map(v -> new Pair<>(distance(v, event), v))
                .min(Comparator.comparingInt(f -> f.first))
                .get().second;
+0 −18
Original line number Diff line number Diff line
@@ -171,23 +171,6 @@ public class NearestTouchFrameTest extends SysuiTestCase {
        ev.recycle();
    }

    @Test
    public void testFurtherSelectedWhenCloserNotFocusable() {
        View closer = mockViewAt(0, 0, 10, 10);
        View further = mockViewAt(20, 0, 10, 10);
        closer.setFocusable(false);

        mNearestTouchFrame.addView(closer);
        mNearestTouchFrame.addView(further);
        mNearestTouchFrame.onMeasure(0, 0);

        MotionEvent ev = MotionEvent.obtain(0, 0, 0,
                12 /* x */, 5 /* y */, 0);
        mNearestTouchFrame.onTouchEvent(ev);
        verify(further).onTouchEvent(eq(ev));
        ev.recycle();
    }

    private View mockViewAt(int x, int y, int width, int height) {
        View v = spy(new View(mContext));
        doAnswer(invocation -> {
@@ -204,7 +187,6 @@ public class NearestTouchFrameTest extends SysuiTestCase {
        v.setRight(width);
        v.setTop(0);
        v.setBottom(height);
        v.setFocusable(true);
        return v;
    }
}
 No newline at end of file