Loading core/java/android/app/Notification.java +31 −19 Original line number Diff line number Diff line Loading @@ -5182,17 +5182,22 @@ public class Notification implements Parcelable if (extras.getBoolean(EXTRA_REDUCED_IMAGES)) { return; } boolean isLowRam = ActivityManager.isLowRamDeviceStatic(); if (mLargeIcon != null || largeIcon != null) { Resources resources = context.getResources(); Class<? extends Style> style = getNotificationStyle(); int maxWidth = resources.getDimensionPixelSize(R.dimen.notification_right_icon_size); int maxWidth = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_right_icon_size_low_ram : R.dimen.notification_right_icon_size); int maxHeight = maxWidth; if (MediaStyle.class.equals(style) || DecoratedMediaCustomViewStyle.class.equals(style)) { maxHeight = resources.getDimensionPixelSize( R.dimen.notification_media_image_max_height); maxWidth = resources.getDimensionPixelSize( R.dimen.notification_media_image_max_width); maxHeight = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_media_image_max_height_low_ram : R.dimen.notification_media_image_max_height); maxWidth = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_media_image_max_width_low_ram : R.dimen.notification_media_image_max_width); } if (mLargeIcon != null) { mLargeIcon.scaleDownIfNecessary(maxWidth, maxHeight); Loading @@ -5201,19 +5206,22 @@ public class Notification implements Parcelable largeIcon = Icon.scaleDownIfNecessary(largeIcon, maxWidth, maxHeight); } } reduceImageSizesForRemoteView(contentView, context); reduceImageSizesForRemoteView(headsUpContentView, context); reduceImageSizesForRemoteView(bigContentView, context); reduceImageSizesForRemoteView(contentView, context, isLowRam); reduceImageSizesForRemoteView(headsUpContentView, context, isLowRam); reduceImageSizesForRemoteView(bigContentView, context, isLowRam); extras.putBoolean(EXTRA_REDUCED_IMAGES, true); } private void reduceImageSizesForRemoteView(RemoteViews remoteView, Context context) { private void reduceImageSizesForRemoteView(RemoteViews remoteView, Context context, boolean isLowRam) { if (remoteView != null) { Resources resources = context.getResources(); int maxWidth = resources.getDimensionPixelSize( R.dimen.notification_custom_view_max_image_width); int maxHeight = resources.getDimensionPixelSize( R.dimen.notification_custom_view_max_image_height); int maxWidth = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_custom_view_max_image_width_low_ram : R.dimen.notification_custom_view_max_image_width); int maxHeight = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_custom_view_max_image_height_low_ram : R.dimen.notification_custom_view_max_image_height); remoteView.reduceImageSizes(maxWidth, maxHeight); } } Loading Loading @@ -5629,16 +5637,20 @@ public class Notification implements Parcelable public void reduceImageSizes(Context context) { super.reduceImageSizes(context); Resources resources = context.getResources(); boolean isLowRam = ActivityManager.isLowRamDeviceStatic(); if (mPicture != null) { int maxPictureWidth = resources.getDimensionPixelSize( R.dimen.notification_big_picture_max_height); int maxPictureHeight = resources.getDimensionPixelSize( R.dimen.notification_big_picture_max_width); int maxPictureWidth = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_big_picture_max_height_low_ram : R.dimen.notification_big_picture_max_height); int maxPictureHeight = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_big_picture_max_width_low_ram : R.dimen.notification_big_picture_max_width); mPicture = Icon.scaleDownIfNecessary(mPicture, maxPictureWidth, maxPictureHeight); } if (mBigLargeIcon != null) { int rightIconSize = resources.getDimensionPixelSize( R.dimen.notification_right_icon_size); int rightIconSize = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_right_icon_size_low_ram : R.dimen.notification_right_icon_size); mBigLargeIcon.scaleDownIfNecessary(rightIconSize, rightIconSize); } } Loading core/res/res/values/dimens.xml +15 −0 Original line number Diff line number Diff line Loading @@ -592,6 +592,21 @@ <!-- The size of the right icon --> <dimen name="notification_right_icon_size">40dp</dimen> <!-- The maximum height of any image in a remote view. This is applied to all images in custom remoteviews. --> <dimen name="notification_custom_view_max_image_height_low_ram">208dp</dimen> <!-- The maximum height of any image in a remote view. This is applied to all images in custom remoteviews. --> <dimen name="notification_custom_view_max_image_width_low_ram">294dp</dimen> <!-- The maximum height of a big picture in a notification. The images will be reduced to that height in case they are bigger. --> <dimen name="notification_big_picture_max_height_low_ram">208dp</dimen> <!-- The maximum width of a big picture in a notification. The images will be reduced to that width in case they are bigger. --> <dimen name="notification_big_picture_max_width_low_ram">294dp</dimen> <!-- The maximum height of a image in a media notification. The images will be reduced to that height in case they are bigger. --> <dimen name="notification_media_image_max_height_low_ram">100dp</dimen> <!-- The maximum width of a image in a media notification. The images will be reduced to that width in case they are bigger.--> <dimen name="notification_media_image_max_width_low_ram">100dp</dimen> <!-- The size of the right icon image when on low ram --> <dimen name="notification_right_icon_size_low_ram">40dp</dimen> <!-- Max width/height of the autofill data set picker as a fraction of the screen width/height --> <dimen name="autofill_dataset_picker_max_size">90%</dimen> Loading core/res/res/values/symbols.xml +8 −0 Original line number Diff line number Diff line Loading @@ -2931,6 +2931,14 @@ <java-symbol type="dimen" name="notification_custom_view_max_image_height"/> <java-symbol type="dimen" name="notification_custom_view_max_image_width"/> <java-symbol type="dimen" name="notification_big_picture_max_height_low_ram"/> <java-symbol type="dimen" name="notification_big_picture_max_width_low_ram"/> <java-symbol type="dimen" name="notification_media_image_max_width_low_ram"/> <java-symbol type="dimen" name="notification_media_image_max_height_low_ram"/> <java-symbol type="dimen" name="notification_right_icon_size_low_ram"/> <java-symbol type="dimen" name="notification_custom_view_max_image_height_low_ram"/> <java-symbol type="dimen" name="notification_custom_view_max_image_width_low_ram"/> <!-- Accessibility fingerprint gestures --> <java-symbol type="string" name="capability_title_canCaptureFingerprintGestures" /> <java-symbol type="string" name="capability_desc_canCaptureFingerprintGestures" /> Loading Loading
core/java/android/app/Notification.java +31 −19 Original line number Diff line number Diff line Loading @@ -5182,17 +5182,22 @@ public class Notification implements Parcelable if (extras.getBoolean(EXTRA_REDUCED_IMAGES)) { return; } boolean isLowRam = ActivityManager.isLowRamDeviceStatic(); if (mLargeIcon != null || largeIcon != null) { Resources resources = context.getResources(); Class<? extends Style> style = getNotificationStyle(); int maxWidth = resources.getDimensionPixelSize(R.dimen.notification_right_icon_size); int maxWidth = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_right_icon_size_low_ram : R.dimen.notification_right_icon_size); int maxHeight = maxWidth; if (MediaStyle.class.equals(style) || DecoratedMediaCustomViewStyle.class.equals(style)) { maxHeight = resources.getDimensionPixelSize( R.dimen.notification_media_image_max_height); maxWidth = resources.getDimensionPixelSize( R.dimen.notification_media_image_max_width); maxHeight = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_media_image_max_height_low_ram : R.dimen.notification_media_image_max_height); maxWidth = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_media_image_max_width_low_ram : R.dimen.notification_media_image_max_width); } if (mLargeIcon != null) { mLargeIcon.scaleDownIfNecessary(maxWidth, maxHeight); Loading @@ -5201,19 +5206,22 @@ public class Notification implements Parcelable largeIcon = Icon.scaleDownIfNecessary(largeIcon, maxWidth, maxHeight); } } reduceImageSizesForRemoteView(contentView, context); reduceImageSizesForRemoteView(headsUpContentView, context); reduceImageSizesForRemoteView(bigContentView, context); reduceImageSizesForRemoteView(contentView, context, isLowRam); reduceImageSizesForRemoteView(headsUpContentView, context, isLowRam); reduceImageSizesForRemoteView(bigContentView, context, isLowRam); extras.putBoolean(EXTRA_REDUCED_IMAGES, true); } private void reduceImageSizesForRemoteView(RemoteViews remoteView, Context context) { private void reduceImageSizesForRemoteView(RemoteViews remoteView, Context context, boolean isLowRam) { if (remoteView != null) { Resources resources = context.getResources(); int maxWidth = resources.getDimensionPixelSize( R.dimen.notification_custom_view_max_image_width); int maxHeight = resources.getDimensionPixelSize( R.dimen.notification_custom_view_max_image_height); int maxWidth = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_custom_view_max_image_width_low_ram : R.dimen.notification_custom_view_max_image_width); int maxHeight = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_custom_view_max_image_height_low_ram : R.dimen.notification_custom_view_max_image_height); remoteView.reduceImageSizes(maxWidth, maxHeight); } } Loading Loading @@ -5629,16 +5637,20 @@ public class Notification implements Parcelable public void reduceImageSizes(Context context) { super.reduceImageSizes(context); Resources resources = context.getResources(); boolean isLowRam = ActivityManager.isLowRamDeviceStatic(); if (mPicture != null) { int maxPictureWidth = resources.getDimensionPixelSize( R.dimen.notification_big_picture_max_height); int maxPictureHeight = resources.getDimensionPixelSize( R.dimen.notification_big_picture_max_width); int maxPictureWidth = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_big_picture_max_height_low_ram : R.dimen.notification_big_picture_max_height); int maxPictureHeight = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_big_picture_max_width_low_ram : R.dimen.notification_big_picture_max_width); mPicture = Icon.scaleDownIfNecessary(mPicture, maxPictureWidth, maxPictureHeight); } if (mBigLargeIcon != null) { int rightIconSize = resources.getDimensionPixelSize( R.dimen.notification_right_icon_size); int rightIconSize = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_right_icon_size_low_ram : R.dimen.notification_right_icon_size); mBigLargeIcon.scaleDownIfNecessary(rightIconSize, rightIconSize); } } Loading
core/res/res/values/dimens.xml +15 −0 Original line number Diff line number Diff line Loading @@ -592,6 +592,21 @@ <!-- The size of the right icon --> <dimen name="notification_right_icon_size">40dp</dimen> <!-- The maximum height of any image in a remote view. This is applied to all images in custom remoteviews. --> <dimen name="notification_custom_view_max_image_height_low_ram">208dp</dimen> <!-- The maximum height of any image in a remote view. This is applied to all images in custom remoteviews. --> <dimen name="notification_custom_view_max_image_width_low_ram">294dp</dimen> <!-- The maximum height of a big picture in a notification. The images will be reduced to that height in case they are bigger. --> <dimen name="notification_big_picture_max_height_low_ram">208dp</dimen> <!-- The maximum width of a big picture in a notification. The images will be reduced to that width in case they are bigger. --> <dimen name="notification_big_picture_max_width_low_ram">294dp</dimen> <!-- The maximum height of a image in a media notification. The images will be reduced to that height in case they are bigger. --> <dimen name="notification_media_image_max_height_low_ram">100dp</dimen> <!-- The maximum width of a image in a media notification. The images will be reduced to that width in case they are bigger.--> <dimen name="notification_media_image_max_width_low_ram">100dp</dimen> <!-- The size of the right icon image when on low ram --> <dimen name="notification_right_icon_size_low_ram">40dp</dimen> <!-- Max width/height of the autofill data set picker as a fraction of the screen width/height --> <dimen name="autofill_dataset_picker_max_size">90%</dimen> Loading
core/res/res/values/symbols.xml +8 −0 Original line number Diff line number Diff line Loading @@ -2931,6 +2931,14 @@ <java-symbol type="dimen" name="notification_custom_view_max_image_height"/> <java-symbol type="dimen" name="notification_custom_view_max_image_width"/> <java-symbol type="dimen" name="notification_big_picture_max_height_low_ram"/> <java-symbol type="dimen" name="notification_big_picture_max_width_low_ram"/> <java-symbol type="dimen" name="notification_media_image_max_width_low_ram"/> <java-symbol type="dimen" name="notification_media_image_max_height_low_ram"/> <java-symbol type="dimen" name="notification_right_icon_size_low_ram"/> <java-symbol type="dimen" name="notification_custom_view_max_image_height_low_ram"/> <java-symbol type="dimen" name="notification_custom_view_max_image_width_low_ram"/> <!-- Accessibility fingerprint gestures --> <java-symbol type="string" name="capability_title_canCaptureFingerprintGestures" /> <java-symbol type="string" name="capability_desc_canCaptureFingerprintGestures" /> Loading