diff options
author | Sailesh Nepal <sail@google.com> | 2014-05-14 19:36:26 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-05-14 19:36:26 +0000 |
commit | 89997ad9918b9b15e7dfc022ce9230f67a1aa6e2 (patch) | |
tree | 307429be82dcad1202bb5f226fb1fc0a8738cd83 /InCallUI/src/com/android/incallui/ContactInfoCache.java | |
parent | 73c981d5f600403b7f502b8a9bb210cf7192f51e (diff) | |
parent | ae73c9aab1c716d9ef85f4f0dbc6f69e97a8f7e6 (diff) |
am 07a822b2: InCallUI: Use telecomm presentation and gateway info
* commit '07a822b2ea92dc5b68cd43139be7efe4c6640cd4':
InCallUI: Use telecomm presentation and gateway info
Diffstat (limited to 'InCallUI/src/com/android/incallui/ContactInfoCache.java')
-rw-r--r-- | InCallUI/src/com/android/incallui/ContactInfoCache.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/InCallUI/src/com/android/incallui/ContactInfoCache.java b/InCallUI/src/com/android/incallui/ContactInfoCache.java index e885dd6fc..7015d2bd3 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.telecomm.CallNumberPresentation; import android.text.TextUtils; import com.android.contacts.common.util.PhoneNumberHelper; @@ -152,9 +153,10 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete private void findInfoQueryComplete(Call call, CallerInfo callerInfo, boolean isIncoming, boolean didLocalLookup) { final String callId = call.getCallId(); - int presentationMode = call.getNumberPresentation(); - if (callerInfo.contactExists || callerInfo.isEmergencyNumber() || callerInfo.isVoiceMailNumber()) { - presentationMode = Call.PRESENTATION_ALLOWED; + CallNumberPresentation presentationMode = call.getNumberPresentation(); + if (callerInfo.contactExists || callerInfo.isEmergencyNumber() || + callerInfo.isVoiceMailNumber()) { + presentationMode = CallNumberPresentation.ALLOWED; } final ContactCacheEntry cacheEntry = buildEntry(mContext, callId, @@ -299,7 +301,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete } private ContactCacheEntry buildEntry(Context context, String callId, - CallerInfo info, int presentation, boolean isIncoming) { + CallerInfo info, CallNumberPresentation presentation, boolean isIncoming) { // The actual strings we're going to display onscreen: Drawable photo = null; @@ -345,7 +347,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete * Populate a cache entry from a call (which got converted into a caller info). */ public static void populateCacheEntry(Context context, CallerInfo info, ContactCacheEntry cce, - int presentation, boolean isIncoming) { + CallNumberPresentation presentation, boolean isIncoming) { Preconditions.checkNotNull(info); String displayName = null; String displayNumber = null; @@ -395,7 +397,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete // (or potentially some other default based on the presentation.) displayName = getPresentationString(context, presentation); Log.d(TAG, " ==> no name *or* number! displayName = " + displayName); - } else if (presentation != Call.PRESENTATION_ALLOWED) { + } else if (presentation != CallNumberPresentation.ALLOWED) { // This case should never happen since the network should never send a phone # // AND a restricted presentation. However we leave it here in case of weird // network behavior @@ -432,7 +434,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete } else { // We do have a valid "name" in the CallerInfo. Display that // in the "name" slot, and the phone number in the "number" slot. - if (presentation != Call.PRESENTATION_ALLOWED) { + if (presentation != CallNumberPresentation.ALLOWED) { // This case should never happen since the network should never send a name // AND a restricted presentation. However we leave it here in case of weird // network behavior @@ -483,11 +485,12 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete /** * Gets name strings based on some special presentation modes. */ - private static String getPresentationString(Context context, int presentation) { + private static String getPresentationString(Context context, + CallNumberPresentation presentation) { String name = context.getString(R.string.unknown); - if (presentation == Call.PRESENTATION_RESTRICTED) { + if (presentation == CallNumberPresentation.RESTRICTED) { name = context.getString(R.string.private_num); - } else if (presentation == Call.PRESENTATION_PAYPHONE) { + } else if (presentation == CallNumberPresentation.PAYPHONE) { name = context.getString(R.string.payphone); } return name; |