summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/com/android/dialer/calllog/PhoneNumberHelper.java3
-rw-r--r--src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java15
2 files changed, 17 insertions, 1 deletions
diff --git a/src/com/android/dialer/calllog/PhoneNumberHelper.java b/src/com/android/dialer/calllog/PhoneNumberHelper.java
index 9e1d816b2..5a882e8a8 100644
--- a/src/com/android/dialer/calllog/PhoneNumberHelper.java
+++ b/src/com/android/dialer/calllog/PhoneNumberHelper.java
@@ -56,6 +56,9 @@ public class PhoneNumberHelper {
if (new PhoneNumberUtilsWrapper().isVoicemailNumber(number)) {
return mResources.getString(R.string.voicemail);
}
+ if (PhoneNumberUtilsWrapper.isLegacyUnknownNumbers(number)) {
+ return mResources.getString(R.string.unknown);
+ }
if (TextUtils.isEmpty(formattedNumber)) {
return number;
} else {
diff --git a/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java b/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
index c397f0a31..9913c20c6 100644
--- a/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
+++ b/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
@@ -20,15 +20,21 @@ import android.provider.CallLog;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
+import com.google.android.collect.Sets;
+
+import java.util.Set;
+
/**
*
*/
public class PhoneNumberUtilsWrapper {
+ private static final Set<String> LEGACY_UNKNOWN_NUMBERS = Sets.newHashSet("-1", "-2", "-3");
+
/** Returns true if it is possible to place a call to the given number. */
public static boolean canPlaceCallsTo(CharSequence number, int presentation) {
return presentation == CallLog.Calls.PRESENTATION_ALLOWED
- && !TextUtils.isEmpty(number);
+ && !TextUtils.isEmpty(number) && !isLegacyUnknownNumbers(number);
}
/**
@@ -71,6 +77,13 @@ public class PhoneNumberUtilsWrapper {
if (new PhoneNumberUtilsWrapper().isVoicemailNumber(number)) {
return false;
}
+ if (isLegacyUnknownNumbers(number.toString())) {
+ return false;
+ }
return true;
}
+
+ public static boolean isLegacyUnknownNumbers(CharSequence number) {
+ return LEGACY_UNKNOWN_NUMBERS.contains(number.toString());
+ }
}