| Index: chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java
|
| index ff0529ece0607c7b1639dd0bef2502ca81c313dc..f13bd44ac299aaa35ba3914f4ddec5f6bc7e948e 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java
|
| @@ -483,18 +483,22 @@ public class MediaNotificationManager {
|
| }
|
|
|
| /**
|
| - * Scales |icon| to the size returned by {@link getIdealMediaImageSize()}. Returns null if
|
| - * |icon| is null.
|
| + * Downscale |icon| for display in the notification if needed. Returns null if |icon| is null.
|
| + * If |icon| is larger than {@link getIdealMediaImageSize()}, scale it down to
|
| + * {@link getIdealMediaImageSize()} and return. Otherwise return the original |icon|.
|
| * @param icon The icon to be scaled.
|
| */
|
| @Nullable
|
| - public static Bitmap scaleIconToIdealSize(Bitmap icon) {
|
| + public static Bitmap downscaleIconToIdealSize(@Nullable Bitmap icon) {
|
| if (icon == null) return null;
|
|
|
| int targetSize = getIdealMediaImageSize();
|
|
|
| Matrix m = new Matrix();
|
| int dominantLength = Math.max(icon.getWidth(), icon.getHeight());
|
| +
|
| + if (dominantLength < getIdealMediaImageSize()) return icon;
|
| +
|
| // Move the center to (0,0).
|
| m.postTranslate(icon.getWidth() / -2.0f, icon.getHeight() / -2.0f);
|
| // Scale to desired size.
|
| @@ -843,7 +847,7 @@ public class MediaNotificationManager {
|
| int resourceId = (mMediaNotificationInfo.defaultNotificationLargeIcon != 0)
|
| ? mMediaNotificationInfo.defaultNotificationLargeIcon
|
| : R.drawable.audio_playing_square;
|
| - mDefaultNotificationLargeIcon = scaleIconToIdealSize(
|
| + mDefaultNotificationLargeIcon = downscaleIconToIdealSize(
|
| BitmapFactory.decodeResource(mContext.getResources(), resourceId));
|
| }
|
| builder.setLargeIcon(mDefaultNotificationLargeIcon);
|
|
|