Merge "Ensure nav bar is not touchable when the IME is handling back" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
71ac6f0031
@@ -274,13 +274,23 @@ public class NavigationBarView extends FrameLayout implements
|
|||||||
};
|
};
|
||||||
|
|
||||||
private final OnComputeInternalInsetsListener mOnComputeInternalInsetsListener = info -> {
|
private final OnComputeInternalInsetsListener mOnComputeInternalInsetsListener = info -> {
|
||||||
// When the nav bar is in 2-button or 3-button mode, or when IME is visible in fully
|
// When the nav bar is in 2-button or 3-button mode, or when the back button is force-shown
|
||||||
// gestural mode, the entire nav bar should be touchable.
|
// while in gesture nav in SUW, the entire nav bar should be touchable.
|
||||||
if (!mEdgeBackGestureHandler.isHandlingGestures()) {
|
if (!mEdgeBackGestureHandler.isHandlingGestures()) {
|
||||||
|
// We're in 2/3 button mode OR back button force-shown in SUW
|
||||||
|
if (!mImeVisible) {
|
||||||
|
// IME not showing, take all touches
|
||||||
info.setTouchableInsets(InternalInsetsInfo.TOUCHABLE_INSETS_FRAME);
|
info.setTouchableInsets(InternalInsetsInfo.TOUCHABLE_INSETS_FRAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isImeRenderingNavButtons()) {
|
||||||
|
// IME showing but not drawing any buttons, take all touches
|
||||||
|
info.setTouchableInsets(InternalInsetsInfo.TOUCHABLE_INSETS_FRAME);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// When in gestural and the IME is showing, don't use the nearest region since it will take
|
// When in gestural and the IME is showing, don't use the nearest region since it will take
|
||||||
// gesture space away from the IME
|
// gesture space away from the IME
|
||||||
info.setTouchableInsets(InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
|
info.setTouchableInsets(InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
|
||||||
@@ -775,14 +785,10 @@ public class NavigationBarView extends FrameLayout implements
|
|||||||
|
|
||||||
updateRecentsIcon();
|
updateRecentsIcon();
|
||||||
|
|
||||||
boolean isImeRenderingNavButtons = mImeDrawsImeNavBar
|
|
||||||
&& mImeCanRenderGesturalNavButtons
|
|
||||||
&& (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0;
|
|
||||||
|
|
||||||
// Update IME button visibility, a11y and rotate button always overrides the appearance
|
// Update IME button visibility, a11y and rotate button always overrides the appearance
|
||||||
boolean disableImeSwitcher =
|
boolean disableImeSwitcher =
|
||||||
(mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_SHOWN) == 0
|
(mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_SHOWN) == 0
|
||||||
|| isImeRenderingNavButtons;
|
|| isImeRenderingNavButtons();
|
||||||
mContextualButtonGroup.setButtonVisibility(R.id.ime_switcher, !disableImeSwitcher);
|
mContextualButtonGroup.setButtonVisibility(R.id.ime_switcher, !disableImeSwitcher);
|
||||||
|
|
||||||
mBarTransitions.reapplyDarkIntensity();
|
mBarTransitions.reapplyDarkIntensity();
|
||||||
@@ -799,7 +805,7 @@ public class NavigationBarView extends FrameLayout implements
|
|||||||
|
|
||||||
boolean disableBack = !useAltBack && (mEdgeBackGestureHandler.isHandlingGestures()
|
boolean disableBack = !useAltBack && (mEdgeBackGestureHandler.isHandlingGestures()
|
||||||
|| ((mDisabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0))
|
|| ((mDisabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0))
|
||||||
|| isImeRenderingNavButtons;
|
|| isImeRenderingNavButtons();
|
||||||
|
|
||||||
// When screen pinning, don't hide back and home when connected service or back and
|
// When screen pinning, don't hide back and home when connected service or back and
|
||||||
// recents buttons when disconnected from launcher service in screen pinning mode,
|
// recents buttons when disconnected from launcher service in screen pinning mode,
|
||||||
@@ -832,6 +838,15 @@ public class NavigationBarView extends FrameLayout implements
|
|||||||
notifyActiveTouchRegions();
|
notifyActiveTouchRegions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the IME is currently visible and drawing the nav buttons.
|
||||||
|
*/
|
||||||
|
private boolean isImeRenderingNavButtons() {
|
||||||
|
return mImeDrawsImeNavBar
|
||||||
|
&& mImeCanRenderGesturalNavButtons
|
||||||
|
&& (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean isRecentsButtonDisabled() {
|
boolean isRecentsButtonDisabled() {
|
||||||
return mUseCarModeUi || !isOverviewEnabled()
|
return mUseCarModeUi || !isOverviewEnabled()
|
||||||
|
|||||||
Reference in New Issue
Block a user