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

Commit 8a8ddadf authored by Tony Mak's avatar Tony Mak
Browse files

Fix applyAdjustmentsFromAssistants

Issue: r.applyAdjustments() updates the NotificationRecord from the
       adjustments, which makes handleRankingSort failed to diff
       the NotificationRecord properly as it is already updated

Solution: Only update the importance bit in applyAdjustmentsFromAssistants

Test: runtest systemui-notification
Test: Posted a notification, observe smart replies. Reboot, still
      seeing the smart replies.
FIXES: 118886848


Change-Id: I3757d29ef4a28a2b55be06c331f8fcf702caf61a
parent 36154fdb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3610,7 +3610,7 @@ public class NotificationManagerService extends SystemService {
                        NotificationRecord r = mNotificationsByKey.get(adjustment.getKey());
                        if (r != null && mAssistants.isSameUser(token, r.getUserId())) {
                            applyAdjustment(r, adjustment);
                            r.applyAdjustments();
                            r.applyImportanceFromAdjustments();
                            if (r.getImportance() == IMPORTANCE_NONE) {
                                cancelNotificationsFromListener(token, new String[]{r.getKey()});
                            } else {
+12 −0
Original line number Diff line number Diff line
@@ -664,6 +664,18 @@ public final class NotificationRecord {
                            .addTaggedData(MetricsEvent.ADJUSTMENT_KEY_SMART_REPLIES,
                                    getSmartReplies().size()));
                }
            }
            applyImportanceFromAdjustments();
        }
    }

    /**
     * Update importance from the adjustment.
     */
    public void applyImportanceFromAdjustments() {
        synchronized (mAdjustments) {
            for (Adjustment adjustment : mAdjustments) {
                Bundle signals = adjustment.getSignals();
                if (signals.containsKey(Adjustment.KEY_IMPORTANCE)) {
                    int importance = signals.getInt(Adjustment.KEY_IMPORTANCE);
                    importance = Math.max(IMPORTANCE_UNSPECIFIED, importance);