OSDN Git Service

DisplayCutout: Ensure stable insets cover top cutout
authorAdrian Roos <roosa@google.com>
Mon, 16 Apr 2018 14:56:07 +0000 (16:56 +0200)
committerAdrian Roos <roosa@google.com>
Mon, 16 Apr 2018 14:56:07 +0000 (16:56 +0200)
Fixes an issue where the stable insets could become smaller
than the top cutout if the display density was set lower
than the natural density.

Bug: 78110564
Test: Set display size to "small", turn on cutout, verify apps do not have a gap between status bar and content.
Change-Id: I478047ccaade0e4e265cc57d03b072ae578b49d0

services/core/java/com/android/server/policy/PhoneWindowManager.java

index fce4b20..920e77f 100644 (file)
@@ -4809,6 +4809,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
         // For layout, the status bar is always at the top with our fixed height.
         displayFrames.mStable.top = displayFrames.mUnrestricted.top
                 + mStatusBarHeightForRotation[displayFrames.mRotation];
+        // Make sure the status bar covers the entire cutout height
+        displayFrames.mStable.top = Math.max(displayFrames.mStable.top,
+                displayFrames.mDisplayCutoutSafe.top);
 
         // Tell the bar controller where the collapsed status bar content is
         mTmpRect.set(mStatusBar.getContentFrameLw());