diff options
author | Anne Rong <annerong@google.com> | 2015-09-18 11:09:27 -0700 |
---|---|---|
committer | Anne Rong <annerong@google.com> | 2015-09-18 11:09:27 -0700 |
commit | 3e58e2ec82f42799fb8a0ff2227ac54fa45e1b03 (patch) | |
tree | a6a15ce965e11304fcd2171603e9e476213386f5 /InCallUI | |
parent | 3cf50edd29f372657192ebdaf9ca197c74fe94ad (diff) |
Refactor FilteredNumberAsyncQueryHandler.isBlocked
Returns invalid status instead of throwing exception.
Bug: 24177581
Change-Id: I76083ea40136189c98ab0eba31e52f0e389f50ae
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallList.java | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java index b93744047..71387fe48 100644 --- a/InCallUI/src/com/android/incallui/CallList.java +++ b/InCallUI/src/com/android/incallui/CallList.java @@ -102,25 +102,28 @@ public class CallList { } }; handler.postDelayed(runnable, BLOCK_QUERY_TIMEOUT_MS); - try { - mFilteredQueryHandler.isBlocked( - new FilteredNumberAsyncQueryHandler.OnCheckBlockedListener() { - @Override - public void onCheckComplete(final Integer id) { + if (mFilteredQueryHandler.startBlockedQuery( + new FilteredNumberAsyncQueryHandler.OnCheckBlockedListener() { + @Override + public void onCheckComplete(final Integer id) { + if (!hasTimedOut.get()) { + handler.removeCallbacks(runnable); + } + if (id == null) { if (!hasTimedOut.get()) { - handler.removeCallbacks(runnable); - } - if (id == null) { - if (!hasTimedOut.get()) { - onCallAddedInternal(call); - } - } else { - call.blockCall(); + onCallAddedInternal(call); } + } else { + call.blockCall(); } - }, null, call.getNumber(), countryIso); - } catch (IllegalArgumentException e) { - Log.d(this, "onCallAdded: invalid number, skipping block checking"); + } + }, null, call.getNumber(), countryIso)) { + Log.d(this, "onCallAdded: invalid number " + + call.getNumber() + ", skipping block checking"); + if (!hasTimedOut.get()) { + handler.removeCallbacks(runnable); + onCallAddedInternal(call); + } } } else { onCallAddedInternal(call); |