am c909e1b2: Zen: Fix new event category check.

* commit 'c909e1b2dfa2e47b786d96818f70f6308c5a78be':
  Zen: Fix new event category check.
This commit is contained in:
John Spurlock
2014-10-01 16:56:02 +00:00
committed by Android Git Automerger

View File

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