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

Commit 309d1c83 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Do not clear recent intrusive flag if still intrusive

Test: manual, post two noisy progress notifications that update
every second. before change, they start swapping after ten seconds.
after change, no swapping.
Fixes: 36299000

Change-Id: Ia16c36660ae6d59b51b7c5b3521ad43de45aa952
parent c45d88b6
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -66,8 +66,12 @@ public class NotificationIntrusivenessExtractor implements NotificationSignalExt

            @Override
            public void applyChangesLocked(NotificationRecord record) {
                // there will be another reconsideration in the message queue HANG_TIME_MS
                // from each time this record alerts, which can finally clear this flag.
                if ((System.currentTimeMillis() - record.getLastIntrusive()) >= HANG_TIME_MS) {
                    record.setRecentlyIntrusive(false);
                }
            }
        };
    }

+8 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ public final class NotificationRecord {
    // to communicate with the ranking module.
    private float mContactAffinity;
    private boolean mRecentlyIntrusive;
    private long mLastIntrusive;

    // is this notification currently being intercepted by Zen Mode?
    private boolean mIntercept;
@@ -515,12 +516,19 @@ public final class NotificationRecord {

    public void setRecentlyIntrusive(boolean recentlyIntrusive) {
        mRecentlyIntrusive = recentlyIntrusive;
        if (recentlyIntrusive) {
            mLastIntrusive = System.currentTimeMillis();
        }
    }

    public boolean isRecentlyIntrusive() {
        return mRecentlyIntrusive;
    }

    public long getLastIntrusive() {
        return mLastIntrusive;
    }

    public void setPackagePriority(int packagePriority) {
        mPackagePriority = packagePriority;
    }