From d4193b97a2092dbd0ba669fc46e9ddae07efe71e Mon Sep 17 00:00:00 2001 From: Tiger Date: Fri, 3 Mar 2023 18:03:54 +0800 Subject: Let navigation bar has control if it is focused Previously, we let the top fullscreen app window stay in immersive mode when a non-app window gets the focus. However, in some cases, the navigation bar source window needs to stay visible, and it will make itself focusable. This CL lets it has control if it is focused. Fix: 271373861 Test: Swipe to show transient taskbar and long press on the icon. See if taskbar stays visible. Change-Id: Ifb0fff483b1787db34d3b00a3728dd6cf6fa7bb5 --- services/core/java/com/android/server/wm/InsetsPolicy.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/core/java/com/android/server/wm/InsetsPolicy.java b/services/core/java/com/android/server/wm/InsetsPolicy.java index 210a7d9538c7..c1f2b2be3ea7 100644 --- a/services/core/java/com/android/server/wm/InsetsPolicy.java +++ b/services/core/java/com/android/server/wm/InsetsPolicy.java @@ -580,6 +580,13 @@ class InsetsPolicy { // Notification shade has control anyways, no reason to force anything. return focusedWin; } + if (focusedWin != null) { + final InsetsSourceProvider provider = focusedWin.getControllableInsetProvider(); + if (provider != null && provider.getSource().getType() == Type.navigationBars()) { + // Navigation bar has control if it is focused. + return focusedWin; + } + } if (mPolicy.isForceShowNavigationBarEnabled() && focusedWin != null && focusedWin.getActivityType() == ACTIVITY_TYPE_STANDARD) { // When "force show navigation bar" is enabled, it means both force visible is true, and -- cgit v1.2.3-59-g8ed1b