Fix the display problem of the cutout

- Add the WindowInsetsCompat.Type.displayCutout.

Fixes: 332514800
Test: atest com.android.settings.UtilsTest SettingsActivityTest
Change-Id: Ieb4ffb5a18c0babe3dd1c6f3482e8585899237f0
This commit is contained in:
Sunny Shao
2024-05-08 15:34:44 +08:00
parent 36a00809a5
commit 975ce0ec6c

View File

@@ -1409,7 +1409,8 @@ public final class Utils extends com.android.settingslib.Utils {
ViewCompat.setOnApplyWindowInsetsListener(activity.findViewById(android.R.id.content), ViewCompat.setOnApplyWindowInsetsListener(activity.findViewById(android.R.id.content),
(v, windowInsets) -> { (v, windowInsets) -> {
Insets insets = windowInsets.getInsets( Insets insets = windowInsets.getInsets(
WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.ime()); WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.ime()
| WindowInsetsCompat.Type.displayCutout());
int statusBarHeight = activity.getWindow().getDecorView().getRootWindowInsets() int statusBarHeight = activity.getWindow().getDecorView().getRootWindowInsets()
.getInsets(WindowInsetsCompat.Type.statusBars()).top; .getInsets(WindowInsetsCompat.Type.statusBars()).top;
// Apply the insets paddings to the view. // Apply the insets paddings to the view.