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

Commit e23362a5 authored by Daisuke Miyakawa's avatar Daisuke Miyakawa
Browse files

Use callable-filter capability when updating call log

CallerInfo#phoneNumber has a formatted phone number even when contacts
database itself has an unformatted one, so just using Phone.CONTENT_URI
may not be enough to find the relevant contact.

Bug: 6291905
Change-Id: Ie6e40529eb1f9cf98de861601669dbccb718541c
parent 139e5aa1
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract.CommonDataKinds.Callable;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.DataUsageFeedback;
import android.text.TextUtils;
@@ -312,10 +313,12 @@ public class CallLog {
                            null);
                } else {
                    final String phoneNumber = ci.phoneNumber != null ? ci.phoneNumber : number;
                    cursor = resolver.query(Phone.CONTENT_URI,
                    cursor = resolver.query(
                            Uri.withAppendedPath(Callable.CONTENT_FILTER_URI,
                                    Uri.encode(phoneNumber)),
                            new String[] { Phone._ID },
                            Phone.CONTACT_ID + " =? AND " + Phone.NUMBER + " =?",
                            new String[] { String.valueOf(ci.person_id), phoneNumber},
                            Phone.CONTACT_ID + " =?",
                            new String[] { String.valueOf(ci.person_id) },
                            null);
                }