Use phonetic name as display name if no other given name
Bug: 7942098
Change-Id: I0c43b6e78471631f6400d836311ec84658f063c9
diff --git a/src/com/android/providers/contacts/ContactsDatabaseHelper.java b/src/com/android/providers/contacts/ContactsDatabaseHelper.java
index b36fee5..478cd68 100644
--- a/src/com/android/providers/contacts/ContactsDatabaseHelper.java
+++ b/src/com/android/providers/contacts/ContactsDatabaseHelper.java
@@ -4991,6 +4991,9 @@
" FROM " + Tables.DATA +
" WHERE " + Data.RAW_CONTACT_ID + "=?" +
" AND (" + Data.DATA1 + " NOT NULL OR " +
+ Data.DATA8 + " NOT NULL OR " +
+ Data.DATA9 + " NOT NULL OR " +
+ Data.DATA10 + " NOT NULL OR " + // Phonetic name not empty
Organization.TITLE + " NOT NULL)";
public static final int MIMETYPE = 0;
@@ -5145,6 +5148,14 @@
}
if (bestPhoneticName != null) {
+ if (displayNamePrimary == null) {
+ displayNamePrimary = bestPhoneticName;
+ }
+ if (displayNameAlternative == null) {
+ displayNameAlternative = bestPhoneticName;
+ }
+ // Phonetic names disregard name order so displayNamePrimary and displayNameAlternative
+ // are the same.
sortKeyPrimary = sortKeyAlternative = bestPhoneticName;
if (bestPhoneticNameStyle == PhoneticNameStyle.UNDEFINED) {
bestPhoneticNameStyle = mNameSplitter.guessPhoneticNameStyle(bestPhoneticName);