@@ -150,48 +150,50 @@ public void requestFromListener(int interruptionFilter) {
150150 }
151151
152152 public boolean shouldIntercept (NotificationRecord record ) {
153- if (mZenMode != Global .ZEN_MODE_OFF ) {
154- if (isSystem (record )) {
155- return false ;
156- }
157- if (isAlarm (record )) {
158- if (mZenMode == Global .ZEN_MODE_NO_INTERRUPTIONS ) {
159- ZenLog .traceIntercepted (record , "alarm" );
160- return true ;
153+ if (isSystem (record )) {
154+ return false ;
155+ }
156+ switch (mZenMode ) {
157+ case Global .ZEN_MODE_NO_INTERRUPTIONS :
158+ // #notevenalarms
159+ ZenLog .traceIntercepted (record , "none" );
160+ return true ;
161+ case Global .ZEN_MODE_IMPORTANT_INTERRUPTIONS :
162+ if (isAlarm (record )) {
163+ // Alarms are always priority
164+ return false ;
161165 }
162- return false ;
163- }
164- // allow user-prioritized packages through in priority mode
165- if (mZenMode == Global .ZEN_MODE_IMPORTANT_INTERRUPTIONS ) {
166+ // allow user-prioritized packages through in priority mode
166167 if (record .getPackagePriority () == Notification .PRIORITY_MAX ) {
167168 ZenLog .traceNotIntercepted (record , "priorityApp" );
168169 return false ;
169170 }
170- }
171- if (isCall (record )) {
172- if (!mConfig .allowCalls ) {
173- ZenLog .traceIntercepted (record , "!allowCalls" );
174- return true ;
171+ if (isCall (record )) {
172+ if (!mConfig .allowCalls ) {
173+ ZenLog .traceIntercepted (record , "!allowCalls" );
174+ return true ;
175+ }
176+ return shouldInterceptAudience (record );
175177 }
176- return shouldInterceptAudience ( record );
177- }
178- if ( isMessage ( record )) {
179- if (! mConfig . allowMessages ) {
180- ZenLog . traceIntercepted ( record , "!allowMessages" );
181- return true ;
178+ if ( isMessage ( record )) {
179+ if (! mConfig . allowMessages ) {
180+ ZenLog . traceIntercepted ( record , "!allowMessages" );
181+ return true ;
182+ }
183+ return shouldInterceptAudience ( record ) ;
182184 }
183- return shouldInterceptAudience ( record );
184- }
185- if ( isEvent ( record )) {
186- if (! mConfig . allowEvents ) {
187- ZenLog . traceIntercepted ( record , "!allowEvents" );
188- return true ;
185+ if ( isEvent ( record )) {
186+ if (! mConfig . allowEvents ) {
187+ ZenLog . traceIntercepted ( record , "!allowEvents" );
188+ return true ;
189+ }
190+ return false ;
189191 }
190- }
191- ZenLog .traceIntercepted (record , "!allowed" );
192- return true ;
192+ ZenLog .traceIntercepted (record , "!priority" );
193+ return true ;
194+ default :
195+ return false ;
193196 }
194- return false ;
195197 }
196198
197199 private boolean shouldInterceptAudience (NotificationRecord record ) {
0 commit comments