From 93877c24c64ceb5ad5611593227da0ff6a41a235 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Mon, 16 Sep 2013 07:57:06 -0700 Subject: Add internet call type label Bug: 10764487 Change-Id: I87e48063b14629c19a58b9ddb2acb736af6f37e0 --- InCallUI/res/layout/primary_call_info.xml | 2 +- InCallUI/src/com/android/incallui/CallCardFragment.java | 17 ++++++++++++++++- .../src/com/android/incallui/CallCardPresenter.java | 7 +++---- InCallUI/src/com/android/incallui/ContactInfoCache.java | 13 +++++++++++-- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/InCallUI/res/layout/primary_call_info.xml b/InCallUI/res/layout/primary_call_info.xml index fd8b83a14..f67c04aa6 100644 --- a/InCallUI/res/layout/primary_call_info.xml +++ b/InCallUI/res/layout/primary_call_info.xml @@ -88,7 +88,7 @@ for certain kinds of calls (like "Internet call" for a SIP call.) --> final String name = getNameForCall(entry); final String number = getNumberForCall(entry); final boolean nameIsNumber = name != null && name.equals(entry.number); - ui.setPrimary(number, name, nameIsNumber, entry.label, - entry.photo, isConference); + entry.photo, isConference, entry.isSipCall); } else { // reset to nothing (like at end of call) - ui.setPrimary(null, null, false, null, null, false); + ui.setPrimary(null, null, false, null, null, false, false); } } @@ -428,7 +427,7 @@ public class CallCardPresenter extends Presenter public interface CallCardUi extends Ui { void setVisible(boolean on); void setPrimary(String number, String name, boolean nameIsNumber, String label, - Drawable photo, boolean isConference); + Drawable photo, boolean isConference, boolean isSipCall); void setSecondary(boolean show, String name, boolean nameIsNumber, String label, Drawable photo, boolean isConference); void setSecondaryImage(Drawable image); diff --git a/InCallUI/src/com/android/incallui/ContactInfoCache.java b/InCallUI/src/com/android/incallui/ContactInfoCache.java index 2c033e98b..e005942b2 100644 --- a/InCallUI/src/com/android/incallui/ContactInfoCache.java +++ b/InCallUI/src/com/android/incallui/ContactInfoCache.java @@ -25,6 +25,7 @@ import android.net.Uri; import android.os.Looper; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.CommonDataKinds.Phone; +import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import com.android.incallui.service.PhoneNumberService; @@ -354,6 +355,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete String displayNumber = null; String displayLocation = null; String label = null; + boolean isSipCall = false; // It appears that there is a small change in behaviour with the // PhoneUtils' startGetCallerInfo whereby if we query with an @@ -378,8 +380,12 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete // Then we could remove this hack, and instead ask the CallerInfo // for a "user visible" form of the SIP address. String number = info.phoneNumber; - if (number != null && number.startsWith("sip:")) { - number = number.substring(4); + + if (!TextUtils.isEmpty(number)) { + isSipCall = PhoneNumberUtils.isUriNumber(number); + if (number.startsWith("sip:")) { + number = number.substring(4); + } } if (TextUtils.isEmpty(info.name)) { @@ -450,6 +456,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete cce.number = displayNumber; cce.location = displayLocation; cce.label = label; + cce.isSipCall = isSipCall; } /** @@ -504,6 +511,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete public String location; public String label; public Drawable photo; + public boolean isSipCall; public Uri personUri; // Used for local photo load @Override @@ -514,6 +522,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete .add("location", MoreStrings.toSafeString(location)) .add("label", label) .add("photo", photo) + .add("isSipCall", isSipCall) .toString(); } } -- cgit v1.2.3