Merge "Fixes tapping home button on right edge with quickstep layout"
This commit is contained in:
committed by
Android (Google) Code Review
commit
500420ce55
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user