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

Commit d5092bcb authored by Christoph Studer's avatar Christoph Studer
Browse files

NoMan: Allow notifications to transition !ZEN -> ZEN

Bug: 15979100
Change-Id: Ifd620caf2e00f8cd3d9f1458b93585a454af4b74
parent 7482a8d0
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1873,10 +1873,9 @@ public class NotificationManagerService extends SystemService {
        }
    }

    // let zen mode evaluate this record and then make note of that for the future
    // let zen mode evaluate this record
    private void applyZenModeLocked(NotificationRecord record) {
        record.setIntercepted(mZenModeHelper.shouldIntercept(record, record.wasTouchedByZen()));
        record.setTouchedByZen();
        record.setIntercepted(mZenModeHelper.shouldIntercept(record));
    }

    // lock on mNotificationList
+0 −11
Original line number Diff line number Diff line
@@ -51,8 +51,6 @@ public final class NotificationRecord {

    // is this notification currently being intercepted by Zen Mode?
    private boolean mIntercept;
    // InterceptedNotifications needs to know if this has been previously evaluated.
    private boolean mTouchedByZen;

    // The timestamp used for ranking.
    private long mRankingTimeMs;
@@ -71,7 +69,6 @@ public final class NotificationRecord {
    public void copyRankingInformation(NotificationRecord previous) {
        mContactAffinity = previous.mContactAffinity;
        mRecentlyIntrusive = previous.mRecentlyIntrusive;
        mTouchedByZen = previous.mTouchedByZen;
        mIntercept = previous.mIntercept;
        mRankingTimeMs = calculateRankingTimeMs(previous.getRankingTimeMs());
    }
@@ -204,14 +201,6 @@ public final class NotificationRecord {
        return mIntercept;
    }

    public boolean wasTouchedByZen() {
        return mTouchedByZen;
    }

    public void setTouchedByZen() {
        mTouchedByZen = true;
    }

    /**
     * Returns the timestamp to use for time-based sorting in the ranker.
     */
+1 −5
Original line number Diff line number Diff line
@@ -129,12 +129,8 @@ public class ZenModeHelper {
        mCallbacks.add(callback);
    }

    public boolean shouldIntercept(NotificationRecord record, boolean previouslySeen) {
    public boolean shouldIntercept(NotificationRecord record) {
        if (mZenMode != Global.ZEN_MODE_OFF) {
            if (previouslySeen && !record.isIntercepted()) {
                // notifications never transition from not intercepted to intercepted
                return false;
            }
            if (isSystem(record)) {
                return false;
            }