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
This commit is contained in:
Dan Sandler
2020-06-29 12:38:17 -04:00
parent 3c34454ae9
commit 633b198a5d

View File

@@ -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;