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
This commit is contained in:
shawnlin
2020-11-02 17:41:48 +08:00
parent 79f3adcf14
commit b8feac1291

View File

@@ -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;