From 2c9d5a5ea584cb5396c566435f9a120ff4e02ca8 Mon Sep 17 00:00:00 2001 From: Yunfan Chen Date: Thu, 19 Jan 2023 05:24:41 +0000 Subject: [PATCH] Revert "Revert "Make extra navigation bar count towards non decor frame (3/3)"" This reverts commit aa0e31a7d28265a4e80ae4ee4c6074af1724b611. Reason for revert: This is still needed to avoid compatibility issue on taskbar devices. Test: CtsWidgetTestCases, InputMethodServiceTest Test: android.platform.test.scenario, ViewTests Bug: 236927938 Bug: 233945217 Change-Id: I4527a15ddc26ffc43f19267d194b4bf6af2696b8 --- .../com/android/server/wm/DisplayPolicy.java | 30 +++---------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 0bb4022d92899..f57de727dbf5f 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -2006,7 +2006,8 @@ public class DisplayPolicy { dc.getDisplayPolicy().simulateLayoutDisplay(df); final InsetsState insetsState = df.mInsetsState; final Rect displayFrame = insetsState.getDisplayFrame(); - final Insets decor = calculateDecorInsetsWithInternalTypes(insetsState); + final Insets decor = insetsState.calculateInsets(displayFrame, DECOR_TYPES, + true /* ignoreVisibility */); final Insets statusBar = insetsState.calculateInsets(displayFrame, Type.statusBars(), true /* ignoreVisibility */); mNonDecorInsets.set(decor.left, decor.top, decor.right, decor.bottom); @@ -2038,17 +2039,8 @@ public class DisplayPolicy { } } - // TODO (b/235842600): Use public type once we can treat task bar as navigation bar. - static final int[] INTERNAL_DECOR_TYPES; - static { - final ArraySet decorTypes = InsetsState.toInternalType( - Type.displayCutout() | Type.navigationBars()); - decorTypes.remove(ITYPE_EXTRA_NAVIGATION_BAR); - INTERNAL_DECOR_TYPES = new int[decorTypes.size()]; - for (int i = 0; i < INTERNAL_DECOR_TYPES.length; i++) { - INTERNAL_DECOR_TYPES[i] = decorTypes.valueAt(i); - } - } + + static final int DECOR_TYPES = Type.displayCutout() | Type.navigationBars(); private final DisplayContent mDisplayContent; private final Info[] mInfoForRotation = new Info[4]; @@ -2075,20 +2067,6 @@ public class DisplayPolicy { info.mNeedUpdate = true; } } - - // TODO (b/235842600): Remove this method once we can treat task bar as navigation bar. - private static Insets calculateDecorInsetsWithInternalTypes(InsetsState state) { - final Rect frame = state.getDisplayFrame(); - Insets insets = Insets.NONE; - for (int i = INTERNAL_DECOR_TYPES.length - 1; i >= 0; i--) { - final InsetsSource source = state.peekSource(INTERNAL_DECOR_TYPES[i]); - if (source != null) { - insets = Insets.max(source.calculateInsets(frame, true /* ignoreVisibility */), - insets); - } - } - return insets; - } } /**