Add support for looking up SIP addresses.

Current ContactsContract.PhoneLookup only support looking up phone
number. As a consequence SIP address look-ups are done with a generic,
expensive ContactsContract.Data query.

This change adds support for doing a SIP address look-up using
ContactsContract.PhoneLookup by specifying a query parameter.

By doing so, we can do a trivial but crucial optimization: instead of
matching against the MIME type as a string, we can use the _id of the
vnd.android.cursor.item/sip_address MIME type in our database. This
speeds up queries that used to take over 250ms to 1-2ms.

Bug: 5529690
Change-Id: I15e7ed225927882fc0fd0958b7d2cbfede12c590
2 files changed