@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) {
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) {
}
@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);
// post upgrade, default sound.