From e2814d578ed59624f3720302e8a99773d7c6a9c5 Mon Sep 17 00:00:00 2001 From: Nancy Chen Date: Mon, 8 Sep 2014 14:31:23 -0700 Subject: API changes in GatewayInfo, Response, and PropertyPresentation (2/4) * GatewayInfo: handle -> address, becomes SystemApi * Response: hidden * PropertyPresentation: class goes away, constants move to TelecommManager Bug: 17329632 Change-Id: I56180181a65e4b726e569aa4b8ac4cbb8dab00f9 --- src/com/android/incallui/Call.java | 2 +- src/com/android/incallui/CallCardPresenter.java | 2 +- src/com/android/incallui/CallerInfoUtils.java | 16 ++++++++-------- src/com/android/incallui/ContactInfoCache.java | 12 ++++++------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/com/android/incallui/Call.java b/src/com/android/incallui/Call.java index dd899b46..36dd1629 100644 --- a/src/com/android/incallui/Call.java +++ b/src/com/android/incallui/Call.java @@ -248,7 +248,7 @@ public final class Call { public String getNumber() { if (mTelecommCall.getDetails().getGatewayInfo() != null) { return mTelecommCall.getDetails().getGatewayInfo() - .getOriginalHandle().getSchemeSpecificPart(); + .getOriginalAddress().getSchemeSpecificPart(); } return getHandle() == null ? null : getHandle().getSchemeSpecificPart(); } diff --git a/src/com/android/incallui/CallCardPresenter.java b/src/com/android/incallui/CallCardPresenter.java index ea324ba6..60a12730 100644 --- a/src/com/android/incallui/CallCardPresenter.java +++ b/src/com/android/incallui/CallCardPresenter.java @@ -518,7 +518,7 @@ public class CallCardPresenter extends Presenter */ private String getGatewayNumber() { if (hasOutgoingGatewayCall()) { - return getNumberFromHandle(mPrimary.getGatewayInfo().getGatewayHandle()); + return getNumberFromHandle(mPrimary.getGatewayInfo().getGatewayAddress()); } return null; } diff --git a/src/com/android/incallui/CallerInfoUtils.java b/src/com/android/incallui/CallerInfoUtils.java index b060d669..cc38a0e9 100644 --- a/src/com/android/incallui/CallerInfoUtils.java +++ b/src/com/android/incallui/CallerInfoUtils.java @@ -5,7 +5,7 @@ import android.content.Loader; import android.content.Loader.OnLoadCompleteListener; import android.net.Uri; import android.telecomm.PhoneAccount; -import android.telecomm.PropertyPresentation; +import android.telecomm.TelecommManager; import android.text.TextUtils; import android.util.Log; @@ -41,7 +41,7 @@ public class CallerInfoUtils { // TODO: Have phoneapp send a Uri when it knows the contact that triggered this call. - if (info.numberPresentation == PropertyPresentation.ALLOWED) { + if (info.numberPresentation == TelecommManager.PRESENTATION_ALLOWED) { // Start the query with the number provided from the call. Log.d(TAG, "==> Actually starting CallerInfoAsyncQuery.startQuery()..."); CallerInfoAsyncQuery.startQuery(QUERY_TOKEN, context, info, listener, call); @@ -107,9 +107,9 @@ public class CallerInfoUtils { final String[] absentNumberValues = context.getResources().getStringArray(R.array.absent_num); if (Arrays.asList(absentNumberValues).contains(number) - && presentation == PropertyPresentation.ALLOWED) { + && presentation == TelecommManager.PRESENTATION_ALLOWED) { number = context.getString(R.string.unknown); - ci.numberPresentation = PropertyPresentation.UNKNOWN; + ci.numberPresentation = TelecommManager.PRESENTATION_UNKNOWN; } // Check for other special "corner cases" for CNAP and fix them similarly. Corner @@ -117,16 +117,16 @@ public class CallerInfoUtils { // if we think we have an allowed presentation, or if the CallerInfo presentation doesn't // match the presentation passed in for verification (meaning we changed it previously // because it's a corner case and we're being called from a different entry point). - if (ci.numberPresentation == PropertyPresentation.ALLOWED + if (ci.numberPresentation == TelecommManager.PRESENTATION_ALLOWED || (ci.numberPresentation != presentation - && presentation == PropertyPresentation.ALLOWED)) { + && presentation == TelecommManager.PRESENTATION_ALLOWED)) { // For all special strings, change number & numberPrentation. if (isCnapSpecialCaseRestricted(number)) { number = context.getString(R.string.private_num); - ci.numberPresentation = PropertyPresentation.RESTRICTED; + ci.numberPresentation = TelecommManager.PRESENTATION_RESTRICTED; } else if (isCnapSpecialCaseUnknown(number)) { number = context.getString(R.string.unknown); - ci.numberPresentation = PropertyPresentation.UNKNOWN; + ci.numberPresentation = TelecommManager.PRESENTATION_UNKNOWN; } Log.d(TAG, "SpecialCnap: number=" + toLogSafePhoneNumber(number) + "; presentation now=" + ci.numberPresentation); diff --git a/src/com/android/incallui/ContactInfoCache.java b/src/com/android/incallui/ContactInfoCache.java index d0d09394..570b2de4 100644 --- a/src/com/android/incallui/ContactInfoCache.java +++ b/src/com/android/incallui/ContactInfoCache.java @@ -24,7 +24,7 @@ import android.net.Uri; import android.os.Looper; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.CommonDataKinds.Phone; -import android.telecomm.PropertyPresentation; +import android.telecomm.TelecommManager; import android.text.TextUtils; import com.android.contacts.common.util.PhoneNumberHelper; @@ -153,7 +153,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete int presentationMode = call.getNumberPresentation(); if (callerInfo.contactExists || callerInfo.isEmergencyNumber() || callerInfo.isVoiceMailNumber()) { - presentationMode = PropertyPresentation.ALLOWED; + presentationMode = TelecommManager.PRESENTATION_ALLOWED; } final ContactCacheEntry cacheEntry = buildEntry(mContext, callId, @@ -389,7 +389,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 != PropertyPresentation.ALLOWED) { + } else if (presentation != TelecommManager.PRESENTATION_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 @@ -426,7 +426,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 != PropertyPresentation.ALLOWED) { + if (presentation != TelecommManager.PRESENTATION_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 @@ -479,9 +479,9 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete */ private static String getPresentationString(Context context, int presentation) { String name = context.getString(R.string.unknown); - if (presentation == PropertyPresentation.RESTRICTED) { + if (presentation == TelecommManager.PRESENTATION_RESTRICTED) { name = context.getString(R.string.private_num); - } else if (presentation == PropertyPresentation.PAYPHONE) { + } else if (presentation == TelecommManager.PRESENTATION_PAYPHONE) { name = context.getString(R.string.payphone); } return name; -- cgit v1.2.3