Loading core/java/android/app/Notification.java +3 −1 Original line number Diff line number Diff line Loading @@ -2339,7 +2339,9 @@ public class Notification implements Parcelable @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Notification(pri="); sb.append("Notification(channel="); sb.append(getChannel()); sb.append(" pri="); sb.append(priority); sb.append(" contentView="); if (contentView != null) { Loading services/core/java/com/android/server/notification/NotificationRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ public final class NotificationRecord { final boolean useDefaultSound = (n.defaults & Notification.DEFAULT_SOUND) != 0; if (useDefaultSound) { sound = Settings.System.DEFAULT_NOTIFICATION_URI; } else if (n.sound != null) { } else { sound = n.sound; } } Loading services/tests/notification/src/com/android/server/notification/NotificationRecordTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -124,6 +124,9 @@ public class NotificationRecordTest { builder.setSound(CUSTOM_SOUND, CUSTOM_ATTRIBUTES); channel.setSound(CUSTOM_SOUND, CUSTOM_ATTRIBUTES); } } else { channel.setSound(null, null); builder.setSound(null, null); } if (buzzy) { if (defaultVibration) { Loading Loading @@ -205,6 +208,18 @@ public class NotificationRecordTest { assertEquals(CUSTOM_ATTRIBUTES, record.getAudioAttributes()); } @Test public void testSound_noSound_preUpgrade() throws Exception { // pre upgrade, default sound. StatusBarNotification sbn = getNotification(true /*preO */, false /* noisy */, false /* defaultSound */, false /* buzzy */, false /* defaultBuzz */, false /* lights */, false /*defaultLights */); NotificationRecord record = new NotificationRecord(mMockContext, sbn, defaultChannel); assertEquals(null, record.getSound()); assertEquals(Notification.AUDIO_ATTRIBUTES_DEFAULT, record.getAudioAttributes()); } @Test public void testSound_default_upgradeUsesChannel() throws Exception { channel.setSound(CUSTOM_SOUND, CUSTOM_ATTRIBUTES); Loading Loading
core/java/android/app/Notification.java +3 −1 Original line number Diff line number Diff line Loading @@ -2339,7 +2339,9 @@ public class Notification implements Parcelable @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Notification(pri="); sb.append("Notification(channel="); sb.append(getChannel()); sb.append(" pri="); sb.append(priority); sb.append(" contentView="); if (contentView != null) { Loading
services/core/java/com/android/server/notification/NotificationRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ public final class NotificationRecord { final boolean useDefaultSound = (n.defaults & Notification.DEFAULT_SOUND) != 0; if (useDefaultSound) { sound = Settings.System.DEFAULT_NOTIFICATION_URI; } else if (n.sound != null) { } else { sound = n.sound; } } Loading
services/tests/notification/src/com/android/server/notification/NotificationRecordTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -124,6 +124,9 @@ public class NotificationRecordTest { builder.setSound(CUSTOM_SOUND, CUSTOM_ATTRIBUTES); channel.setSound(CUSTOM_SOUND, CUSTOM_ATTRIBUTES); } } else { channel.setSound(null, null); builder.setSound(null, null); } if (buzzy) { if (defaultVibration) { Loading Loading @@ -205,6 +208,18 @@ public class NotificationRecordTest { assertEquals(CUSTOM_ATTRIBUTES, record.getAudioAttributes()); } @Test public void testSound_noSound_preUpgrade() throws Exception { // pre upgrade, default sound. StatusBarNotification sbn = getNotification(true /*preO */, false /* noisy */, false /* defaultSound */, false /* buzzy */, false /* defaultBuzz */, false /* lights */, false /*defaultLights */); NotificationRecord record = new NotificationRecord(mMockContext, sbn, defaultChannel); assertEquals(null, record.getSound()); assertEquals(Notification.AUDIO_ATTRIBUTES_DEFAULT, record.getAudioAttributes()); } @Test public void testSound_default_upgradeUsesChannel() throws Exception { channel.setSound(CUSTOM_SOUND, CUSTOM_ATTRIBUTES); Loading