Merge "Fix blocked notifications screen" into rvc-dev am: 1528d932ed
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/11808483 Change-Id: Iafdae12f789f21d26c59d74382b5a147feeb0454
This commit is contained in:
@@ -84,6 +84,9 @@ public class AppStateNotificationBridge extends AppStateBaseBridge {
|
|||||||
for (AppEntry entry : apps) {
|
for (AppEntry entry : apps) {
|
||||||
NotificationsSentState stats =
|
NotificationsSentState stats =
|
||||||
map.get(getKey(UserHandle.getUserId(entry.info.uid), entry.info.packageName));
|
map.get(getKey(UserHandle.getUserId(entry.info.uid), entry.info.packageName));
|
||||||
|
if (stats == null) {
|
||||||
|
stats = new NotificationsSentState();
|
||||||
|
}
|
||||||
calculateAvgSentCounts(stats);
|
calculateAvgSentCounts(stats);
|
||||||
addBlockStatus(entry, stats);
|
addBlockStatus(entry, stats);
|
||||||
entry.extraInfo = stats;
|
entry.extraInfo = stats;
|
||||||
|
@@ -211,7 +211,12 @@ public class AppStateNotificationBridgeTest {
|
|||||||
when(mSession.getAllApps()).thenReturn(apps);
|
when(mSession.getAllApps()).thenReturn(apps);
|
||||||
|
|
||||||
mBridge.loadAllExtraInfo();
|
mBridge.loadAllExtraInfo();
|
||||||
assertThat(apps.get(0).extraInfo).isNull();
|
// extra info should exist and blocked status should be populated
|
||||||
|
assertThat(apps.get(0).extraInfo).isNotNull();
|
||||||
|
verify(mBackend).getNotificationsBanned(PKG1, 0);
|
||||||
|
// but the recent/frequent counts should be 0 so they don't appear on those screens
|
||||||
|
assertThat(((NotificationsSentState) apps.get(0).extraInfo).avgSentDaily).isEqualTo(0);
|
||||||
|
assertThat(((NotificationsSentState) apps.get(0).extraInfo).lastSent).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user