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

Commit 137df9da authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Stop throwing if the label is null" into sc-dev am: 6b23dfbd

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14253108

Change-Id: Idf6244c6bbeca7fde00716aae15ac466a71f330a
parents 241bebba 6b23dfbd
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import android.content.SharedPreferences;
import android.content.pm.LauncherApps;
import android.content.pm.PackageManager;
import android.content.pm.ShortcutInfo;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Bundle;
import android.os.ServiceManager;
@@ -513,24 +514,31 @@ public class PeopleSpaceWidgetManager {
            if (DEBUG) Log.d(TAG, "Could not find stored tile to add conversation to");
            return;
        }
        PeopleSpaceTile.Builder updatedTile = storedTile.toBuilder();
        ShortcutInfo info = conversation.getShortcutInfo();
        Uri uri = null;
        if (info.getPersons() != null && info.getPersons().length > 0) {
            Person person = info.getPersons()[0];
            uri = person.getUri() == null ? null : Uri.parse(person.getUri());
        }
        storedTile = storedTile.toBuilder()
                .setUserName(info.getLabel())
                .setUserIcon(
                        PeopleSpaceTile.convertDrawableToIcon(mLauncherApps.getShortcutIconDrawable(
                                info, 0)))
        CharSequence label = info.getLabel();
        if (label != null) {
            updatedTile.setUserName(label);
        }
        Icon icon = PeopleSpaceTile.convertDrawableToIcon(mLauncherApps.getShortcutIconDrawable(
                info, 0));
        if (icon != null) {
            updatedTile.setUserIcon(icon);
        }
        updatedTile
                .setContactUri(uri)
                .setStatuses(conversation.getStatuses())
                .setLastInteractionTimestamp(conversation.getLastEventTimestamp())
                .setIsImportantConversation(conversation.getParentNotificationChannel() != null
                        && conversation.getParentNotificationChannel().isImportantConversation())
                .build();
        updateAppWidgetOptionsAndView(mAppWidgetManager, mContext, appWidgetId, storedTile);
        updateAppWidgetOptionsAndView(mAppWidgetManager, mContext, appWidgetId,
                updatedTile.build());
    }

    /**