| Index: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderBase.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderBase.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderBase.java
|
| index 836d607cf0618434759488a9a005defc5695dbf7..ffb3136b989940c66705fdf6111be7510e2e6963 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderBase.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderBase.java
|
| @@ -67,6 +67,7 @@
|
| protected CharSequence mTickerText;
|
| protected Bitmap mLargeIcon;
|
| protected int mSmallIconId;
|
| + protected Bitmap mSmallIconBitmap;
|
| protected PendingIntent mContentIntent;
|
| protected PendingIntent mDeleteIntent;
|
| protected List<Action> mActions = new ArrayList<>(MAX_AUTHOR_PROVIDED_ACTION_BUTTONS);
|
| @@ -122,7 +123,9 @@ public NotificationBuilderBase setLargeIcon(@Nullable Bitmap icon) {
|
| }
|
|
|
| /**
|
| - * Sets the the small icon that is shown in the notification and in the status bar.
|
| + * Sets the small icon that is shown in the notification and in the status bar. Wherever the
|
| + * platform supports using a small icon bitmap, and a non-null {@code Bitmap} is provided, it
|
| + * will take precedence over one specified as a resource id.
|
| */
|
| public NotificationBuilderBase setSmallIcon(int iconId) {
|
| mSmallIconId = iconId;
|
| @@ -130,6 +133,19 @@ public NotificationBuilderBase setSmallIcon(int iconId) {
|
| }
|
|
|
| /**
|
| + * Sets the small icon that is shown in the notification and in the status bar. Wherever the
|
| + * platform supports using a small icon bitmap, and a non-null {@code Bitmap} is provided, it
|
| + * will take precedence over one specified as a resource id.
|
| + */
|
| + public NotificationBuilderBase setSmallIcon(@Nullable Bitmap iconBitmap) {
|
| + if (iconBitmap != null) {
|
| + applyWhiteOverlayToBitmap(iconBitmap);
|
| + }
|
| + mSmallIconBitmap = iconBitmap;
|
| + return this;
|
| + }
|
| +
|
| + /**
|
| * Sets the PendingIntent to send when the notification is clicked.
|
| */
|
| public NotificationBuilderBase setContentIntent(@Nullable PendingIntent intent) {
|
| @@ -223,6 +239,20 @@ private static CharSequence limitLength(@Nullable CharSequence input) {
|
| }
|
|
|
| /**
|
| + * Sets the small icon on {@code builder} using a {@code Bitmap} if a non-null bitmap is
|
| + * provided and the API level is high enough, otherwise the resource id is used.
|
| + */
|
| + @TargetApi(Build.VERSION_CODES.M) // For the Icon class.
|
| + protected static void setSmallIconOnBuilder(
|
| + Notification.Builder builder, int iconId, @Nullable Bitmap iconBitmap) {
|
| + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && iconBitmap != null) {
|
| + builder.setSmallIcon(Icon.createWithBitmap(iconBitmap));
|
| + } else {
|
| + builder.setSmallIcon(iconId);
|
| + }
|
| + }
|
| +
|
| + /**
|
| * Adds an action to {@code builder} using a {@code Bitmap} if a bitmap is provided and the API
|
| * level is high enough, otherwise a resource id is used.
|
| */
|
|
|