diff options
author | twyen <twyen@google.com> | 2017-10-18 06:32:50 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-10-18 06:32:50 +0000 |
commit | be608de8feeb51ccf19c4978d6175c8264659f99 (patch) | |
tree | 27dc6746a0dd1a030f55386f22488e5af1e56bea /java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java | |
parent | 888823b6cceb77ba19de2aaf12ad61c523489b0e (diff) | |
parent | 5cb3ecff08854c7b3da976f7981d1b9c3ff5bee0 (diff) |
Merge "Support bulk inserted voicemails."
am: 5cb3ecff08
Change-Id: I0da752b47176d1da7c329fe082dde69ec98074a3
Diffstat (limited to 'java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java')
-rw-r--r-- | java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java index 2fd9a2161..4fc956fa8 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java @@ -64,11 +64,16 @@ final class VisualVoicemailNotifier { */ private static final String GROUP_KEY = "VisualVoicemailGroup"; + /** + * @param shouldAlert whether ringtone or vibration should be made when the notification is posted + * or updated. Should only be true when there is a real new voicemail. + */ public static void showNotifications( @NonNull Context context, @NonNull List<NewCall> newCalls, @NonNull Map<String, ContactInfo> contactInfos, - @Nullable String callers) { + @Nullable String callers, + boolean shouldAlert) { LogUtil.enterBlock("VisualVoicemailNotifier.showNotifications"); PendingIntent deleteIntent = CallLogNotificationsService.createMarkAllNewVoicemailsAsOldIntent(context); @@ -86,7 +91,15 @@ final class VisualVoicemailNotifier { .setContentIntent(newVoicemailIntent(context, null)); if (VERSION.SDK_INT >= VERSION_CODES.O) { - groupSummary.setGroupAlertBehavior(Notification.GROUP_ALERT_CHILDREN); + if (shouldAlert) { + groupSummary.setOnlyAlertOnce(false); + // Group summary will alert when posted/updated + groupSummary.setGroupAlertBehavior(Notification.GROUP_ALERT_ALL); + } else { + // Only children will alert. but since all children are set to "only alert summary" it is + // effectively silenced. + groupSummary.setGroupAlertBehavior(Notification.GROUP_ALERT_CHILDREN); + } PhoneAccountHandle handle = getAccountForCall(context, newCalls.get(0)); groupSummary.setChannelId(NotificationChannelManager.getVoicemailChannelId(context, handle)); } @@ -203,6 +216,7 @@ final class VisualVoicemailNotifier { if (VERSION.SDK_INT >= VERSION_CODES.O) { builder.setChannelId(NotificationChannelManager.getVoicemailChannelId(context, handle)); + builder.setGroupAlertBehavior(Notification.GROUP_ALERT_SUMMARY); } ContactPhotoLoader loader = new ContactPhotoLoader(context, contactInfo); |