From fd75e4c3b3c1a8f5a6ee5d3ce6a8503cf83ea424 Mon Sep 17 00:00:00 2001 From: Brandon Maxwell Date: Mon, 21 Mar 2016 19:04:31 -0700 Subject: Updating logic for isBlockedNumber In the framework blocking, both the e164 and non-e164 formats of a number can be blocked at the same time; these two formats will still have the same e164 value. Since the original code expected the e164 column to be unique, in this situation the Dialer thought the number was not blocked, resulting in a crash when attempting to block the number a second time. This CL changes the logic so multiple rows with the same e164 value are expected. Change-Id: I90995046df74b8ec2198eab1ef56a13f20dc1398 Fixes: 27724726 --- .../android/dialer/database/FilteredNumberAsyncQueryHandler.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/com') diff --git a/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java b/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java index 7af1a1339..52ef49ac0 100644 --- a/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java +++ b/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java @@ -158,7 +158,13 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler { new Listener() { @Override protected void onQueryComplete(int token, Object cookie, Cursor cursor) { - if (cursor == null || cursor.getCount() != 1) { + /* + * In the frameworking blocking, numbers can be blocked in both e164 format + * and not, resulting in multiple rows being returned for this query. For + * example, both '16502530000' and '6502530000' can exist at the same time + * and will be returned by this query. + */ + if (cursor == null || cursor.getCount() == 0) { listener.onCheckComplete(null); return; } -- cgit v1.2.3