| 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 8bd36d8bb5011a4face4cd28299005a1e017fc8f..2a4f0e2867bce13e16c281d2c0b15530b61f5823 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
|
| @@ -367,16 +367,7 @@ public class MediaNotificationManager {
|
| public static Bitmap scaleIconForDisplay(Bitmap icon) {
|
| if (icon == null) return null;
|
|
|
| - int largeIconSizePx;
|
| - if (isRunningN()) {
|
| - largeIconSizePx = (int) TypedValue.applyDimension(
|
| - TypedValue.COMPLEX_UNIT_DIP, N_LARGE_ICON_SIZE_DP,
|
| - ContextUtils.getApplicationContext().getResources().getDisplayMetrics());
|
| - } else {
|
| - largeIconSizePx = (int) TypedValue.applyDimension(
|
| - TypedValue.COMPLEX_UNIT_DIP, PRE_N_LARGE_ICON_SIZE_DP,
|
| - ContextUtils.getApplicationContext().getResources().getDisplayMetrics());
|
| - }
|
| + int largeIconSizePx = getMaximumLargeIconSize();
|
|
|
| if (icon.getWidth() > largeIconSizePx || icon.getHeight() > largeIconSizePx) {
|
| return icon.createScaledBitmap(
|
| @@ -386,6 +377,24 @@ public class MediaNotificationManager {
|
| return icon;
|
| }
|
|
|
| + /**
|
| + * @return Prefered maximum large icon size. If the large icon is larger than this size, then it
|
| + * needs to be scaled.
|
| + */
|
| + public static int getMaximumLargeIconSize() {
|
| + int maxLargeIconSizePx;
|
| + if (isRunningN()) {
|
| + maxLargeIconSizePx = (int) TypedValue.applyDimension(
|
| + TypedValue.COMPLEX_UNIT_DIP, N_LARGE_ICON_SIZE_DP,
|
| + ContextUtils.getApplicationContext().getResources().getDisplayMetrics());
|
| + } else {
|
| + maxLargeIconSizePx = (int) TypedValue.applyDimension(
|
| + TypedValue.COMPLEX_UNIT_DIP, PRE_N_LARGE_ICON_SIZE_DP,
|
| + ContextUtils.getApplicationContext().getResources().getDisplayMetrics());
|
| + }
|
| + return maxLargeIconSizePx;
|
| + }
|
| +
|
| private static MediaNotificationManager getManager(int notificationId) {
|
| if (sManagers == null) return null;
|
|
|
|
|