Loading packages/SystemUI/res/layout/menu_ime.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ android:id="@+id/menu_container" android:id="@+id/menu_container" android:layout_width="@dimen/navigation_key_width" android:layout_width="@dimen/navigation_key_width" android:layout_height="match_parent" android:layout_height="match_parent" android:focusable="false" android:importantForAccessibility="no" android:importantForAccessibility="no" > > <!-- Use nav button width & height=match_parent for parent FrameLayout and buttons because they <!-- Use nav button width & height=match_parent for parent FrameLayout and buttons because they Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NearestTouchFrame.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -98,6 +98,7 @@ public class NearestTouchFrame extends FrameLayout { return mClickableChildren return mClickableChildren .stream() .stream() .filter(v -> v.isAttachedToWindow()) .filter(v -> v.isAttachedToWindow()) .filter(v -> v.isFocusable()) .map(v -> new Pair<>(distance(v, event), v)) .map(v -> new Pair<>(distance(v, event), v)) .min(Comparator.comparingInt(f -> f.first)) .min(Comparator.comparingInt(f -> f.first)) .get().second; .get().second; Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -171,6 +171,23 @@ public class NearestTouchFrameTest extends SysuiTestCase { ev.recycle(); 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) { private View mockViewAt(int x, int y, int width, int height) { View v = spy(new View(mContext)); View v = spy(new View(mContext)); doAnswer(invocation -> { doAnswer(invocation -> { Loading @@ -187,6 +204,7 @@ public class NearestTouchFrameTest extends SysuiTestCase { v.setRight(width); v.setRight(width); v.setTop(0); v.setTop(0); v.setBottom(height); v.setBottom(height); v.setFocusable(true); return v; return v; } } } } No newline at end of file Loading
packages/SystemUI/res/layout/menu_ime.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ android:id="@+id/menu_container" android:id="@+id/menu_container" android:layout_width="@dimen/navigation_key_width" android:layout_width="@dimen/navigation_key_width" android:layout_height="match_parent" android:layout_height="match_parent" android:focusable="false" android:importantForAccessibility="no" android:importantForAccessibility="no" > > <!-- Use nav button width & height=match_parent for parent FrameLayout and buttons because they <!-- Use nav button width & height=match_parent for parent FrameLayout and buttons because they Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NearestTouchFrame.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -98,6 +98,7 @@ public class NearestTouchFrame extends FrameLayout { return mClickableChildren return mClickableChildren .stream() .stream() .filter(v -> v.isAttachedToWindow()) .filter(v -> v.isAttachedToWindow()) .filter(v -> v.isFocusable()) .map(v -> new Pair<>(distance(v, event), v)) .map(v -> new Pair<>(distance(v, event), v)) .min(Comparator.comparingInt(f -> f.first)) .min(Comparator.comparingInt(f -> f.first)) .get().second; .get().second; Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -171,6 +171,23 @@ public class NearestTouchFrameTest extends SysuiTestCase { ev.recycle(); 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) { private View mockViewAt(int x, int y, int width, int height) { View v = spy(new View(mContext)); View v = spy(new View(mContext)); doAnswer(invocation -> { doAnswer(invocation -> { Loading @@ -187,6 +204,7 @@ public class NearestTouchFrameTest extends SysuiTestCase { v.setRight(width); v.setRight(width); v.setTop(0); v.setTop(0); v.setBottom(height); v.setBottom(height); v.setFocusable(true); return v; return v; } } } } No newline at end of file