Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9140a72 authored by Chet Haase's avatar Chet Haase
Browse files

Fix invalidation bug with View bounds properties

When setLeft/Right/Top/Bottom() functions were called on View,
invalidation was only happening at the parent level. When an
app is hardware accelerated, this means that the view's display
list is not being recreated. So views that were changing size due
to these calls were not getting redrawn properly, causing some
artifacts in animations (especially LayoutTransition, which
calls these setters).

Fix is to invalidate the child instead of just the child's bounds
in the parent.

Change-Id: Ic8b2a5db519345dce617f914c2214738f22031b2
parent 260a13a9
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -212,4 +212,13 @@ class KeyframeSet {
        // shouldn't reach here
        return mLastKeyframe.getValue();
    }

    @Override
    public String toString() {
        String returnVal = " ";
        for (int i = 0; i < mNumKeyframes; ++i) {
            returnVal += mKeyframes.get(i).getValue() + "  ";
        }
        return returnVal;
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -394,4 +394,16 @@ public final class ObjectAnimator extends ValueAnimator {
        final ObjectAnimator anim = (ObjectAnimator) super.clone();
        return anim;
    }

    @Override
    public String toString() {
        String returnVal = "ObjectAnimator@" + Integer.toHexString(hashCode()) + ", target " +
            mTarget;
        if (mValues != null) {
            for (int i = 0; i < mValues.length; ++i) {
                returnVal += "\n    " + mValues[i].toString();
            }
        }
        return returnVal;
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -578,6 +578,11 @@ public class PropertyValuesHolder implements Cloneable {
        return mAnimatedValue;
    }

    @Override
    public String toString() {
        return mPropertyName + ": " + mKeyframeSet.toString();
    }

    /**
     * Utility method to derive a setter/getter method name from a property name, where the
     * prefix is typically "set" or "get" and the first letter of the property name is
+11 −0
Original line number Diff line number Diff line
@@ -1207,4 +1207,15 @@ public class ValueAnimator extends Animator {
        sPendingAnimations.get().clear();
        sDelayedAnims.get().clear();
    }

    @Override
    public String toString() {
        String returnVal = "ValueAnimator@" + Integer.toHexString(hashCode());
        if (mValues != null) {
            for (int i = 0; i < mValues.length; ++i) {
                returnVal += "\n    " + mValues[i].toString();
            }
        }
        return returnVal;
    }
}
+8 −20
Original line number Diff line number Diff line
@@ -6061,9 +6061,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        if (top != mTop) {
            updateMatrix();
            if (mMatrixIsIdentity) {
                final ViewParent p = mParent;
                if (p != null && mAttachInfo != null) {
                    final Rect r = mAttachInfo.mTmpInvalRect;
                if (mAttachInfo != null) {
                    int minTop;
                    int yLoc;
                    if (top < mTop) {
@@ -6073,8 +6071,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
                        minTop = mTop;
                        yLoc = 0;
                    }
                    r.set(0, yLoc, mRight - mLeft, mBottom - minTop);
                    p.invalidateChild(this, r);
                    invalidate(0, yLoc, mRight - mLeft, mBottom - minTop);
                }
            } else {
                // Double-invalidation is necessary to capture view's old and new areas
@@ -6131,17 +6128,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        if (bottom != mBottom) {
            updateMatrix();
            if (mMatrixIsIdentity) {
                final ViewParent p = mParent;
                if (p != null && mAttachInfo != null) {
                    final Rect r = mAttachInfo.mTmpInvalRect;
                if (mAttachInfo != null) {
                    int maxBottom;
                    if (bottom < mBottom) {
                        maxBottom = mBottom;
                    } else {
                        maxBottom = bottom;
                    }
                    r.set(0, 0, mRight - mLeft, maxBottom - mTop);
                    p.invalidateChild(this, r);
                    invalidate(0, 0, mRight - mLeft, maxBottom - mTop);
                }
            } else {
                // Double-invalidation is necessary to capture view's old and new areas
@@ -6189,9 +6183,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        if (left != mLeft) {
            updateMatrix();
            if (mMatrixIsIdentity) {
                final ViewParent p = mParent;
                if (p != null && mAttachInfo != null) {
                    final Rect r = mAttachInfo.mTmpInvalRect;
                if (mAttachInfo != null) {
                    int minLeft;
                    int xLoc;
                    if (left < mLeft) {
@@ -6201,8 +6193,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
                        minLeft = mLeft;
                        xLoc = 0;
                    }
                    r.set(xLoc, 0, mRight - minLeft, mBottom - mTop);
                    p.invalidateChild(this, r);
                    invalidate(xLoc, 0, mRight - minLeft, mBottom - mTop);
                }
            } else {
                // Double-invalidation is necessary to capture view's old and new areas
@@ -6250,17 +6241,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        if (right != mRight) {
            updateMatrix();
            if (mMatrixIsIdentity) {
                final ViewParent p = mParent;
                if (p != null && mAttachInfo != null) {
                    final Rect r = mAttachInfo.mTmpInvalRect;
                if (mAttachInfo != null) {
                    int maxRight;
                    if (right < mRight) {
                        maxRight = mRight;
                    } else {
                        maxRight = right;
                    }
                    r.set(0, 0, maxRight - mLeft, mBottom - mTop);
                    p.invalidateChild(this, r);
                    invalidate(0, 0, maxRight - mLeft, mBottom - mTop);
                }
            } else {
                // Double-invalidation is necessary to capture view's old and new areas