diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java | 2 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSIconViewImplTest.java | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java index e9a6c25c0e6d..1f92b12c1a83 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java @@ -140,7 +140,7 @@ public class QSIconViewImpl extends QSIconView { iv.setTag(R.id.qs_icon_tag, icon); iv.setTag(R.id.qs_slash_tag, state.slash); iv.setPadding(0, padding, 0, padding); - if (d instanceof Animatable2) { + if (shouldAnimate && d instanceof Animatable2) { Animatable2 a = (Animatable2) d; a.start(); if (state.isTransient) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSIconViewImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSIconViewImplTest.java index 2c76be64aa7c..b067ee76f3b3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSIconViewImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSIconViewImplTest.java @@ -24,6 +24,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; import android.service.quicksettings.Tile; import android.testing.AndroidTestingRunner; @@ -136,6 +137,20 @@ public class QSIconViewImplTest extends SysuiTestCase { assertEquals(mIconView.getColor(s1), mIconView.getColor(s2)); } + @Test + public void testIconNotAnimatedWhenAllowAnimationsFalse() { + ImageView iv = new ImageView(mContext); + AnimatedVectorDrawable d = mock(AnimatedVectorDrawable.class); + State s = new State(); + s.icon = mock(Icon.class); + when(s.icon.getDrawable(any())).thenReturn(d); + when(s.icon.getInvisibleDrawable(any())).thenReturn(d); + + mIconView.updateIcon(iv, s, false); + + verify(d, never()).start(); + } + private static Drawable.ConstantState fakeConstantState(Drawable otherDrawable) { return new Drawable.ConstantState() { @Override |