summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author shawnlin <shawnlin@google.com> 2020-11-02 17:41:48 +0800
committer shawnlin <shawnlin@google.com> 2020-11-11 15:22:51 +0800
commitb8feac1291c1684c81eb14c9fd1993f9401c65a6 (patch)
tree3f4280990c199005338b3e28e0d40c77c6ed2dc2
parent79f3adcf149cde5bd878c2aab38e253764602943 (diff)
Fix incorrect system gesture insets reported when there are cutout areas
on the left/right edges of the display Should calculate the gesture insets based on left/right cutout insets. Bug: 172191437 Test: atest WindowInsetsBehaviorTests Change-Id: I75e2da14ab5c05c559d4420c239184834794505e
-rw-r--r--services/core/java/com/android/server/wm/DisplayPolicy.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index 7a42b0db0c52..df2edd0412b3 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -1153,15 +1153,19 @@ public class DisplayPolicy {
});
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 = displayFrames.mUnrestricted.left + mLeftGestureInset;
+ inOutFrame.right = leftSafeInset + mLeftGestureInset;
});
mDisplayContent.setInsetProvider(ITYPE_RIGHT_GESTURES, win,
(displayFrames, windowState, inOutFrame) -> {
- inOutFrame.left = displayFrames.mUnrestricted.right
- - mRightGestureInset;
+ 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;