diff options
| author | shawnlin <shawnlin@google.com> | 2020-02-18 19:36:06 +0800 |
|---|---|---|
| committer | shawnlin <shawnlin@google.com> | 2020-02-20 11:23:48 +0800 |
| commit | d647897fc96cbe86b0d454b0574750849e515731 (patch) | |
| tree | 15c48c85cbef479b8d02d09d44a0978fb7abe689 /core/java/android/view/ViewRootImpl.java | |
| parent | a9ec170cc3051082be5115f47702f24d1c2505e7 (diff) | |
Allow passing cutout to the hierarchy in shortEdge mode
Bug: 149806697
Test: make
Change-Id: I7fea5d0c05155a850fc7536bd0548c844ce6783d
Diffstat (limited to 'core/java/android/view/ViewRootImpl.java')
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 44ab596b93ee..78aa776aab9b 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -43,6 +43,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION; import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; +import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_APPEARANCE_CONTROLLED; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_BEHAVIOR_CONTROLLED; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FIT_INSETS_CONTROLLED; @@ -2209,9 +2210,7 @@ public final class ViewRootImpl implements ViewParent, void dispatchApplyInsets(View host) { Trace.traceBegin(Trace.TRACE_TAG_VIEW, "dispatchApplyInsets"); WindowInsets insets = getWindowInsets(true /* forceConstruct */); - final boolean dispatchCutout = (mWindowAttributes.layoutInDisplayCutoutMode - == LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS); - if (!dispatchCutout) { + if (!shouldDispatchCutout()) { // Window is either not laid out in cutout or the status bar inset takes care of // clearing the cutout, so we don't need to dispatch the cutout to the hierarchy. insets = insets.consumeDisplayCutout(); @@ -2220,6 +2219,13 @@ public final class ViewRootImpl implements ViewParent, Trace.traceEnd(Trace.TRACE_TAG_VIEW); } + private boolean shouldDispatchCutout() { + return mWindowAttributes.layoutInDisplayCutoutMode + == LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS + || mWindowAttributes.layoutInDisplayCutoutMode + == LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; + } + private void updateVisibleInsets() { Rect visibleInsets = mInsetsController.calculateVisibleInsets(mPendingVisibleInsets, mWindowAttributes.softInputMode); |
