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

Commit 63b9e973 authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Fix LayerDrawable#mutate"

parents 9a69fea8 26e35fca
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -575,6 +575,11 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
    @Override
    public Drawable mutate() {
        if (!mMutated && super.mutate() == this) {
            if (!mLayerState.canConstantState()) {
                throw new IllegalStateException("One or more children of this LayerDrawable does " +
                        "not have constant state; this drawable cannot be mutated.");
            }
            mLayerState = new LayerState(mLayerState, this, null);
            final ChildDrawable[] array = mLayerState.mChildren;
            final int N = mLayerState.mNum;
            for (int i = 0; i < N; i++) {
@@ -694,7 +699,7 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
            return stateful;
        }

        public synchronized boolean canConstantState() {
        public boolean canConstantState() {
            if (!mCheckedConstantState && mChildren != null) {
                mCanConstantState = true;
                final int N = mNum;