From a35059abbec801b20d8f75199d8b30cba981e4ce Mon Sep 17 00:00:00 2001 From: Christine Chen Date: Mon, 30 Sep 2013 14:43:03 -0700 Subject: 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 --- src/com/android/dialer/calllog/PhoneNumberHelper.java | 3 +++ .../android/dialer/calllog/PhoneNumberUtilsWrapper.java | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src') 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 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()); + } } -- cgit v1.2.3