diff options
Diffstat (limited to 'core/java/android/view/View.java')
-rw-r--r-- | core/java/android/view/View.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 080e7c0..97287c3 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -15509,17 +15509,27 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * handle possible request-during-layout errors correctly.</p> */ public void requestLayout() { - ViewRootImpl viewRoot = getViewRootImpl(); - if (viewRoot != null && viewRoot.isInLayout()) { - viewRoot.requestLayoutDuringLayout(this); - return; + if (mAttachInfo != null && mAttachInfo.mViewRequestingLayout == null) { + // Only trigger request-during-layout logic if this is the view requesting it, + // not the views in its parent hierarchy + ViewRootImpl viewRoot = getViewRootImpl(); + if (viewRoot != null && viewRoot.isInLayout()) { + if (!viewRoot.requestLayoutDuringLayout(this)) { + return; + } + } + mAttachInfo.mViewRequestingLayout = this; } + mPrivateFlags |= PFLAG_FORCE_LAYOUT; mPrivateFlags |= PFLAG_INVALIDATED; if (mParent != null && !mParent.isLayoutRequested()) { mParent.requestLayout(); } + if (mAttachInfo != null && mAttachInfo.mViewRequestingLayout == this) { + mAttachInfo.mViewRequestingLayout = null; + } } /** @@ -18000,6 +18010,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, final Point mPoint = new Point(); /** + * Used to track which View originated a requestLayout() call, used when + * requestLayout() is called during layout. + */ + View mViewRequestingLayout; + + /** * Creates a new set of attachment information with the specified * events handler and thread. * |