diff options
| author | 2022-11-24 10:35:10 +0000 | |
|---|---|---|
| committer | 2022-11-28 08:48:53 +0000 | |
| commit | 6f7e60ed8c3a374f7ed18fb53adbca6ef1b0c9d9 (patch) | |
| tree | 653faac737323af93a617d5dd3200afc72d0164c | |
| parent | f90440ea43f5bd464c20e57974d4a1de4b758b98 (diff) | |
Fixed test failures of WindowTest
When cutout mode is always/shortEdges and the system window insets are
consumed, the cutout isn't consumed and is inset to an empty cutout
which causes the test failure.
We should also consume cutout when the system window insets contain
cutout and are consumed.
Bug: 253995206
Test: atest WindowTest WindowInsetsTest DecorInsetTests
Change-Id: I8a4fd56675509cc27dfa91de1138458fb1e7b0f0
| -rw-r--r-- | core/java/android/view/WindowInsets.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/view/WindowInsets.java b/core/java/android/view/WindowInsets.java index d77e499357b9..03b25c25ab99 100644 --- a/core/java/android/view/WindowInsets.java +++ b/core/java/android/view/WindowInsets.java @@ -29,6 +29,7 @@ import static android.view.WindowInsets.Type.STATUS_BARS; import static android.view.WindowInsets.Type.SYSTEM_GESTURES; import static android.view.WindowInsets.Type.TAPPABLE_ELEMENT; import static android.view.WindowInsets.Type.all; +import static android.view.WindowInsets.Type.displayCutout; import static android.view.WindowInsets.Type.ime; import static android.view.WindowInsets.Type.indexOf; import static android.view.WindowInsets.Type.systemBars; @@ -597,7 +598,10 @@ public final class WindowInsets { return new WindowInsets(null, null, mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, - displayCutoutCopyConstructorArgument(this), + // If the system window insets types contain displayCutout, we should also consume + // it. + (mCompatInsetsTypes & displayCutout()) != 0 + ? null : displayCutoutCopyConstructorArgument(this), mRoundedCorners, mPrivacyIndicatorBounds, mCompatInsetsTypes, mCompatIgnoreVisibility); } |