diff options
author | Yunfan Chen <yunfanc@google.com> | 2022-04-19 17:13:22 +0900 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-22 21:07:05 +0000 |
commit | fa9bbed9467ca84fada4752d94f403bcfd163b3b (patch) | |
tree | 8f61f28994029a4d1c22abebb56ca5bfd1b781ed | |
parent | b1586e8e874cc5ce0abeb9f072a941c87a2c7c3a (diff) | |
download | base-fa9bbed9467ca84fada4752d94f403bcfd163b3b.tar.gz |
[DO NOT MERGE] Force extra nav bar provide side gesture insets
This is a patch to fix the missing gesture insets issue when there's a
task bar and no navigation bar on the display. It will try to add the
gesture navigation insets when a window providing navigation bar insets
is added and there's no window with TYPE_NAVIGATION_BAR.
The logic will only be applied when the insets is not flexible. Due to
the removal of the old hard-coded logic in the later version, this patch
should not be merged into the next version.
Bug: 212643340
Test: android.widget.cts.SeekBarTest#testSetOnSeekBarChangeListener
Change-Id: I080df3547361aef1aa259dd2b3dc9bdb860a0193
(cherry picked from commit 1921f8c1dc660851a499c5dac5a55cedf854f93e)
Merged-In: I080df3547361aef1aa259dd2b3dc9bdb860a0193
-rw-r--r-- | services/core/java/com/android/server/wm/DisplayPolicy.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index d54a388245f5..b64be7ce9e94 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -188,6 +188,7 @@ public class DisplayPolicy { private static final String TAG = TAG_WITH_CLASS_NAME ? "DisplayPolicy" : TAG_WM; private static final boolean ALTERNATE_CAR_MODE_NAV_SIZE = false; + private static final boolean LEGACY_TASKBAR_GESTURE_INSETS = false; // The panic gesture may become active only after the keyguard is dismissed and the immersive // app shows again. If that doesn't happen for 30s we drop the gesture. @@ -1275,6 +1276,35 @@ public class DisplayPolicy { if (!INSETS_LAYOUT_GENERALIZATION) { mDisplayContent.setInsetProvider(insetsType, win, null, imeFrameProvider); + if (LEGACY_TASKBAR_GESTURE_INSETS) { + if (mNavigationBar == null && (insetsType == ITYPE_NAVIGATION_BAR + || insetsType == ITYPE_EXTRA_NAVIGATION_BAR)) { + mDisplayContent.setInsetProvider(ITYPE_LEFT_GESTURES, win, + (displayFrames, windowState, inOutFrame) -> { + final int leftSafeInset = + Math.max(displayFrames.mDisplayCutoutSafe + .left, + 0); + inOutFrame.left = 0; + inOutFrame.top = 0; + inOutFrame.bottom = displayFrames.mDisplayHeight; + inOutFrame.right = + leftSafeInset + mLeftGestureInset; + }); + mDisplayContent.setInsetProvider(ITYPE_RIGHT_GESTURES, win, + (displayFrames, windowState, inOutFrame) -> { + final int rightSafeInset = + Math.min(displayFrames.mDisplayCutoutSafe + .right, + displayFrames.mUnrestricted.right); + inOutFrame.left = + rightSafeInset - mRightGestureInset; + inOutFrame.top = 0; + inOutFrame.bottom = displayFrames.mDisplayHeight; + inOutFrame.right = displayFrames.mDisplayWidth; + }); + } + } } else { mDisplayContent.setInsetProvider(insetsType, win, (displayFrames, windowState, inOutFrame) -> inOutFrame.inset( |