summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-11-19 14:11:24 -0800
committerYorke Lee <yorkelee@google.com>2013-11-19 14:11:24 -0800
commit37d29854313ca0a7807ac4fd5d10d154b79ee2eb (patch)
treec7a4bb79e1eb9b0d5c6555e095fad7836db47aea
parent24ec319f8d410be8a1923c4033f927165876cbab (diff)
Remove private references to isUriNumber and getUsernameFromUriNumber
These methods in PhoneNumberUtils are pretty specific, so don't make them public APIs. Instead, use the methods already in PhoneNumberhelper. Bug: 6948882 Change-Id: I487593543eba526c64588d9a3e70b19b4ed941ab
-rw-r--r--src/com/android/dialer/CallDetailActivity.java4
-rw-r--r--src/com/android/dialer/PhoneCallDetailsHelper.java3
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java3
-rw-r--r--src/com/android/dialer/calllog/CallLogGroupBuilder.java4
-rw-r--r--src/com/android/dialer/calllog/ContactInfoHelper.java7
-rw-r--r--src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java4
6 files changed, 16 insertions, 9 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index c8b8385b6..c96cbf1cd 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -37,7 +37,6 @@ import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.DisplayNameSources;
import android.provider.ContactsContract.Intents.Insert;
import android.provider.VoicemailContract.Voicemails;
-import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@@ -59,6 +58,7 @@ import com.android.contacts.common.ClipboardUtils;
import com.android.contacts.common.GeoUtil;
import com.android.contacts.common.model.Contact;
import com.android.contacts.common.model.ContactLoader;
+import com.android.contacts.common.util.PhoneNumberHelper;
import com.android.contacts.common.util.UriUtils;
import com.android.dialer.BackScrollManager.ScrollableHeader;
import com.android.dialer.calllog.CallDetailHistoryAdapter;
@@ -561,7 +561,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
// Only show a label if the number is shown and it is not a SIP address.
if (!TextUtils.isEmpty(firstDetails.name)
&& !TextUtils.isEmpty(firstDetails.number)
- && !PhoneNumberUtils.isUriNumber(firstDetails.number.toString())) {
+ && !PhoneNumberHelper.isUriNumber(firstDetails.number.toString())) {
entry.label = Phone.getTypeLabel(mResources, firstDetails.numberType,
firstDetails.numberLabel);
}
diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java
index 8e6c943a4..af0a5257e 100644
--- a/src/com/android/dialer/PhoneCallDetailsHelper.java
+++ b/src/com/android/dialer/PhoneCallDetailsHelper.java
@@ -31,6 +31,7 @@ import android.view.View;
import android.widget.TextView;
import com.android.contacts.common.test.NeededForTesting;
+import com.android.contacts.common.util.PhoneNumberHelper;
import com.android.dialer.calllog.CallTypeHelper;
import com.android.dialer.calllog.ContactInfo;
import com.android.dialer.calllog.PhoneNumberDisplayHelper;
@@ -102,7 +103,7 @@ public class PhoneCallDetailsHelper {
CharSequence numberFormattedLabel = null;
// Only show a label if the number is shown and it is not a SIP address.
if (!TextUtils.isEmpty(details.number)
- && !PhoneNumberUtils.isUriNumber(details.number.toString())) {
+ && !PhoneNumberHelper.isUriNumber(details.number.toString())) {
if (details.numberLabel == ContactInfo.GEOCODE_AS_LABEL) {
numberFormattedLabel = details.geocode;
} else {
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index c8e261358..4fb4b0a26 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -40,6 +40,7 @@ import android.widget.TextView;
import com.android.common.io.MoreCloseables;
import com.android.contacts.common.CallUtil;
import com.android.contacts.common.GeoUtil;
+import com.android.contacts.common.util.PhoneNumberHelper;
import com.android.dialer.R;
import com.android.dialer.util.EmptyLoader;
import com.android.dialer.voicemail.VoicemailStatusHelper;
@@ -368,7 +369,7 @@ public class CallLogFragment extends ListFragment
}
Intent intent;
// If "number" is really a SIP address, construct a sip: URI.
- if (PhoneNumberUtils.isUriNumber(number)) {
+ if (PhoneNumberHelper.isUriNumber(number)) {
intent = CallUtil.getCallIntent(
Uri.fromParts(CallUtil.SCHEME_SIP, number, null));
} else {
diff --git a/src/com/android/dialer/calllog/CallLogGroupBuilder.java b/src/com/android/dialer/calllog/CallLogGroupBuilder.java
index 213f1e774..0b2edf0bb 100644
--- a/src/com/android/dialer/calllog/CallLogGroupBuilder.java
+++ b/src/com/android/dialer/calllog/CallLogGroupBuilder.java
@@ -21,6 +21,8 @@ import android.provider.CallLog.Calls;
import android.telephony.PhoneNumberUtils;
import com.android.common.widget.GroupingListAdapter;
+import com.android.contacts.common.util.PhoneNumberHelper;
+
import com.google.common.annotations.VisibleForTesting;
/**
@@ -117,7 +119,7 @@ public class CallLogGroupBuilder {
@VisibleForTesting
boolean equalNumbers(String number1, String number2) {
- if (PhoneNumberUtils.isUriNumber(number1) || PhoneNumberUtils.isUriNumber(number2)) {
+ if (PhoneNumberHelper.isUriNumber(number1) || PhoneNumberHelper.isUriNumber(number2)) {
return compareSipAddresses(number1, number2);
} else {
return PhoneNumberUtils.compare(number1, number2);
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java
index bcb98fd48..d248c70c8 100644
--- a/src/com/android/dialer/calllog/ContactInfoHelper.java
+++ b/src/com/android/dialer/calllog/ContactInfoHelper.java
@@ -28,6 +28,7 @@ import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import com.android.contacts.common.util.Constants;
+import com.android.contacts.common.util.PhoneNumberHelper;
import com.android.contacts.common.util.UriUtils;
import com.android.dialer.service.CachedNumberLookupService;
import com.android.dialer.service.CachedNumberLookupService.CachedContactInfo;
@@ -66,13 +67,13 @@ public class ContactInfoHelper {
final ContactInfo info;
// Determine the contact info.
- if (PhoneNumberUtils.isUriNumber(number)) {
+ if (PhoneNumberHelper.isUriNumber(number)) {
// This "number" is really a SIP address.
ContactInfo sipInfo = queryContactInfoForSipAddress(number);
if (sipInfo == null || sipInfo == ContactInfo.EMPTY) {
// Check whether the "username" part of the SIP address is
// actually the phone number of a contact.
- String username = PhoneNumberUtils.getUsernameFromUriNumber(number);
+ String username = PhoneNumberHelper.getUsernameFromUriNumber(number);
if (PhoneNumberUtils.isGlobalPhoneNumber(username)) {
sipInfo = queryContactInfoForPhoneNumber(username, countryIso);
}
@@ -253,7 +254,7 @@ public class ContactInfoHelper {
return "";
}
// If "number" is really a SIP address, don't try to do any formatting at all.
- if (PhoneNumberUtils.isUriNumber(number)) {
+ if (PhoneNumberHelper.isUriNumber(number)) {
return number;
}
if (TextUtils.isEmpty(countryIso)) {
diff --git a/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java b/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
index 2133f0f9d..dd20b5c22 100644
--- a/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
+++ b/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
@@ -20,6 +20,8 @@ import android.provider.CallLog;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
+import com.android.contacts.common.util.PhoneNumberHelper;
+
import com.google.common.collect.Sets;
import java.util.Set;
@@ -58,7 +60,7 @@ public class PhoneNumberUtilsWrapper {
* static method.
*/
public boolean isSipNumber(CharSequence number) {
- return number != null && PhoneNumberUtils.isUriNumber(number.toString());
+ return number != null && PhoneNumberHelper.isUriNumber(number.toString());
}
public static boolean isUnknownNumberThatCanBeLookedUp(CharSequence number, int presentation) {