summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristine Chen <christinech@google.com>2013-09-30 14:43:03 -0700
committerChristine Chen <christinech@google.com>2013-09-30 15:57:47 -0700
commita35059abbec801b20d8f75199d8b30cba981e4ce (patch)
tree4a0d9c9b7b45c33ba278081e16254dafd9c151bf /src
parent02bd6dfd37763a21d1a47a24579070f21c9ffc88 (diff)
Filters out legacy unknown numbers.
- Adds "-1", "-2", "-3" as unknown number placeholders for legacy reasons. - Disable calling feature for these numbers. - Show caller info as "Unknown" for these numbers. Bug: 10966248 Change-Id: Ibb7904685decbc602db33a56c7709279728e503d
Diffstat (limited to 'src')
-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());
+ }
}