Skip to content

Commit e23362a

Browse files
author
Daisuke Miyakawa
committed
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
1 parent 139e5aa commit e23362a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

core/java/android/provider/CallLog.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import android.content.Context;
2626
import android.database.Cursor;
2727
import android.net.Uri;
28+
import android.provider.ContactsContract.CommonDataKinds.Callable;
2829
import android.provider.ContactsContract.CommonDataKinds.Phone;
2930
import android.provider.ContactsContract.DataUsageFeedback;
3031
import android.text.TextUtils;
@@ -312,10 +313,12 @@ public static Uri addCall(CallerInfo ci, Context context, String number,
312313
null);
313314
} else {
314315
final String phoneNumber = ci.phoneNumber != null ? ci.phoneNumber : number;
315-
cursor = resolver.query(Phone.CONTENT_URI,
316+
cursor = resolver.query(
317+
Uri.withAppendedPath(Callable.CONTENT_FILTER_URI,
318+
Uri.encode(phoneNumber)),
316319
new String[] { Phone._ID },
317-
Phone.CONTACT_ID + " =? AND " + Phone.NUMBER + " =?",
318-
new String[] { String.valueOf(ci.person_id), phoneNumber},
320+
Phone.CONTACT_ID + " =?",
321+
new String[] { String.valueOf(ci.person_id) },
319322
null);
320323
}
321324

0 commit comments

Comments
 (0)