From bc45fd23882ee5aff58adeb0feec85d935552aa6 Mon Sep 17 00:00:00 2001 From: Tiger Huang Date: Tue, 6 Nov 2018 20:59:08 +0800 Subject: [PATCH] Fix ScreenDecorWindowTests on devices without nav bar Navigation bar and screen decor windows would comsume the restricted frame. By the current logic, only when the device has navigation bar, app windows with SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION can extend to the unrestricted frame. So, if the device doesn't have navigation bar, app windows can never extend to the unrestricted frame (the insets won't be affected by screen decor windows). This CL removes the check about the existence of navigation bar. Bug: 119084635 Test: atest ScreenDecorWindowTests com.android.server.policy Change-Id: Ia7de52beb5b639c0c6a246bb1dfa16518c7509b1 --- .../android/server/policy/PhoneWindowManager.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 1dae396af76d1..43419027ee370 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -2152,8 +2152,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } /** - * @return whether the navigation bar can be hidden, e.g. the device has a - * navigation bar and touch exploration is not enabled + * @return whether the navigation bar can be hidden, e.g. the device has a navigation bar */ private boolean canHideNavigationBar() { return mDefaultDisplayPolicy.hasNavigationBar(); @@ -4251,8 +4250,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { final boolean screenDecor = (pfl & PRIVATE_FLAG_IS_SCREEN_DECOR) != 0; if (layoutInScreenAndInsetDecor && !screenDecor) { - if (canHideNavigationBar() && - (sysUiVis & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0) { + if ((sysUiVis & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0) { outFrame.set(displayFrames.mUnrestricted); } else { outFrame.set(displayFrames.mRestricted); @@ -4911,8 +4909,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { of.set(displayFrames.mOverscan); df.set(displayFrames.mOverscan); pf.set(displayFrames.mOverscan); - } else if (canHideNavigationBar() - && (sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0 + } else if ((sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0 && (type >= FIRST_APPLICATION_WINDOW && type <= LAST_SUB_WINDOW || type == TYPE_VOLUME_OVERLAY)) { // Asking for layout as if the nav bar is hidden, lets the application @@ -5008,8 +5005,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { of.set(displayFrames.mOverscan); df.set(displayFrames.mOverscan); pf.set(displayFrames.mOverscan); - } else if (canHideNavigationBar() - && (sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0 + } else if ((sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0 && (type == TYPE_STATUS_BAR || type == TYPE_TOAST || type == TYPE_DOCK_DIVIDER