From 3e58e2ec82f42799fb8a0ff2227ac54fa45e1b03 Mon Sep 17 00:00:00 2001 From: Anne Rong Date: Fri, 18 Sep 2015 11:09:27 -0700 Subject: Refactor FilteredNumberAsyncQueryHandler.isBlocked Returns invalid status instead of throwing exception. Bug: 24177581 Change-Id: I76083ea40136189c98ab0eba31e52f0e389f50ae --- InCallUI/src/com/android/incallui/CallList.java | 35 ++++++++++++++----------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'InCallUI') 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); -- cgit v1.2.3