From 6745c813d407e8208a5ef2ee13551b5868a67658 Mon Sep 17 00:00:00 2001 From: Ahan Wu Date: Fri, 28 Dec 2018 18:43:20 +0800 Subject: [PATCH] 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 --- .../notification/row/NotificationInlineImageCache.java | 4 ++-- .../notification/row/NotificationInlineImageResolver.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageCache.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageCache.java index 8c8bad2ab1960..a5411ecb4bd0c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageCache.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageCache.java @@ -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; 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 588246f3d2c64..a3e13053d169d 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 @@ -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; }