Catch SecurityException while resolving image to avoid crashing.

Need catch SecurityException while resolving image from a uri to avoid
unexpected crashing.

Bug: 121453336
Test: Manually
Change-Id: Idfef5e7593d11c688baddf2666052185d0281f6c
This commit is contained in:
Ahan Wu
2018-12-28 18:43:20 +08:00
parent 5639004225
commit 6745c813d4
2 changed files with 4 additions and 4 deletions

View File

@@ -87,8 +87,8 @@ public class NotificationInlineImageCache implements NotificationInlineImageReso
try {
drawable = mResolver.resolveImage(target);
} catch (IOException ex) {
Log.d(TAG, "PreloadImageTask: Resolve failed from " + target);
} catch (IOException | SecurityException ex) {
Log.d(TAG, "PreloadImageTask: Resolve failed from " + target, ex);
}
return drawable;

View File

@@ -81,8 +81,8 @@ public class NotificationInlineImageResolver implements ImageResolver {
Drawable result = null;
try {
result = hasCache() ? mImageCache.get(uri) : resolveImage(uri);
} catch (IOException ex) {
Log.d(TAG, "loadImage: Can't load image from " + uri);
} catch (IOException | SecurityException ex) {
Log.d(TAG, "loadImage: Can't load image from " + uri, ex);
}
return result;
}