Add default icons for all mode types
Also a couple of icon-related fixes: * Use the proper context, since we need theming (this also means it cannot be stored in IconLoader, which is a singleton, and must be supplied). * Force apply the standard size and tint, since app-provided icons may be arbitrary. * Fix the schedule-time icon (the viewport size was incorrect). Bug: 308819461 Fixes: 333528437 Flag: android.app.modes_ui Test: atest com.android.settings.notification.modes Change-Id: Iae447c8c4a0218a8bc989c01d1d56d0c06abd8e7
This commit is contained in:
@@ -21,6 +21,7 @@ import static android.app.NotificationManager.INTERRUPTION_FILTER_PRIORITY;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.app.AutomaticZenRule;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.service.notification.ZenPolicy;
|
||||
@@ -37,12 +38,13 @@ import org.robolectric.RuntimeEnvironment;
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class IconLoaderTest {
|
||||
|
||||
private Context mContext;
|
||||
private IconLoader mLoader;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mLoader = new IconLoader(RuntimeEnvironment.application,
|
||||
MoreExecutors.newDirectExecutorService());
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mLoader = new IconLoader(MoreExecutors.newDirectExecutorService());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -52,7 +54,7 @@ public class IconLoaderTest {
|
||||
.setIconResId(android.R.drawable.ic_media_play)
|
||||
.build();
|
||||
|
||||
ListenableFuture<Drawable> loadFuture = mLoader.getIcon(systemRule);
|
||||
ListenableFuture<Drawable> loadFuture = mLoader.getIcon(mContext, systemRule);
|
||||
assertThat(loadFuture.isDone()).isTrue();
|
||||
assertThat(loadFuture.get()).isNotNull();
|
||||
}
|
||||
@@ -64,7 +66,7 @@ public class IconLoaderTest {
|
||||
.setPackage("com.blah")
|
||||
.build();
|
||||
|
||||
ListenableFuture<Drawable> loadFuture = mLoader.getIcon(rule);
|
||||
ListenableFuture<Drawable> loadFuture = mLoader.getIcon(mContext, rule);
|
||||
assertThat(loadFuture.isDone()).isTrue();
|
||||
assertThat(loadFuture.get()).isNotNull();
|
||||
}
|
||||
@@ -77,7 +79,7 @@ public class IconLoaderTest {
|
||||
.setIconResId(-123456)
|
||||
.build();
|
||||
|
||||
ListenableFuture<Drawable> loadFuture = mLoader.getIcon(rule);
|
||||
ListenableFuture<Drawable> loadFuture = mLoader.getIcon(mContext, rule);
|
||||
assertThat(loadFuture.get()).isNotNull();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user