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

Commit 982ec4e7 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

[Conversation Notification] Use fallback drawable loading

Size restricted drawable loading can fail. So we need to fallback loading fullsize as it is done in CachingIconView.

Fixes: 330554718
Bug: 305540309
Test: Presubmit + send Messaging Notifications and observe Images are loaded.
Flag: ACONFIG android.widget.flags.conversation_style_set_avatar_async TEAMFOOD
Change-Id: I5fa66d42923d4365803cda884a1b96c1e1c9f84d
parent 4bd09c0f
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1297,6 +1297,17 @@ public class ConversationLayout extends FrameLayout
     */
    @Nullable
    private Drawable resolveAvatarImageForOneToOne(Icon conversationIcon) {
        final Drawable conversationIconDrawable =
                tryLoadingSizeRestrictedIconForOneToOne(conversationIcon);
        if (conversationIconDrawable != null) {
            return conversationIconDrawable;
        }
        // when size restricted icon loading fails, we fallback to icons load drawable.
        return loadDrawableFromIcon(conversationIcon);
    }

    @Nullable
    private Drawable tryLoadingSizeRestrictedIconForOneToOne(Icon conversationIcon) {
        try {
            return mConversationIconView.loadSizeRestrictedIcon(conversationIcon);
        } catch (Exception ex) {
@@ -1309,6 +1320,11 @@ public class ConversationLayout extends FrameLayout
     */
    @Nullable
    private Drawable resolveAvatarImageForFacePile(Icon conversationIcon) {
        return loadDrawableFromIcon(conversationIcon);
    }

    @Nullable
    private Drawable loadDrawableFromIcon(Icon conversationIcon) {
        try {
            return conversationIcon.loadDrawable(getContext());
        } catch (Exception ex) {