From d1e0cec51894ffe1971a687740c91814eb5c998f Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Fri, 1 Jul 2016 16:55:30 -0700 Subject: Avoid unnecessary layout passes from insets callbacks if they haven't changed Change-Id: Ia7560bd466ff47103811a1a1795af5a5a25abb59 --- src/com/android/launcher3/InsettableFrameLayout.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/android/launcher3/InsettableFrameLayout.java b/src/com/android/launcher3/InsettableFrameLayout.java index db4d85516..154641cab 100644 --- a/src/com/android/launcher3/InsettableFrameLayout.java +++ b/src/com/android/launcher3/InsettableFrameLayout.java @@ -43,6 +43,10 @@ public class InsettableFrameLayout extends FrameLayout implements @Override public void setInsets(Rect insets) { + // If the insets haven't changed, this is a no-op. Avoid unnecessary layout caused by + // modifying child layout params. + if (insets.equals(mInsets)) return; + final int n = getChildCount(); for (int i = 0; i < n; i++) { final View child = getChildAt(i); -- cgit v1.2.3