Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d2fe65a authored by qqzhou's avatar qqzhou
Browse files

Dialer: fix cannot search "+86" in smart dial search

Smart dial table only gets phone number from database, not
normalized number, so cannot match "+86" in smart dial search.

Will insert normalized number into smart dial and prefix table
if it's not empty.

Change-Id: I6114a2a29222b9d19617822bab8e533e81a5c5fb
CRs-Fixed: 766356
parent b9599332
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -154,6 +154,7 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper {
            Data.IS_PRIMARY,                    // 13
            RawContacts.ACCOUNT_TYPE,           // 14
            RawContacts.ACCOUNT_NAME,           // 15
            Phone.NORMALIZED_NUMBER,            // 16
        };

        static final int PHONE_ID = 0;
@@ -172,6 +173,7 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper {
        static final int PHONE_IS_PRIMARY = 13;
        static final int PHONE_ACCOUNT_TYPE = 14;
        static final int PHONE_ACCOUNT_NAME = 15;
        static final int PHONE_NORMALIZED_NUMBER = 16;

        /** Selects only rows that have been updated after a certain time stamp.*/
        static final String SELECT_UPDATED_CLAUSE =
@@ -718,8 +720,12 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper {
                // null columns (due to malformed rows possibly inserted by third-party apps
                // or sync adapters), skip the phone number row.
                final String number = updatedContactCursor.getString(PhoneQuery.PHONE_NUMBER);
                final String normalizedNumber = updatedContactCursor.getString(
                        PhoneQuery.PHONE_NORMALIZED_NUMBER);
                if (TextUtils.isEmpty(number)) {
                    continue;
                } else if (!TextUtils.isEmpty(normalizedNumber)) {
                    insert.bindString(2, normalizedNumber);
                } else {
                    insert.bindString(2, number);
                }
@@ -755,7 +761,7 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper {
                        .getString(PhoneQuery.PHONE_ACCOUNT_NAME));
                insert.executeInsert();
                final String contactPhoneNumber =
                        updatedContactCursor.getString(PhoneQuery.PHONE_NUMBER);
                        TextUtils.isEmpty(normalizedNumber) ? number : normalizedNumber;
                final ArrayList<String> numberPrefixes =
                        SmartDialPrefix.parseToNumberTokens(contactPhoneNumber);