Better handling of SIP addresses in the Call log

Fix some SIP-address-related issues in RecentCallsListActivity:

- When doing contacts lookups to "refresh" the list, don't try to use
  the PhoneLookup table if the "number" is really a SIP address!

  Instead, look it up directly in the Data table.  (This basically
  does what change https://android-git.corp.google.com/g/70555 did for
  incoming calls.)

- With SIP addresses, correctly use a sip: URI when calling by tapping
  the list, via the CALL button, or via the longpress context menu.

- Don't try to call PhoneNumberUtils.formatNumber() on SIP addresses

- "type" and "label" are currently unused for SIP addresses; don't
  display them

- Disable "Add to contacts" for SIP addresses (for now at least, since
  it's currently broken anyway.)

Bug: 3004127

TESTED:

- Visual appearance of both SIP calls and PSTN calls in the call log:
  make sure we correctly display the contact name and "number".

- Verify the above for freshly added items, *and* after rebooting and
  re-entering the call log.

- Tap the green "call" icon, make sure we call back correctly (for
  both PSTN and SIP).

- Tap the entry itself, make sure "view contact" UI looks correct,
  make sure the "Call" item works (for both PSTN and SIP).

- Longpress, verify the context menu items:
     - "Call" should correctly call for either SIP or PSTN
     - "View contact" should work for either SIP or PSTN
     - "Edit number before call" should ONLY be shown for PSTN
     - "Send text message" should ONLY be shown for PSTN
     - "Remove from call log" should work for either SIP or PSTN

Change-Id: I8ab04250b00d23a88f32a56e7d9953d91c24807c
1 file changed