summaryrefslogtreecommitdiff
path: root/core/java/android/widget/RemoteViews.java
diff options
context:
space:
mode:
authorSelim Cinek <cinek@google.com>2017-07-11 13:19:59 +0200
committerSelim Cinek <cinek@google.com>2017-07-19 11:05:26 -0700
commitd0426628f60d063836c0dce691d4698b12434724 (patch)
tree654b147dc46f74c58c3195c0994f672c85e28165 /core/java/android/widget/RemoteViews.java
parentac86bc8764a30677cac34f07fc8e3ed68316136a (diff)
Reducing bitmap sizes in notifications
Bitmap sizes could be arbitrary large when they were sent over to the system. We're now reducing them to reasonable sizes.s Also fixed that notification bitmaps were not put into ashmem anymore since it got lost in a refactor. Test: code inspection Bug: 62319200 Change-Id: I87db7656e749666b9eab1f67fd497f155c407e18
Diffstat (limited to 'core/java/android/widget/RemoteViews.java')
-rw-r--r--core/java/android/widget/RemoteViews.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 454f5b74aeb4..b77aa1c6888a 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -199,6 +199,22 @@ public class RemoteViews implements Parcelable, Filter {
}
/**
+ * Reduces all images and ensures that they are all below the given sizes.
+ *
+ * @param maxWidth the maximum width allowed
+ * @param maxHeight the maximum height allowed
+ *
+ * @hide
+ */
+ public void reduceImageSizes(int maxWidth, int maxHeight) {
+ ArrayList<Bitmap> cache = mBitmapCache.mBitmaps;
+ for (int i = 0; i < cache.size(); i++) {
+ Bitmap bitmap = cache.get(i);
+ cache.set(i, Icon.scaleDownIfNecessary(bitmap, maxWidth, maxHeight));
+ }
+ }
+
+ /**
* Handle with care!
*/
static class MutablePair<F, S> {