summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristine Chen <christinech@google.com>2013-10-02 10:52:40 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-10-02 10:52:40 -0700
commit300186f1ccd3a1e774968c7232a50b80b9ded62d (patch)
tree88e58dad5639dc259d1241cdd7ceba106632fa10
parent10a01f52d6cd2de6eba8e2012c65f35d08f00f3b (diff)
parenteef089d0ddd9214f552b7e354e69dd83d0c27c51 (diff)
am eef089d0: Merge "Filters out legacy unknown numbers." into klp-dev
* commit 'eef089d0ddd9214f552b7e354e69dd83d0c27c51': Filters out legacy unknown numbers.
-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());
+ }
}