Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb90e97e authored by Julia Tuttle's avatar Julia Tuttle
Browse files

LocalImageResolver: log when Icon.loadDrawable fails

When an app passes an invalid icon into a BigPictureStyle notification,
we want to know clearly and promptly, so log when we see those icon
loads fail.

Bug: 335878768
Test: manual
Flag: NONE
Change-Id: If7080cdc6876ef9174af344c79e23ab41f057fd4
parent ca660ce3
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -132,7 +132,11 @@ public class LocalImageResolver {


        // Fallback to straight drawable load if we fail with more efficient approach.
        // Fallback to straight drawable load if we fail with more efficient approach.
        try {
        try {
            return icon.loadDrawable(context);
            final Drawable iconDrawable = icon.loadDrawable(context);
            if (iconDrawable == null) {
                Log.w(TAG, "Couldn't load drawable for icon: " + icon);
            }
            return iconDrawable;
        } catch (Resources.NotFoundException e) {
        } catch (Resources.NotFoundException e) {
            return null;
            return null;
        }
        }
@@ -233,8 +237,7 @@ public class LocalImageResolver {
            });
            });


        // ImageDecoder documentation is misleading a bit - it'll throw NotFoundException
        // ImageDecoder documentation is misleading a bit - it'll throw NotFoundException
        // in some cases despite it not saying so. Rethrow it as an IOException to keep
        // in some cases despite it not saying so.
        // our API contract.
        } catch (IOException | Resources.NotFoundException e) {
        } catch (IOException | Resources.NotFoundException e) {
            Log.d(TAG, "Couldn't use ImageDecoder for drawable, falling back to non-resized load.");
            Log.d(TAG, "Couldn't use ImageDecoder for drawable, falling back to non-resized load.");
            return null;
            return null;