File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
graphics/java/android/graphics/drawable Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -575,6 +575,11 @@ public ConstantState getConstantState() {
575575 @ Override
576576 public Drawable mutate () {
577577 if (!mMutated && super .mutate () == this ) {
578+ if (!mLayerState .canConstantState ()) {
579+ throw new IllegalStateException ("One or more children of this LayerDrawable does " +
580+ "not have constant state; this drawable cannot be mutated." );
581+ }
582+ mLayerState = new LayerState (mLayerState , this , null );
578583 final ChildDrawable [] array = mLayerState .mChildren ;
579584 final int N = mLayerState .mNum ;
580585 for (int i = 0 ; i < N ; i ++) {
@@ -694,7 +699,7 @@ public final boolean isStateful() {
694699 return stateful ;
695700 }
696701
697- public synchronized boolean canConstantState () {
702+ public boolean canConstantState () {
698703 if (!mCheckedConstantState && mChildren != null ) {
699704 mCanConstantState = true ;
700705 final int N = mNum ;
You can’t perform that action at this time.
0 commit comments