Add 'notificaton blocked' filter to notifications
Test: robotests Change-Id: I5c0cd9a2f73b6a22d66df7669e944bbe1473539c Fixes: 112576746
This commit is contained in:
@@ -100,18 +100,20 @@ public class AppStateNotificationBridge extends AppStateBaseBridge {
|
||||
}
|
||||
|
||||
public static CharSequence getSummary(Context context, NotificationsSentState state,
|
||||
boolean sortByRecency) {
|
||||
if (sortByRecency) {
|
||||
int sortOrder) {
|
||||
if (sortOrder == R.id.sort_order_recent_notification) {
|
||||
if (state.lastSent == 0) {
|
||||
return context.getString(R.string.notifications_sent_never);
|
||||
}
|
||||
return StringUtil.formatRelativeTime(
|
||||
context, System.currentTimeMillis() - state.lastSent, true);
|
||||
} else {
|
||||
} else if (sortOrder == R.id.sort_order_frequent_notification) {
|
||||
if (state.avgSentWeekly > 0) {
|
||||
return context.getString(R.string.notifications_sent_weekly, state.avgSentWeekly);
|
||||
}
|
||||
return context.getString(R.string.notifications_sent_daily, state.avgSentDaily);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,6 +269,21 @@ public class AppStateNotificationBridge extends AppStateBaseBridge {
|
||||
}
|
||||
};
|
||||
|
||||
public static final AppFilter FILTER_APP_NOTIFICATION_BLOCKED = new AppFilter() {
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean filterApp(AppEntry info) {
|
||||
NotificationsSentState state = getNotificationsSentState(info);
|
||||
if (state != null) {
|
||||
return state.blocked;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
public static final Comparator<AppEntry> RECENT_NOTIFICATION_COMPARATOR
|
||||
= new Comparator<AppEntry>() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user