Loading services/core/java/com/android/server/wm/DisplayPolicy.java +23 −19 Original line number Original line Diff line number Diff line Loading @@ -1527,25 +1527,7 @@ public class DisplayPolicy { && (mNotificationShade.getAttrs().privateFlags && (mNotificationShade.getAttrs().privateFlags & PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION) != 0; & PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION) != 0; // When the navigation bar isn't visible, we put up a fake input window to catch all updateHideNavInputEventReceiver(navVisible, navAllowedHidden); // touch events. This way we can detect when the user presses anywhere to bring back the // nav bar and ensure the application doesn't see the event. if (navVisible || navAllowedHidden) { if (mInputConsumer != null) { mInputConsumer.dismiss(); mHandler.sendMessage( mHandler.obtainMessage(MSG_DISPOSE_INPUT_CONSUMER, mInputConsumer)); mInputConsumer = null; } } else if (mInputConsumer == null && mStatusBar != null && canHideNavigationBar()) { mInputConsumer = mDisplayContent.getInputMonitor().createInputConsumer( mHandler.getLooper(), INPUT_CONSUMER_NAVIGATION, HideNavInputEventReceiver::new); // As long as mInputConsumer is active, hover events are not dispatched to the app // and the pointer icon is likely to become stale. Hide it to avoid confusion. InputManager.getInstance().setPointerIconType(PointerIcon.TYPE_NULL); } // For purposes of positioning and showing the nav bar, if we have decided that it can't // For purposes of positioning and showing the nav bar, if we have decided that it can't // be hidden (because of the screen aspect ratio), then take that into account. // be hidden (because of the screen aspect ratio), then take that into account. Loading @@ -1567,6 +1549,28 @@ public class DisplayPolicy { mLastNotificationShadeForcesShowingNavigation = notificationShadeForcesShowingNavigation; mLastNotificationShadeForcesShowingNavigation = notificationShadeForcesShowingNavigation; } } 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 // nav bar and ensure the application doesn't see the event. if (navVisible || navAllowedHidden) { if (mInputConsumer != null) { mInputConsumer.dismiss(); mHandler.sendMessage( mHandler.obtainMessage(MSG_DISPOSE_INPUT_CONSUMER, mInputConsumer)); mInputConsumer = null; } } else if (mInputConsumer == null && mStatusBar != null && canHideNavigationBar()) { mInputConsumer = mDisplayContent.getInputMonitor().createInputConsumer( mHandler.getLooper(), INPUT_CONSUMER_NAVIGATION, HideNavInputEventReceiver::new); // As long as mInputConsumer is active, hover events are not dispatched to the app // and the pointer icon is likely to become stale. Hide it to avoid confusion. InputManager.getInstance().setPointerIconType(PointerIcon.TYPE_NULL); } } private static void updateInsetsStateForDisplayCutout(DisplayFrames displayFrames, private static void updateInsetsStateForDisplayCutout(DisplayFrames displayFrames, InsetsState state) { InsetsState state) { if (displayFrames.mDisplayCutout.getDisplayCutout().isEmpty()) { if (displayFrames.mDisplayCutout.getDisplayCutout().isEmpty()) { Loading services/core/java/com/android/server/wm/InsetsPolicy.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static android.view.InsetsController.ANIMATION_TYPE_SHOW; import static android.view.InsetsState.ITYPE_NAVIGATION_BAR; import static android.view.InsetsState.ITYPE_NAVIGATION_BAR; import static android.view.InsetsState.ITYPE_STATUS_BAR; import static android.view.InsetsState.ITYPE_STATUS_BAR; import static android.view.SyncRtSurfaceTransactionApplier.applyParams; import static android.view.SyncRtSurfaceTransactionApplier.applyParams; import static android.view.WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_TOUCH; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION; Loading Loading @@ -91,6 +92,12 @@ class InsetsPolicy { || focusedWin != getNavControlTarget(focusedWin) || focusedWin != getNavControlTarget(focusedWin) || focusedWin.getRequestedInsetsState().getSource(ITYPE_NAVIGATION_BAR) || focusedWin.getRequestedInsetsState().getSource(ITYPE_NAVIGATION_BAR) .isVisible()); .isVisible()); updateHideNavInputEventReceiver(); } private void updateHideNavInputEventReceiver() { mPolicy.updateHideNavInputEventReceiver(!isHidden(ITYPE_NAVIGATION_BAR), mFocusedWin.mAttrs.insetsFlags.behavior != BEHAVIOR_SHOW_BARS_BY_TOUCH); } } boolean isHidden(@InternalInsetsType int type) { boolean isHidden(@InternalInsetsType int type) { Loading Loading @@ -169,6 +176,7 @@ class InsetsPolicy { if (windowState == getNavControlTarget(mFocusedWin)) { if (windowState == getNavControlTarget(mFocusedWin)) { mNavBar.setVisible(state.getSource(ITYPE_NAVIGATION_BAR).isVisible()); mNavBar.setVisible(state.getSource(ITYPE_NAVIGATION_BAR).isVisible()); } } updateHideNavInputEventReceiver(); } } /** /** Loading Loading
services/core/java/com/android/server/wm/DisplayPolicy.java +23 −19 Original line number Original line Diff line number Diff line Loading @@ -1527,25 +1527,7 @@ public class DisplayPolicy { && (mNotificationShade.getAttrs().privateFlags && (mNotificationShade.getAttrs().privateFlags & PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION) != 0; & PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION) != 0; // When the navigation bar isn't visible, we put up a fake input window to catch all updateHideNavInputEventReceiver(navVisible, navAllowedHidden); // touch events. This way we can detect when the user presses anywhere to bring back the // nav bar and ensure the application doesn't see the event. if (navVisible || navAllowedHidden) { if (mInputConsumer != null) { mInputConsumer.dismiss(); mHandler.sendMessage( mHandler.obtainMessage(MSG_DISPOSE_INPUT_CONSUMER, mInputConsumer)); mInputConsumer = null; } } else if (mInputConsumer == null && mStatusBar != null && canHideNavigationBar()) { mInputConsumer = mDisplayContent.getInputMonitor().createInputConsumer( mHandler.getLooper(), INPUT_CONSUMER_NAVIGATION, HideNavInputEventReceiver::new); // As long as mInputConsumer is active, hover events are not dispatched to the app // and the pointer icon is likely to become stale. Hide it to avoid confusion. InputManager.getInstance().setPointerIconType(PointerIcon.TYPE_NULL); } // For purposes of positioning and showing the nav bar, if we have decided that it can't // For purposes of positioning and showing the nav bar, if we have decided that it can't // be hidden (because of the screen aspect ratio), then take that into account. // be hidden (because of the screen aspect ratio), then take that into account. Loading @@ -1567,6 +1549,28 @@ public class DisplayPolicy { mLastNotificationShadeForcesShowingNavigation = notificationShadeForcesShowingNavigation; mLastNotificationShadeForcesShowingNavigation = notificationShadeForcesShowingNavigation; } } 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 // nav bar and ensure the application doesn't see the event. if (navVisible || navAllowedHidden) { if (mInputConsumer != null) { mInputConsumer.dismiss(); mHandler.sendMessage( mHandler.obtainMessage(MSG_DISPOSE_INPUT_CONSUMER, mInputConsumer)); mInputConsumer = null; } } else if (mInputConsumer == null && mStatusBar != null && canHideNavigationBar()) { mInputConsumer = mDisplayContent.getInputMonitor().createInputConsumer( mHandler.getLooper(), INPUT_CONSUMER_NAVIGATION, HideNavInputEventReceiver::new); // As long as mInputConsumer is active, hover events are not dispatched to the app // and the pointer icon is likely to become stale. Hide it to avoid confusion. InputManager.getInstance().setPointerIconType(PointerIcon.TYPE_NULL); } } private static void updateInsetsStateForDisplayCutout(DisplayFrames displayFrames, private static void updateInsetsStateForDisplayCutout(DisplayFrames displayFrames, InsetsState state) { InsetsState state) { if (displayFrames.mDisplayCutout.getDisplayCutout().isEmpty()) { if (displayFrames.mDisplayCutout.getDisplayCutout().isEmpty()) { Loading
services/core/java/com/android/server/wm/InsetsPolicy.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static android.view.InsetsController.ANIMATION_TYPE_SHOW; import static android.view.InsetsState.ITYPE_NAVIGATION_BAR; import static android.view.InsetsState.ITYPE_NAVIGATION_BAR; import static android.view.InsetsState.ITYPE_STATUS_BAR; import static android.view.InsetsState.ITYPE_STATUS_BAR; import static android.view.SyncRtSurfaceTransactionApplier.applyParams; import static android.view.SyncRtSurfaceTransactionApplier.applyParams; import static android.view.WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_TOUCH; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION; Loading Loading @@ -91,6 +92,12 @@ class InsetsPolicy { || focusedWin != getNavControlTarget(focusedWin) || focusedWin != getNavControlTarget(focusedWin) || focusedWin.getRequestedInsetsState().getSource(ITYPE_NAVIGATION_BAR) || focusedWin.getRequestedInsetsState().getSource(ITYPE_NAVIGATION_BAR) .isVisible()); .isVisible()); updateHideNavInputEventReceiver(); } private void updateHideNavInputEventReceiver() { mPolicy.updateHideNavInputEventReceiver(!isHidden(ITYPE_NAVIGATION_BAR), mFocusedWin.mAttrs.insetsFlags.behavior != BEHAVIOR_SHOW_BARS_BY_TOUCH); } } boolean isHidden(@InternalInsetsType int type) { boolean isHidden(@InternalInsetsType int type) { Loading Loading @@ -169,6 +176,7 @@ class InsetsPolicy { if (windowState == getNavControlTarget(mFocusedWin)) { if (windowState == getNavControlTarget(mFocusedWin)) { mNavBar.setVisible(state.getSource(ITYPE_NAVIGATION_BAR).isVisible()); mNavBar.setVisible(state.getSource(ITYPE_NAVIGATION_BAR).isVisible()); } } updateHideNavInputEventReceiver(); } } /** /** Loading