Fix display problem in the freeform mode

Fixes: 347373574
Flag: EXEMPT bugfix
Test: manual test
Change-Id: Ia1333474059988a524fc0ca49e7062b51da2cc37
This commit is contained in:
Sunny Shao
2024-07-02 21:31:30 +08:00
parent 6632826881
commit 79c69fccd1

View File

@@ -1423,13 +1423,15 @@ public final class Utils extends com.android.settingslib.Utils {
public static void setupEdgeToEdge(@NonNull FragmentActivity activity) { public static void setupEdgeToEdge(@NonNull FragmentActivity activity) {
ViewCompat.setOnApplyWindowInsetsListener(activity.findViewById(android.R.id.content), ViewCompat.setOnApplyWindowInsetsListener(activity.findViewById(android.R.id.content),
(v, windowInsets) -> { (v, windowInsets) -> {
Insets insets = windowInsets.getInsets( final Insets insets = windowInsets.getInsets(
WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.ime() WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.ime()
| WindowInsetsCompat.Type.displayCutout()); | WindowInsetsCompat.Type.displayCutout());
int statusBarHeight = activity.getWindow().getDecorView().getRootWindowInsets() int newInsetsTop = activity.getWindow().getDecorView().getRootWindowInsets()
.getInsets(WindowInsetsCompat.Type.statusBars()).top; .getInsets(WindowInsetsCompat.Type.statusBars()
| WindowInsetsCompat.Type.captionBar()).top;
// Apply the insets paddings to the view. // Apply the insets paddings to the view.
v.setPadding(insets.left, statusBarHeight, insets.right, insets.bottom); v.setPadding(insets.left, newInsetsTop, insets.right, insets.bottom);
// Return CONSUMED if you don't want the window insets to keep being // Return CONSUMED if you don't want the window insets to keep being
// passed down to descendant views. // passed down to descendant views.