From a07fb93cb06d5c4bcc00df6339eaa4904dfd0714 Mon Sep 17 00:00:00 2001 From: Yunfan Chen Date: Mon, 27 Apr 2020 18:35:14 +0900 Subject: Report caption insets change when layout This patch let DecorCaptionView report back to it's owner about height change, instead of let the DecorView query the height. The previous query points enableCaption() and updateDecorCaptionStatus() cannot ensure the caption layout is finished and attached to the phone window. Such that it may return a zero caption insets when it shouldn't be, if the app do window configuration change handling by restarting. The layout will ensure the caption insets get set when everything is ready. There will be no caption height change when resizing or moving, make sure the calculated insets always include the caption regardless of the frame position. Bug: 154792488 Test: Manuel test with message and settings app. Test: go/wm-smoke Test: atest InsetsControllerTest#testCaptionInsetsStateAssemble Test: atest InsetsSourceTest#testCalculateInsets_caption_resizing Change-Id: I1728628eccb32b912210a64fe3a1c9cbe9e3b302 --- core/java/android/view/InsetsSource.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/java/android/view/InsetsSource.java') diff --git a/core/java/android/view/InsetsSource.java b/core/java/android/view/InsetsSource.java index 033ccef3666d..d3f4b1bf9b81 100644 --- a/core/java/android/view/InsetsSource.java +++ b/core/java/android/view/InsetsSource.java @@ -116,15 +116,15 @@ public class InsetsSource implements Parcelable { if (!ignoreVisibility && !mVisible) { return Insets.NONE; } - if (!getIntersection(frame, relativeFrame, mTmpFrame)) { - return Insets.NONE; - } // During drag-move and drag-resizing, the caption insets position may not get updated // before the app frame get updated. To layout the app content correctly during drag events, // we always return the insets with the corresponding height covering the top. if (getType() == ITYPE_CAPTION_BAR) { return Insets.of(0, frame.height(), 0, 0); } + if (!getIntersection(frame, relativeFrame, mTmpFrame)) { + return Insets.NONE; + } // TODO: Currently, non-floating IME always intersects at bottom due to issues with cutout. // However, we should let the policy decide from the server. -- cgit v1.2.3