From 7e58a08ccdd528b48497d7286be3c28cc0e339c0 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Fri, 9 Mar 2018 16:40:56 +0100 Subject: [PATCH] Multi Cutout: Fix more cutout issues Ensures that the navigation bar extends all the way to the bottom of the display. Also ensures the nav bar window is properly padded. Also ensures that windows that do not hide the navigation bar can extend behind the cutout if the cutout is within the navigation bar region. Also ensures that wallpapers (just like dreams) are not letterboxed Bug: 74195186 Test: Turn on multi-cutout; verify the wallpaper and navigation bars extend all the way to the bottom Test: Open an immersive app, verify it gets letterboxed Change-Id: I724080edc26d7ee09dba690f6670d4f66d1c93f6 --- .../phone/KeyguardBottomAreaView.java | 13 +++++ .../statusbar/phone/NavigationBarView.java | 9 ++++ .../server/policy/PhoneWindowManager.java | 47 +++++++++++++------ 3 files changed, 55 insertions(+), 14 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index ca66e987933c4..0716b37ff8d9a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -55,6 +55,7 @@ import android.util.MathUtils; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; +import android.view.WindowInsets; import android.view.WindowManager; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; @@ -912,4 +913,16 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL return (secure && !canSkipBouncer) ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT; } } + + @Override + public WindowInsets onApplyWindowInsets(WindowInsets insets) { + int bottom = insets.getDisplayCutout() != null + ? insets.getDisplayCutout().getSafeInsetBottom() : 0; + if (isPaddingRelative()) { + setPaddingRelative(getPaddingStart(), getPaddingTop(), getPaddingEnd(), bottom); + } else { + setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), bottom); + } + return insets; + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 056874fd1dcb1..32720de6af47b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -49,6 +49,7 @@ import android.view.MotionEvent; import android.view.Surface; import android.view.View; import android.view.ViewGroup; +import android.view.WindowInsets; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.FrameLayout; @@ -1028,6 +1029,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener