From 71f2c31469ed9628d744d20b86eaf188cfdf686d Mon Sep 17 00:00:00 2001 From: Chong Zhang Date: Thu, 16 Jun 2016 17:28:25 -0700 Subject: Do a forceLayout if pending insets is changed after relayout window We might have a pending MSG_RESIZED_REPORT, but if it's executed after relayoutWindow, mPendingInsets will already be the new value and it'll not forceLayout. So we need to forceLayout here to make sure the measure cache is cleared. bug: 29391054 Change-Id: I73793b1427b89e75700369ec3b37053a6a732f0d --- core/java/android/view/ViewRootImpl.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 19b1cf3c86ba..48bdcb2e6720 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -1814,6 +1814,19 @@ public final class ViewRootImpl implements ViewParent, + mAttachInfo.mVisibleInsets); } + // If any of the insets changed, do a forceLayout on the view so that the + // measure cache is cleared. We might have a pending MSG_RESIZED_REPORT + // that is supposed to take care of it, but since pending insets are + // already modified here, it won't detect the frame change after this. + final boolean framesChanged = overscanInsetsChanged + || contentInsetsChanged + || stableInsetsChanged + || visibleInsetsChanged + || outsetsChanged; + if (mAdded && mView != null && framesChanged) { + forceLayout(mView); + } + if (!hadSurface) { if (mSurface.isValid()) { // If we are creating a new surface, then we need to -- cgit v1.2.3-59-g8ed1b