diff options
Diffstat (limited to 'src')
4 files changed, 8 insertions, 9 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 47c3cf0ea..4e7e7b3c0 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -196,7 +196,6 @@ public class CallDetailActivity extends AppCompatActivity private PhoneCallDetails mDetails; protected String mNumber; private Uri mVoicemailUri; - private String mDefaultCountryIso; private String mDisplayNumber; private ListView mHistoryList; @@ -242,7 +241,6 @@ public class CallDetailActivity extends AppCompatActivity mCallerName = (TextView) findViewById(R.id.caller_name); mCallerNumber = (TextView) findViewById(R.id.caller_number); mAccountLabel = (TextView) findViewById(R.id.phone_account_label); - mDefaultCountryIso = GeoUtil.getCurrentCountryIso(this); mContactPhotoManager = ContactPhotoManager.getInstance(this); mCallButton = findViewById(R.id.call_back_button); @@ -391,7 +389,8 @@ public class CallDetailActivity extends AppCompatActivity } private void updatePhotoAndBlockActionItem() { - if (mDetails == null || !FilteredNumbersUtil.canBlockNumber(this, mNumber)) { + if (mDetails == null || + !FilteredNumbersUtil.canBlockNumber(this, mNumber, mDetails.countryIso)) { return; } diff --git a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java index c6337bc67..28e406fd5 100644 --- a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java +++ b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java @@ -303,7 +303,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder .setOnMenuItemClickListener(this); } - if (FilteredNumbersUtil.canBlockNumber(mContext, number)) { + if (FilteredNumbersUtil.canBlockNumber(mContext, number, countryIso)) { mFilteredNumberAsyncQueryHandler.startBlockedQuery( new FilteredNumberAsyncQueryHandler.OnCheckBlockedListener() { @Override diff --git a/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java b/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java index 425a729db..7a94eebb5 100644 --- a/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java +++ b/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java @@ -151,7 +151,7 @@ public class BlockNumberDialogFragment extends DialogFragment { @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - if (!FilteredNumbersUtil.canBlockNumber(getActivity(), mNumber)) { + if (!FilteredNumbersUtil.canBlockNumber(getActivity(), mNumber, mCountryIso)) { dismiss(); Toast.makeText(getContext(), getString(R.string.invalidNumber, mDisplayNumber), Toast.LENGTH_SHORT).show(); diff --git a/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java b/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java index 8a0d79233..e7097f4ff 100644 --- a/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java +++ b/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java @@ -37,7 +37,6 @@ import java.util.LinkedList; import java.util.List; import com.android.contacts.common.testing.NeededForTesting; -import com.android.contacts.common.util.PhoneNumberHelper; import com.android.dialer.R; import com.android.dialer.database.FilteredNumberAsyncQueryHandler; import com.android.dialer.database.FilteredNumberAsyncQueryHandler.OnHasBlockedNumbersListener; @@ -357,9 +356,10 @@ public class FilteredNumbersUtil { }); } - public static boolean canBlockNumber(Context context, String number) { - return !TextUtils.isEmpty(number) && !PhoneNumberUtils.isEmergencyNumber(number) - && !PhoneNumberHelper.isUriNumber(number); + public static boolean canBlockNumber(Context context, String number, String countryIso) { + final String normalizedNumber = PhoneNumberUtils.formatNumberToE164(number, countryIso); + return !TextUtils.isEmpty(normalizedNumber) + && !PhoneNumberUtils.isEmergencyNumber(normalizedNumber); } private static long getRecentEmergencyCallThresholdMs(Context context) { |