summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSIconViewImplTest.java16
2 files changed, 17 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 a567f6b037be..6e2add493779 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java
@@ -116,7 +116,7 @@ public class QSIconViewImpl extends QSIconView {
if (state.state != mState) {
int color = getColor(state.state);
mState = state.state;
- if (iv.isShown()) {
+ if (iv.isShown() && mTint != 0) {
animateGrayScale(mTint, color, iv);
mTint = color;
} else {
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 bb4571c7413a..59483f2df5bb 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
@@ -15,12 +15,15 @@
package com.android.systemui.qs.tileimpl;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
+import android.service.quicksettings.Tile;
import android.testing.AndroidTestingRunner;
import android.testing.UiThreadTest;
import android.widget.ImageView;
@@ -32,6 +35,7 @@ import com.android.systemui.plugins.qs.QSTile.State;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatcher;
@RunWith(AndroidTestingRunner.class)
@UiThreadTest
@@ -64,4 +68,16 @@ public class QSIconViewImplTest extends SysuiTestCase {
verify(s.icon).getDrawable(any());
verify(s.icon, never()).getInvisibleDrawable(any());
}
+
+ @Test
+ public void testNoFirstFade() {
+ ImageView iv = mock(ImageView.class);
+ State s = new State();
+ s.state = Tile.STATE_ACTIVE;
+ int desiredColor = mIconView.getColor(s.state);
+ when(iv.isShown()).thenReturn(true);
+
+ mIconView.setIcon(iv, s);
+ verify(iv).setImageTintList(argThat(stateList -> stateList.getColors()[0] == desiredColor));
+ }
}