mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 22:29:53 +01:00
[android] check if ringtone picker is available before launching
Also refuse file:// Uri as they cause a FileUriExposedException as in #1485
This commit is contained in:
@@ -511,7 +511,12 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
else uri = Uri.parse(ringtoneUri);
|
else uri = Uri.parse(ringtoneUri);
|
||||||
i.putExtra(EXTRA_RINGTONE_EXISTING_URI, uri);
|
i.putExtra(EXTRA_RINGTONE_EXISTING_URI, uri);
|
||||||
}
|
}
|
||||||
startActivityForResult(i, REQUEST_RINGTONE);
|
if (i.resolveActivity(requireActivity().getPackageManager()) != null) {
|
||||||
|
startActivityForResult(i, REQUEST_RINGTONE);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getContext(), R.string.cannot_load_ringtone,
|
||||||
|
LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -646,7 +651,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
} else {
|
} else {
|
||||||
// The user chose a ringtone other than the default
|
// The user chose a ringtone other than the default
|
||||||
Ringtone r = RingtoneManager.getRingtone(getContext(), uri);
|
Ringtone r = RingtoneManager.getRingtone(getContext(), uri);
|
||||||
if (r == null) {
|
if (r == null || "file".equals(uri.getScheme())) {
|
||||||
Toast.makeText(getContext(), R.string.cannot_load_ringtone,
|
Toast.makeText(getContext(), R.string.cannot_load_ringtone,
|
||||||
LENGTH_SHORT).show();
|
LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user