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

Commit 3d07d4f9 authored by Clark Scheff's avatar Clark Scheff
Browse files

Load original drawable if cached icon throws NotFoundException

If for some reason we get a NotFoundException while trying to retrieve
a cached icon we will attempt to load the original.

Change-Id: I36a708d3e653fed12e88fe93c6d0a7f8e46726c9
parent a5e14581
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -727,7 +727,22 @@ public class Resources {
            }
            getValue(id, value, true, supportComposedIcons);
        }
        Drawable res = loadDrawable(value, id);
        Drawable res = null;
        try {
            res = loadDrawable(value, id);
        } catch (NotFoundException e) {
            // The below statement will be true if we were trying to load a composed icon.
            // Since we received a NotFoundException, try to load the original if this
            // condition is true, otherwise throw the original exception.
            if (supportComposedIcons && mComposedIconInfo != null && info != null &&
                    info.themedIcon == 0) {
                Log.e(TAG, "Failed to retrieve composed icon.", e);
                getValue(id, value, true, false);
                res = loadDrawable(value, id);
            } else {
                throw e;
            }
        }
        synchronized (mAccessLock) {
            if (mTmpValue == null) {
                mTmpValue = value;