Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8748724e authored by Sara Ting's avatar Sara Ting
Browse files

Using MIN priority does not collapse the notification by default so make...

Using MIN priority does not collapse the notification by default so make expired digest notification a basic one for now, instead of InboxStyle.

Bug:6282451
Change-Id: Ic979d940f88b22e6005d24eddf77dc86866e9e00
parent a3efed5c
Loading
Loading
Loading
Loading
+54 −50
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ public class AlertReceiver extends BroadcastReceiver {
            String summaryText, long startMillis, long endMillis, long eventId,
            int notificationId, boolean doPopup) {
        return makeBasicNotificationBuilder(context, title, summaryText, startMillis, endMillis,
                eventId, notificationId, doPopup, false, false).getNotification();
                eventId, notificationId, doPopup, false, false).build();
    }

    private static Notification.Builder makeBasicNotificationBuilder(Context context, String title,
@@ -269,7 +269,8 @@ public class AlertReceiver extends BroadcastReceiver {
     * Creates an expanding digest notification for expired events.
     */
    public static Notification makeDigestNotification(Context context,
            List<AlertService.NotificationInfo> notificationInfos, String digestTitle) {
            List<AlertService.NotificationInfo> notificationInfos, String digestTitle,
            boolean expandable) {
        if (notificationInfos == null || notificationInfos.size() < 1) {
            return null;
        }
@@ -302,10 +303,13 @@ public class AlertReceiver extends BroadcastReceiver {
        notificationBuilder.setSmallIcon(R.drawable.stat_notify_calendar);
        notificationBuilder.setContentIntent(pendingClickIntent);
        notificationBuilder.setDeleteIntent(pendingDeleteIntent);

        String nEventsStr = res.getQuantityString(R.plurals.Nevents, numEvents, numEvents);
        notificationBuilder.setContentText(nEventsStr);

        // Set to min priority to encourage the notification manager to collapse it.
        notificationBuilder.setPriority(Notification.PRIORITY_MIN);

        if (expandable) {
            // Multiple reminders.  Combine into an expanded digest notification.
            Notification.InboxStyle expandedBuilder = new Notification.InboxStyle(
                    notificationBuilder);
@@ -354,10 +358,10 @@ public class AlertReceiver extends BroadcastReceiver {
            // Remove the title in the expanded form (redundant with the listed items).
            expandedBuilder.setBigContentTitle("");

        // Set to min priority to encourage the notification manager to collapse it.
        notificationBuilder.setPriority(Notification.PRIORITY_MIN);

            return expandedBuilder.build();
        } else {
            return notificationBuilder.build();
        }
    }

    private static final String[] ATTENDEES_PROJECTION = new String[] {
+1 −1
Original line number Diff line number Diff line
@@ -252,7 +252,7 @@ public class AlertService extends Service {
            } else {
                // Multiple expired events are listed in a digest.
                notification = AlertReceiver.makeDigestNotification(context,
                    expiredEvents, expiredDigestTitle);
                    expiredEvents, expiredDigestTitle, false);
            }

            // Add options for a quiet update.