diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-09-18 23:49:32 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-09-18 23:49:32 +0000 |
| commit | 500420ce55dfd72bfec41864f256dfde46711673 (patch) | |
| tree | 8f48adda35846530c17c7a157de96befcba74012 | |
| parent | a500ceab71ee514f850518ed5edbeb603538342c (diff) | |
| parent | a099cc8bb1f03f381b46e4f2d52d7d50ebf32441 (diff) | |
Merge "Fixes tapping home button on right edge with quickstep layout"
4 files changed, 11 insertions, 20 deletions
diff --git a/packages/SystemUI/res/layout/menu_ime.xml b/packages/SystemUI/res/layout/menu_ime.xml index b047efbdc6e0..8a3a0b19c892 100644 --- a/packages/SystemUI/res/layout/menu_ime.xml +++ b/packages/SystemUI/res/layout/menu_ime.xml @@ -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 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 21410160c5bf..9d13ea22b281 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -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); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NearestTouchFrame.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NearestTouchFrame.java index 7b9ed88b8b44..09833d44915d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NearestTouchFrame.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NearestTouchFrame.java @@ -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; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java index 2423e148bb97..667a5082892d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java @@ -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 |
