Check icon tintable flag of the Suggestion.

- instead of checking the icon resource package, check the icon tintable
flag to see if we should tint the suggestion icon.

Bug: 72330968
Test: make RunSettingsRoboTests
Change-Id: I4767df05bebf815774dbd8e528c7ac0f5b902d44
This commit is contained in:
Doris Ling
2018-01-31 16:55:10 -08:00
parent b832f737c3
commit 0e96107ddc
2 changed files with 8 additions and 11 deletions

View File

@@ -215,11 +215,9 @@ public class SuggestionAdapterTest {
}
@Test
public void onBindViewHolder_differentPackage_shouldNotTintIcon()
throws PendingIntent.CanceledException {
public void onBindViewHolder_iconNotTintable_shouldNotTintIcon()
throws PendingIntent.CanceledException {
final Icon icon = mock(Icon.class);
when(icon.getResPackage()).thenReturn("pkg1");
when(mActivity.getPackageName()).thenReturn("pkg2");
final Suggestion suggestion = new Suggestion.Builder("pkg1")
.setPendingIntent(mock(PendingIntent.class))
.setIcon(icon)
@@ -243,15 +241,14 @@ public class SuggestionAdapterTest {
}
@Test
public void onBindViewHolder_samePackage_shouldTintIcon()
throws PendingIntent.CanceledException {
public void onBindViewHolder_iconTintable_shouldTintIcon()
throws PendingIntent.CanceledException {
final Icon icon = mock(Icon.class);
final String packageName = "pkg1";
when(icon.getResPackage()).thenReturn(packageName);
when(mActivity.getPackageName()).thenReturn(packageName);
final Suggestion suggestion = new Suggestion.Builder(packageName)
final int FLAG_ICON_TINTABLE = 1 << 1;
final Suggestion suggestion = new Suggestion.Builder("pkg1")
.setPendingIntent(mock(PendingIntent.class))
.setIcon(icon)
.setFlags(FLAG_ICON_TINTABLE)
.build();
final List<Suggestion> suggestions = new ArrayList<>();
suggestions.add(suggestion);