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

Commit d0b50a10 authored by Julia Reynolds's avatar Julia Reynolds Committed by Automerger Merge Worker
Browse files

Merge "Update conversation labels" into rvc-dev am: 28c3a34f

Change-Id: I1bc0794dcbcaf93143cadd9b2d027e02b7e44e1b
parents 39171f5d 28c3a34f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -7209,7 +7209,8 @@ public class Notification implements Parcelable
         *
         * <p>Starting in {@link Build.VERSION_CODES#R, this conversation title will be ignored if a
         * valid shortcutId is added via {@link Notification.Builder#setShortcutId(String)}. In this
         * case, {@link ShortcutInfo#getShortLabel()} will be shown as the conversation title
         * case, {@link ShortcutInfo#getLongLabel()} (or, if missing,
         * {@link ShortcutInfo#getShortLabel()}) will be shown as the conversation title
         * instead.
         *
         * <p>This API's behavior was changed in SDK version {@link Build.VERSION_CODES#P}. If your
+15 −0
Original line number Diff line number Diff line
@@ -1450,6 +1450,21 @@ public final class ShortcutInfo implements Parcelable {
        return mText;
    }

    /**
     * Returns the {@link #getLongLabel()} if it's populated, and if not, the
     * {@link #getShortLabel()}.
     * @hide
     */
    @Nullable
    public CharSequence getLabel() {
        CharSequence label = getLongLabel();
        if (TextUtils.isEmpty(label)) {
            label = getShortLabel();
        }

        return label;
    }

    /** @hide */
    public int getLongLabelResourceId() {
        return mTextResId;
+2 −2
Original line number Diff line number Diff line
@@ -45,8 +45,8 @@ class ConversationNotificationProcessor @Inject constructor(
                    Notification.MessagingStyle.CONVERSATION_TYPE_NORMAL
        entry.ranking.shortcutInfo?.let { shortcutInfo ->
            messagingStyle.shortcutIcon = launcherApps.getShortcutIcon(shortcutInfo)
            shortcutInfo.shortLabel?.let { shortLabel ->
                messagingStyle.conversationTitle = shortLabel
            shortcutInfo.label?.let { label ->
                messagingStyle.conversationTitle = label
            }
        }
        messagingStyle.unreadMessageCount =
+5 −5
Original line number Diff line number Diff line
@@ -67,14 +67,14 @@ public class NotificationChannelHelper {
        return channel;
    }

    private static String getName(NotificationEntry entry) {
        if (entry.getRanking().getShortcutInfo().getShortLabel() != null) {
            return entry.getRanking().getShortcutInfo().getShortLabel().toString();
    private static CharSequence getName(NotificationEntry entry) {
        if (entry.getRanking().getShortcutInfo().getLabel() != null) {
            return entry.getRanking().getShortcutInfo().getLabel().toString();
        }
        Bundle extras = entry.getSbn().getNotification().extras;
        String nameString = extras.getString(Notification.EXTRA_CONVERSATION_TITLE);
        CharSequence nameString = extras.getCharSequence(Notification.EXTRA_CONVERSATION_TITLE);
        if (TextUtils.isEmpty(nameString)) {
            nameString = extras.getString(Notification.EXTRA_TITLE);
            nameString = extras.getCharSequence(Notification.EXTRA_TITLE);
        }
        if (TextUtils.isEmpty(nameString)) {
            nameString = "fallback";
+3 −3
Original line number Diff line number Diff line
@@ -220,9 +220,9 @@ class PeopleHubDataSourceImpl @Inject constructor(
        }
        val clickRunnable = Runnable { notificationListener.unsnoozeNotification(key) }
        val extras = sbn.notification.extras
        val name = ranking.shortcutInfo?.shortLabel
                ?: extras.getString(Notification.EXTRA_CONVERSATION_TITLE)
                ?: extras.getString(Notification.EXTRA_TITLE)
        val name = ranking.shortcutInfo?.label
                ?: extras.getCharSequence(Notification.EXTRA_CONVERSATION_TITLE)
                ?: extras.getCharSequence(Notification.EXTRA_TITLE)
                ?: return null
        val drawable = ranking.getIcon(iconFactory, sbn)
                ?: iconFactory.getConversationDrawable(
Loading