Signal crashes on Android 8 when opening per-contact settings for an e-mail contact.
- [x] I have searched open and closed issues for duplicates
- [x] I am submitting a bug report for existing functionality that does not work as intended
- [x] I have read https://github.com/signalapp/Signal-Android/wiki/Submitting-useful-bug-reports
- [x] This isn't a feature request or a discussion topic
Bug description
Signal crashes on Android 8 when opening per-contact settings (e.g. ringtone settings) for an e-mail contact (sent through Verizon's SMS gateway). This occurs regardless of whether or not the e-mail address is stored as a contact in the phone.
Steps to reproduce
- Send an SMS through phone provider's e-mail-to-SMS gateway.
- Open message on phone.
- Click top bar to reveal contact options. Signal will crash each time, before the menu is displayed.
Actual result: Signal crashes when trying to open the contact menu for an e-mail contact Expected result: Signal should display the contact menu, as it does for all other contacts.
Device info
Device: Pixel 2 XL Android version: 8.1.0 Signal version: 4.19.3
Link to debug log
This is a regression (not sure from which release), as I've previously set custom ringtone options for one of these contacts successfully.
Looks like this was introduced in https://github.com/signalapp/Signal-Android/commit/e86a9ce7eb0e672dc7705873b2a5e6d70aea0a74
@moxie0 Would something like this be ok?
RecipientPreferenceActivity.java
private void setSummaries(Recipient recipient) {
...
aboutPreference.setTitle(getPhoneOrEmail(recipient));
...
}
private String getPhoneOrEmail(Recipient recipient) {
Address address = recipient.getAddress();
if (address.isPhone()) return PhoneNumberUtils.formatNumber(address.toPhoneString());
if (address.isEmail()) return address.toEmailString();
return null;
}
Fixed in 4.22.