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

Commit cabf9cdc authored by Doris Liu's avatar Doris Liu Committed by Android (Google) Code Review
Browse files

Merge "Better error message for AVD" into oc-dev

parents 6746aa8c 03f2fcbd
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -834,6 +834,16 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable2 {
            final Animator localAnimator = animator.clone();
            final String targetName = mTargetNameMap.get(animator);
            final Object target = mVectorDrawable.getTargetByName(targetName);
            if (!mShouldIgnoreInvalidAnim) {
                if (target == null) {
                    throw new IllegalStateException("Target with the name \"" + targetName
                            + "\" cannot be found in the VectorDrawable to be animated.");
                } else if (!(target instanceof VectorDrawable.VectorDrawableState)
                        && !(target instanceof VectorDrawable.VObject)) {
                    throw new UnsupportedOperationException("Target should be either VGroup, VPath,"
                            + " or ConstantState, " + target.getClass() + " is not supported");
                }
            }
            localAnimator.setTarget(target);
            return localAnimator;
        }
@@ -1321,16 +1331,10 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable2 {
                        throw new IllegalArgumentException("ClipPath only supports PathData " +
                                "property");
                    }

                }
            } else if (target instanceof VectorDrawable.VectorDrawableState) {
                createRTAnimatorForRootGroup(values, animator,
                        (VectorDrawable.VectorDrawableState) target, startTime);
            } else if (!mDrawable.mAnimatedVectorState.mShouldIgnoreInvalidAnim) {
                // Should never get here
                throw new UnsupportedOperationException("Target should be either VGroup, VPath, " +
                        "or ConstantState, " + target == null ? "Null target" : target.getClass() +
                        " is not supported");
            }
        }