Index: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java |
index 7665c5f0c9f6f14e7a65b8c499d594be4777e381..c2100afba57ddf21f1b32eceef476c74381a5808 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java |
@@ -229,12 +229,13 @@ public class NotificationUIManager { |
* @param icon Icon to be displayed in the notification. When this isn't a valid Bitmap, a |
* default icon will be generated instead. |
* @param origin Full text of the origin, including the protocol, owning this notification. |
+ * @param silent Whether the default sound, vibration and lights should be suppressed. |
* @param notificationData Serialized data associated with the notification. |
* @return The id using which the notification can be identified. |
*/ |
@CalledByNative |
private int displayNotification(String tag, String notificationId, String title, String body, |
- Bitmap icon, String origin, byte[] notificationData) { |
+ Bitmap icon, String origin, boolean silent, byte[] notificationData) { |
if (icon == null || icon.getWidth() == 0) { |
icon = getIconGenerator().generateIconForUrl(origin, true); |
} |
@@ -255,7 +256,6 @@ public class NotificationUIManager { |
.setStyle(new NotificationCompat.BigTextStyle().bigText(body)) |
.setLargeIcon(icon) |
.setSmallIcon(R.drawable.notification_badge) |
- .setDefaults(Notification.DEFAULT_ALL) |
.setContentIntent(getPendingIntent( |
NotificationConstants.ACTION_CLICK_NOTIFICATION, |
notificationId, mLastNotificationId, notificationData)) |
@@ -267,6 +267,10 @@ public class NotificationUIManager { |
pendingSettingsIntent) |
.setSubText(origin); |
+ // Use the system's default ringtone, vibration and indicator lights unless the notification |
+ // has been marked as being silent, for example because it's low priority. |
+ if (!silent) notificationBuilder.setDefaults(Notification.DEFAULT_ALL); |
+ |
String platformTag = makePlatformTag(tag, mLastNotificationId, origin); |
mNotificationManager.notify(platformTag, mLastNotificationId, notificationBuilder.build()); |