It’s possible that the current code only works as expected if the contact is marked as default in Android’s contacts app. Android’s contacts database supports merging contacts from different sources (e.g. Google contacts and Exchange contacts). Both sources could have different email addresses marked as default. That’s why the contacts database column for a default address on the device is called IS_SUPER_PRIMARY
. Right now we only use that one for sorting, but not IS_PRIMARY
which reflects whether or not an address has been marked as default in the source of the contacts (e.g. Google contacts). I assumed that if there’s only one source and a contact is marked as default there it’ll automatically be marked as local default, too. But that may not be the case.
In short: to make it work right now, mark one of the email addresses as default in your Android device’s contacts app.
I’ll update K-9 Mail to first sort by IS_SUPER_PRIMARY
, then IS_PRIMARY
. That should do the right thing when an email is only marked as default in a contacts source, but not on the device.