From 633b198a5de18f5747002ae85f37ac1703a5b985 Mon Sep 17 00:00:00 2001 From: Dan Sandler Date: Mon, 29 Jun 2020 12:38:17 -0400 Subject: [PATCH] Throw IOE from within resolveImage rather than NPE. The failure will get handled gracefully by the caller (in this case, loadImage()). Fixes: 159780182 Test: atest frameworks/base/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java Change-Id: I7af94d4a85d3e3fddd435ebb1f6e16042529c31c --- .../notification/row/NotificationInlineImageResolver.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolver.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolver.java index 52f7c2cfee96c..7bd192d850c15 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolver.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolver.java @@ -124,6 +124,9 @@ public class NotificationInlineImageResolver implements ImageResolver { */ Drawable resolveImage(Uri uri) throws IOException { BitmapDrawable image = resolveImageInternal(uri); + if (image == null || image.getBitmap() == null) { + throw new IOException("resolveImageInternal returned null for uri: " + uri); + } Bitmap bitmap = image.getBitmap(); image.setBitmap(Icon.scaleDownIfNecessary(bitmap, mMaxImageWidth, mMaxImageHeight)); return image;