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

Commit ba18fbba authored by Steve Elliott's avatar Steve Elliott
Browse files

Make convo icon visible when transition from important

Test: manual, atest
Fixes: 161474181
Change-Id: Ie000a33d47058147048ad8ee10ba7d60431a7406
parent 42a86179
Loading
Loading
Loading
Loading
+27 −22
Original line number Diff line number Diff line
@@ -27,10 +27,10 @@ import com.android.internal.widget.ConversationLayout
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.NotificationContentView
import com.android.systemui.statusbar.notification.stack.StackStateAnimator
import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy
import java.util.concurrent.ConcurrentHashMap
import javax.inject.Inject

@@ -85,38 +85,43 @@ class ConversationNotificationManager @Inject constructor(
                for (entry in activeConversationEntries) {
                    if (rankingMap.getRanking(entry.sbn.key, ranking) && ranking.isConversation) {
                        val important = ranking.channel.isImportantConversation
                        val layouts = entry.row?.layouts?.asSequence()
                        var changed = false
                        entry.row?.layouts?.asSequence()
                                ?.flatMap(::getLayouts)
                                ?.mapNotNull { it as? ConversationLayout }
                                ?: emptySequence()
                        var changed = false
                        for (layout in layouts) {
                            if (important == layout.isImportantConversation) {
                                continue
                            }
                                ?.filterNot { it.isImportantConversation == important }
                                ?.forEach { layout ->
                                    changed = true
                                    if (important && entry.isMarkedForUserTriggeredMovement) {
                                        // delay this so that it doesn't animate in until after
                                        // the notif has been moved in the shade
                                mainHandler.postDelayed({
                                        mainHandler.postDelayed(
                                                {
                                                    layout.setIsImportantConversation(
                                            important, true /* animate */)
                                }, IMPORTANCE_ANIMATION_DELAY.toLong())
                                                            important,
                                                            true)
                                                },
                                                IMPORTANCE_ANIMATION_DELAY.toLong())
                                    } else {
                                layout.setIsImportantConversation(important)
                                        layout.setIsImportantConversation(important, false)
                                    }
                                }
                        if (changed) {
                            notificationGroupManager.updateIsolation(entry)
                            // ensure that the conversation icon isn't hidden
                            // (ex: if it was showing in the shelf)
                            entry.row?.updateIconVisibilities()
                        }
                    }
                }
            }

            override fun onEntryInflated(entry: NotificationEntry) {
                if (!entry.ranking.isConversation) return
                if (!entry.ranking.isConversation) {
                    return
                }
                fun updateCount(isExpanded: Boolean) {
                    if (isExpanded && (!notifPanelCollapsed || entry.isPinnedAndExpanded())) {
                    if (isExpanded && (!notifPanelCollapsed || entry.isPinnedAndExpanded)) {
                        resetCount(entry.key)
                        entry.row?.let(::resetBadgeUi)
                    }
+3 −2
Original line number Diff line number Diff line
@@ -1478,7 +1478,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
    }

    private void updateIconVisibilities() {
    /** Refreshes the visibility of notification icons */
    public void updateIconVisibilities() {
        // The shelf icon is never hidden for children in groups
        boolean visible = !isChildInGroup() && mShelfIconVisible;
        for (NotificationContentView l : mLayouts) {
+2 −0
Original line number Diff line number Diff line
@@ -147,6 +147,8 @@ class NotificationConversationTemplateViewWrapper constructor(
                // hiding the conversationIcon will already do that via its listener.
                return
            }
        } else {
            conversationIconView.isForceHidden = false
        }
        super.setShelfIconVisible(visible)
    }