Loading services/core/java/com/android/server/notification/NotificationManagerService.java +8 −1 Original line number Diff line number Diff line Loading @@ -1812,7 +1812,14 @@ public class NotificationManagerService extends SystemService { } private static AudioAttributes audioAttributesForNotification(Notification n) { return new AudioAttributes.Builder().setLegacyStreamType(n.audioStreamType).build(); if (n.audioAttributes != null && !Notification.AUDIO_ATTRIBUTES_DEFAULT.equals(n.audioAttributes)) { return n.audioAttributes; } return new AudioAttributes.Builder() .setLegacyStreamType(n.audioStreamType) .setUsage(AudioAttributes.usageForLegacyStreamType(n.audioStreamType)) .build(); } void showNextToastLocked() { Loading services/core/java/com/android/server/notification/NotificationRecord.java +14 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,9 @@ import android.content.Context; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.graphics.Bitmap; import android.media.AudioAttributes; import android.service.notification.StatusBarNotification; import com.android.internal.annotations.VisibleForTesting; import java.io.PrintWriter; Loading Loading @@ -105,6 +107,8 @@ public final class NotificationRecord { pw.println(prefix + String.format(" defaults=0x%08x flags=0x%08x", notification.defaults, notification.flags)); pw.println(prefix + " sound=" + notification.sound); pw.println(prefix + " audioStreamType=" + notification.audioStreamType); pw.println(prefix + " audioAttributes=" + notification.audioAttributes); pw.println(prefix + String.format(" color=0x%08x", notification.color)); pw.println(prefix + " vibrate=" + Arrays.toString(notification.vibrate)); pw.println(prefix + String.format(" led=0x%08x onMs=%d offMs=%d", Loading Loading @@ -224,7 +228,16 @@ public final class NotificationRecord { } public boolean isCategory(String category) { return Objects.equals(category, getNotification().category); return Objects.equals(getNotification().category, category); } public boolean isAudioStream(int stream) { return getNotification().audioStreamType == stream; } public boolean isAudioAttributesUsage(int usage) { final AudioAttributes attributes = getNotification().audioAttributes; return attributes != null && attributes.getUsage() == usage; } /** Loading services/core/java/com/android/server/notification/ZenModeHelper.java +4 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.content.IntentFilter; import android.content.res.Resources; import android.content.res.XmlResourceParser; import android.database.ContentObserver; import android.media.AudioAttributes; import android.media.AudioManager; import android.net.Uri; import android.os.Handler; Loading Loading @@ -319,7 +320,9 @@ public class ZenModeHelper { private boolean isAlarm(NotificationRecord record) { return record.isCategory(Notification.CATEGORY_ALARM) || record.isCategory(Notification.CATEGORY_EVENT); || record.isCategory(Notification.CATEGORY_EVENT) || record.isAudioStream(AudioManager.STREAM_ALARM) || record.isAudioAttributesUsage(AudioAttributes.USAGE_ALARM); } private boolean isCall(NotificationRecord record) { Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +8 −1 Original line number Diff line number Diff line Loading @@ -1812,7 +1812,14 @@ public class NotificationManagerService extends SystemService { } private static AudioAttributes audioAttributesForNotification(Notification n) { return new AudioAttributes.Builder().setLegacyStreamType(n.audioStreamType).build(); if (n.audioAttributes != null && !Notification.AUDIO_ATTRIBUTES_DEFAULT.equals(n.audioAttributes)) { return n.audioAttributes; } return new AudioAttributes.Builder() .setLegacyStreamType(n.audioStreamType) .setUsage(AudioAttributes.usageForLegacyStreamType(n.audioStreamType)) .build(); } void showNextToastLocked() { Loading
services/core/java/com/android/server/notification/NotificationRecord.java +14 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,9 @@ import android.content.Context; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.graphics.Bitmap; import android.media.AudioAttributes; import android.service.notification.StatusBarNotification; import com.android.internal.annotations.VisibleForTesting; import java.io.PrintWriter; Loading Loading @@ -105,6 +107,8 @@ public final class NotificationRecord { pw.println(prefix + String.format(" defaults=0x%08x flags=0x%08x", notification.defaults, notification.flags)); pw.println(prefix + " sound=" + notification.sound); pw.println(prefix + " audioStreamType=" + notification.audioStreamType); pw.println(prefix + " audioAttributes=" + notification.audioAttributes); pw.println(prefix + String.format(" color=0x%08x", notification.color)); pw.println(prefix + " vibrate=" + Arrays.toString(notification.vibrate)); pw.println(prefix + String.format(" led=0x%08x onMs=%d offMs=%d", Loading Loading @@ -224,7 +228,16 @@ public final class NotificationRecord { } public boolean isCategory(String category) { return Objects.equals(category, getNotification().category); return Objects.equals(getNotification().category, category); } public boolean isAudioStream(int stream) { return getNotification().audioStreamType == stream; } public boolean isAudioAttributesUsage(int usage) { final AudioAttributes attributes = getNotification().audioAttributes; return attributes != null && attributes.getUsage() == usage; } /** Loading
services/core/java/com/android/server/notification/ZenModeHelper.java +4 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.content.IntentFilter; import android.content.res.Resources; import android.content.res.XmlResourceParser; import android.database.ContentObserver; import android.media.AudioAttributes; import android.media.AudioManager; import android.net.Uri; import android.os.Handler; Loading Loading @@ -319,7 +320,9 @@ public class ZenModeHelper { private boolean isAlarm(NotificationRecord record) { return record.isCategory(Notification.CATEGORY_ALARM) || record.isCategory(Notification.CATEGORY_EVENT); || record.isCategory(Notification.CATEGORY_EVENT) || record.isAudioStream(AudioManager.STREAM_ALARM) || record.isAudioAttributesUsage(AudioAttributes.USAGE_ALARM); } private boolean isCall(NotificationRecord record) { Loading