mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
[android] do not use file:// Uris for notification sounds
This causes a FileUriExposedException otherwise. Closes #1485
This commit is contained in:
@@ -347,8 +347,10 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
|||||||
if (currentTime - lastSound > SOUND_DELAY) {
|
if (currentTime - lastSound > SOUND_DELAY) {
|
||||||
boolean sound = settings.getBoolean(PREF_NOTIFY_SOUND, true);
|
boolean sound = settings.getBoolean(PREF_NOTIFY_SOUND, true);
|
||||||
String ringtoneUri = settings.get(PREF_NOTIFY_RINGTONE_URI);
|
String ringtoneUri = settings.get(PREF_NOTIFY_RINGTONE_URI);
|
||||||
if (sound && !StringUtils.isNullOrEmpty(ringtoneUri))
|
if (sound && !StringUtils.isNullOrEmpty(ringtoneUri)) {
|
||||||
b.setSound(Uri.parse(ringtoneUri));
|
Uri uri = Uri.parse(ringtoneUri);
|
||||||
|
if (!"file".equals(uri.getScheme())) b.setSound(uri);
|
||||||
|
}
|
||||||
b.setDefaults(getDefaults());
|
b.setDefaults(getDefaults());
|
||||||
lastSound = currentTime;
|
lastSound = currentTime;
|
||||||
}
|
}
|
||||||
@@ -359,7 +361,8 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
|||||||
int defaults = DEFAULT_LIGHTS;
|
int defaults = DEFAULT_LIGHTS;
|
||||||
boolean sound = settings.getBoolean(PREF_NOTIFY_SOUND, true);
|
boolean sound = settings.getBoolean(PREF_NOTIFY_SOUND, true);
|
||||||
String ringtoneUri = settings.get(PREF_NOTIFY_RINGTONE_URI);
|
String ringtoneUri = settings.get(PREF_NOTIFY_RINGTONE_URI);
|
||||||
if (sound && StringUtils.isNullOrEmpty(ringtoneUri))
|
if (sound && (StringUtils.isNullOrEmpty(ringtoneUri) ||
|
||||||
|
"file".equals(Uri.parse(ringtoneUri).getScheme())))
|
||||||
defaults |= DEFAULT_SOUND;
|
defaults |= DEFAULT_SOUND;
|
||||||
if (settings.getBoolean(PREF_NOTIFY_VIBRATION, true))
|
if (settings.getBoolean(PREF_NOTIFY_VIBRATION, true))
|
||||||
defaults |= DEFAULT_VIBRATE;
|
defaults |= DEFAULT_VIBRATE;
|
||||||
|
|||||||
Reference in New Issue
Block a user