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

Commit 794f38e9 authored by Daniel Sandler's avatar Daniel Sandler Committed by Isaac Katzenelson
Browse files

Call build() on the Builder, not the Style.

There are bugs in Style.build() around extras that this
avoids. This CL also uses the setStyle() API to make it more
explicit that calling build() on the Builder will still
include everything in the Style.

Bug: 10387352
Change-Id: I285297c955982b1d137f7788f04f60c4a3524338
parent f91fae5b
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -417,8 +417,7 @@ public class AlertReceiver extends BroadcastReceiver {
                priority, true);
        if (Utils.isJellybeanOrLater()) {
            // Create a new-style expanded notification
            Notification.BigTextStyle expandedBuilder = new Notification.BigTextStyle(
                    basicBuilder);
            Notification.BigTextStyle expandedBuilder = new Notification.BigTextStyle();
            if (description != null) {
                description = mBlankLinePattern.matcher(description).replaceAll("");
                description = description.trim();
@@ -436,7 +435,8 @@ public class AlertReceiver extends BroadcastReceiver {
                text = stringBuilder;
            }
            expandedBuilder.bigText(text);
            notification = expandedBuilder.build();
            basicBuilder.setStyle(expandedBuilder);
            notification = basicBuilder.build();
        }
        return new NotificationWrapper(notification, notificationId, eventId, startMillis,
                endMillis, doPopup);
@@ -495,8 +495,7 @@ public class AlertReceiver extends BroadcastReceiver {

            if (expandable) {
                // Multiple reminders.  Combine into an expanded digest notification.
                Notification.InboxStyle expandedBuilder = new Notification.InboxStyle(
                        notificationBuilder);
                Notification.InboxStyle expandedBuilder = new Notification.InboxStyle();
                int i = 0;
                for (AlertService.NotificationInfo info : notificationInfos) {
                    if (i < NOTIFICATION_DIGEST_MAX_LENGTH) {
@@ -541,11 +540,10 @@ public class AlertReceiver extends BroadcastReceiver {

                // Remove the title in the expanded form (redundant with the listed items).
                expandedBuilder.setBigContentTitle("");
                notificationBuilder.setStyle(expandedBuilder);
            }

                n = expandedBuilder.build();
            } else {
            n = notificationBuilder.build();
            }
        } else {
            // Old-style notification (pre-JB).  We only need a standard notification (no
            // buttons) but use a custom view so it is consistent with the others.