Do not call Notification.setSound with empty ringtone

Closes #6293
// FREEBIE
This commit is contained in:
Christian Ascheberg 2017-02-23 17:28:34 +01:00 committed by Moxie Marlinspike
parent 65c05e0388
commit 44bb2c7c72

View File

@ -44,8 +44,8 @@ public abstract class AbstractNotificationBuilder extends NotificationCompat.Bui
String defaultRingtoneName = TextSecurePreferences.getNotificationRingtone(context); String defaultRingtoneName = TextSecurePreferences.getNotificationRingtone(context);
boolean defaultVibrate = TextSecurePreferences.isNotificationVibrateEnabled(context); boolean defaultVibrate = TextSecurePreferences.isNotificationVibrateEnabled(context);
if (ringtone != null) setSound(ringtone); if (ringtone == null && !TextUtils.isEmpty(defaultRingtoneName)) setSound(Uri.parse(defaultRingtoneName));
else if (!TextUtils.isEmpty(defaultRingtoneName)) setSound(Uri.parse(defaultRingtoneName)); else if (ringtone != null && !ringtone.toString().isEmpty()) setSound(ringtone);
if (vibrate == RecipientPreferenceDatabase.VibrateState.ENABLED || if (vibrate == RecipientPreferenceDatabase.VibrateState.ENABLED ||
(vibrate == RecipientPreferenceDatabase.VibrateState.DEFAULT && defaultVibrate)) (vibrate == RecipientPreferenceDatabase.VibrateState.DEFAULT && defaultVibrate))