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

Commit 33fbc15f authored by Gus Prevas's avatar Gus Prevas
Browse files

Updates notification row when importance changes.

This change ensures that NotificationMenuRow.onNotificationUpdated()
is called when a notification entry's importance changes,
so that the icon for the interruptiveness settings is
updated appropriately.

Test: manual
Change-Id: I1ac185a716ce5cdf15bde1c4b354ced4c45dc6cf
parent afafd66d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -952,10 +952,12 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater.

        // Has a copy of the current UI adjustments.
        ArrayMap<String, NotificationUiAdjustment> oldAdjustments = new ArrayMap<>();
        ArrayMap<String, Integer> oldImportances = new ArrayMap<>();
        for (NotificationData.Entry entry : entries) {
            NotificationUiAdjustment adjustment =
                    NotificationUiAdjustment.extractFromNotificationEntry(entry);
            oldAdjustments.put(entry.key, adjustment);
            oldImportances.put(entry.key, entry.importance);
        }

        // Populate notification entries from the new rankings.
@@ -978,6 +980,11 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater.
                    // Once the RowInflaterTask is done, it will pick up the updated entry, so
                    // no-op here.
                }
            } else if (oldImportances.containsKey(entry.key)
                    && entry.importance != oldImportances.get(entry.key)) {
                if (entry.rowExists()) {
                    entry.getRow().onNotificationRankingUpdated();
                }
            }
        }

+7 −0
Original line number Diff line number Diff line
@@ -588,6 +588,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        updateRippleAllowed();
    }

    /** Called when the notification's ranking was changed (but nothing else changed). */
    public void onNotificationRankingUpdated() {
        if (mMenuRow != null) {
            mMenuRow.onNotificationUpdated(mStatusBarNotification);
        }
    }

    @VisibleForTesting
    void updateShelfIconColor() {
        StatusBarIconView expandedIcon = mEntry.expandedIcon;