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

Commit 6b23dfbd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Stop throwing if the label is null" into sc-dev

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


    /**
    /**