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

Commit 95a7fb6f authored by Steve Elliott's avatar Steve Elliott Committed by Android (Google) Code Review
Browse files

Merge "Make convo icon visible when transition from important"

parents 9911b7d4 ba18fbba
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)
    }