Create input consumer only when nav bar is hidden by client
INPUT_CONSUMER_NAVIGATION could be created if navigation bar was hidden
no matter who made it invisible. If navigation bar is hidden by server,
we should not create the input consumer. Otherwise, there will be no
chance to dismiss it.
Fix: 152800955
Test: 1. Run automotive emulator.
2. Click the textbox in Map on home screen to show soft keyboard.
3. Check if the soft keyboard can be touched.
Change-Id: Id5af6f9f3512abc187f0fdfe883f264b35a95476
This commit is contained in:
@@ -1494,9 +1494,7 @@ public class DisplayPolicy {
|
||||
final int behavior = mLastBehavior;
|
||||
boolean navVisible = ViewRootImpl.sNewInsetsMode != ViewRootImpl.NEW_INSETS_MODE_FULL
|
||||
? (sysui & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0
|
||||
: mNavigationBar != null && mNavigationBar.getControllableInsetProvider() != null
|
||||
&& mNavigationBar.getControllableInsetProvider().isClientVisible()
|
||||
&& !mDisplayContent.getInsetsPolicy().isTransient(ITYPE_NAVIGATION_BAR);
|
||||
: isNavigationBarRequestedVisible();
|
||||
boolean navTranslucent = (sysui
|
||||
& (View.NAVIGATION_BAR_TRANSLUCENT | View.NAVIGATION_BAR_TRANSPARENT)) != 0;
|
||||
boolean immersive = (sysui & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0
|
||||
@@ -1533,6 +1531,14 @@ public class DisplayPolicy {
|
||||
mLastNotificationShadeForcesShowingNavigation = notificationShadeForcesShowingNavigation;
|
||||
}
|
||||
|
||||
boolean isNavigationBarRequestedVisible() {
|
||||
final InsetsSourceProvider provider =
|
||||
mDisplayContent.getInsetsStateController().peekSourceProvider(ITYPE_NAVIGATION_BAR);
|
||||
return provider == null
|
||||
? InsetsState.getDefaultVisibility(ITYPE_NAVIGATION_BAR)
|
||||
: provider.isClientVisible();
|
||||
}
|
||||
|
||||
void updateHideNavInputEventReceiver(boolean navVisible, boolean navAllowedHidden) {
|
||||
// When the navigation bar isn't visible, we put up a fake input window to catch all
|
||||
// touch events. This way we can detect when the user presses anywhere to bring back the
|
||||
|
||||
@@ -99,7 +99,7 @@ class InsetsPolicy {
|
||||
}
|
||||
|
||||
private void updateHideNavInputEventReceiver() {
|
||||
mPolicy.updateHideNavInputEventReceiver(!isHidden(ITYPE_NAVIGATION_BAR),
|
||||
mPolicy.updateHideNavInputEventReceiver(mPolicy.isNavigationBarRequestedVisible(),
|
||||
mFocusedWin != null
|
||||
&& mFocusedWin.mAttrs.insetsFlags.behavior != BEHAVIOR_SHOW_BARS_BY_TOUCH);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user