diff options
author | Anne Rong <annerong@google.com> | 2015-09-16 22:23:04 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-09-16 22:23:04 +0000 |
commit | 69c3db29a3baf8526197110c7c36f8483e70e563 (patch) | |
tree | 31eb99de1dc9f21192d55829dfe3544b4e005279 | |
parent | 091214b943991595fee536ab3eddd973f560fbe3 (diff) | |
parent | 3efffa013374bef64adac7be912cfd0381e62d03 (diff) |
Merge "Call-Blocking causing crash with incoming SIP call" into ub-contactsdialer-a-dev
-rw-r--r-- | src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java b/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java index 2fdea0d13..cedde27f6 100644 --- a/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java +++ b/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java @@ -26,6 +26,7 @@ import android.database.sqlite.SQLiteDatabaseCorruptException; import android.net.Uri; import android.telephony.PhoneNumberUtils; +import com.android.contacts.common.util.PhoneNumberHelper; import com.android.dialer.database.FilteredNumberContract.FilteredNumber; import com.android.dialer.database.FilteredNumberContract.FilteredNumberColumns; import com.android.dialer.database.FilteredNumberContract.FilteredNumberSources; @@ -112,7 +113,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler { public final void isBlocked(final OnCheckBlockedListener listener, String normalizedNumber, String number, String countryIso) { if (normalizedNumber == null) { - normalizedNumber = PhoneNumberUtils.formatNumberToE164(number, countryIso); + normalizedNumber = getNormalizedNumber(number, countryIso); if (normalizedNumber == null) { throw new IllegalArgumentException("Invalid phone number"); } @@ -120,6 +121,14 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler { isBlocked(listener, normalizedNumber); } + private String getNormalizedNumber(String number, String countryIso) { + if (PhoneNumberHelper.isUriNumber(number)) { + return number; + } else { + return PhoneNumberUtils.formatNumberToE164(number, countryIso); + } + } + /** * Check if the normalized number given has been blocked. */ @@ -156,7 +165,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler { public final void blockNumber(final OnBlockNumberListener listener, String normalizedNumber, String number, String countryIso) { if (normalizedNumber == null) { - normalizedNumber = PhoneNumberUtils.formatNumberToE164(number, countryIso); + normalizedNumber = getNormalizedNumber(number, countryIso); } ContentValues v = new ContentValues(); v.put(FilteredNumberColumns.NORMALIZED_NUMBER, normalizedNumber); |