System sounds get its own dnd toggle

- Added logic for streams to be muted by dnd (unassociated with ringer)

Test: runtest -x frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java
Bug: 73362490
Change-Id: I1101e67282f7331497e91eb510d2bf4f1ea6b4b1
diff --git a/services/core/java/com/android/server/notification/ZenModeFiltering.java b/services/core/java/com/android/server/notification/ZenModeFiltering.java
index abf2900..a0003a5 100644
--- a/services/core/java/com/android/server/notification/ZenModeFiltering.java
+++ b/services/core/java/com/android/server/notification/ZenModeFiltering.java
@@ -163,11 +163,16 @@
                     }
                     return false;
                 }
-                AudioAttributes aa = record.getAudioAttributes();
-                if (aa != null && AudioAttributes.SUPPRESSIBLE_USAGES.get(aa.getUsage()) ==
-                        AudioAttributes.SUPPRESSIBLE_MEDIA_SYSTEM_OTHER) {
-                    if (!config.allowMediaSystemOther) {
-                        ZenLog.traceIntercepted(record, "!allowMediaSystemOther");
+                if (isMedia(record)) {
+                    if (!config.allowMedia) {
+                        ZenLog.traceIntercepted(record, "!allowMedia");
+                        return true;
+                    }
+                    return false;
+                }
+                if (isSystem(record)) {
+                    if (!config.allowSystem) {
+                        ZenLog.traceIntercepted(record, "!allowSystem");
                         return true;
                     }
                     return false;
@@ -206,6 +211,18 @@
                 || record.isCategory(Notification.CATEGORY_CALL));
     }
 
+    public boolean isMedia(NotificationRecord record) {
+        AudioAttributes aa = record.getAudioAttributes();
+        return aa != null && AudioAttributes.SUPPRESSIBLE_USAGES.get(aa.getUsage()) ==
+                AudioAttributes.SUPPRESSIBLE_MEDIA;
+    }
+
+    public boolean isSystem(NotificationRecord record) {
+        AudioAttributes aa = record.getAudioAttributes();
+        return aa != null && AudioAttributes.SUPPRESSIBLE_USAGES.get(aa.getUsage()) ==
+                AudioAttributes.SUPPRESSIBLE_SYSTEM;
+    }
+
     private boolean isDefaultPhoneApp(String pkg) {
         if (mDefaultPhoneApp == null) {
             final TelecomManager telecomm =