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

Commit c909e1b2 authored by John Spurlock's avatar John Spurlock
Browse files

Zen: Fix new event category check.

Allow events through if configured, and use a switch
for separating mode-specific logic.

Bug:17580878
Change-Id: Id7b5d8b50173015d6a78568ed0a90e0bccf98549
parent 7dc7f676
Loading
Loading
Loading
Loading
+35 −33
Original line number Diff line number Diff line
@@ -150,24 +150,24 @@ public class ZenModeHelper {
    }

    public boolean shouldIntercept(NotificationRecord record) {
        if (mZenMode != Global.ZEN_MODE_OFF) {
        if (isSystem(record)) {
            return false;
        }
            if (isAlarm(record)) {
                if (mZenMode == Global.ZEN_MODE_NO_INTERRUPTIONS) {
                    ZenLog.traceIntercepted(record, "alarm");
        switch (mZenMode) {
            case Global.ZEN_MODE_NO_INTERRUPTIONS:
                // #notevenalarms
                ZenLog.traceIntercepted(record, "none");
                return true;
                }
            case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
                if (isAlarm(record)) {
                    // Alarms are always priority
                    return false;
                }
                // allow user-prioritized packages through in priority mode
            if (mZenMode == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS) {
                if (record.getPackagePriority() == Notification.PRIORITY_MAX) {
                    ZenLog.traceNotIntercepted(record, "priorityApp");
                    return false;
                }
            }
                if (isCall(record)) {
                    if (!mConfig.allowCalls) {
                        ZenLog.traceIntercepted(record, "!allowCalls");
@@ -187,12 +187,14 @@ public class ZenModeHelper {
                        ZenLog.traceIntercepted(record, "!allowEvents");
                        return true;
                    }
                    return false;
                }
            ZenLog.traceIntercepted(record, "!allowed");
                ZenLog.traceIntercepted(record, "!priority");
                return true;
        }
            default:
                return false;
        }
    }

    private boolean shouldInterceptAudience(NotificationRecord record) {
        if (!audienceMatches(record.getContactAffinity())) {