From eb3ae0a822a408d2b48c6d91e68bc649b3791ab8 Mon Sep 17 00:00:00 2001 From: calderwoodra Date: Fri, 2 Mar 2018 19:19:45 -0800 Subject: Check if the activity is still alive before refreshing unread tab counts. My hypothesis is that there is a race condition where the call log changes and we are leaving the activity before the content observer is unregistered or the loader it starts is finished. This results in a callback calling #fetchCalls while Dialer is in the background, resulting in a crash. This change will confirm my hypothesis. Even if my hypothesis is incorrect, we have similar checks throughout this class which indicates to me that some issue exists here and that this check is safe to do. Bug: 73972084 Test: n/a PiperOrigin-RevId: 187700318 Change-Id: I98cea86b5b7041c4f4aac09544445aaade6bfd40 --- java/com/android/dialer/app/calllog/CallLogFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'java/com/android/dialer/app') diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java index 7e49cc965..816801437 100644 --- a/java/com/android/dialer/app/calllog/CallLogFragment.java +++ b/java/com/android/dialer/app/calllog/CallLogFragment.java @@ -489,7 +489,7 @@ public class CallLogFragment extends Fragment @Override public void fetchCalls() { callLogQueryHandler.fetchCalls(callTypeFilter, dateLimit); - if (!isCallLogActivity) { + if (!isCallLogActivity && getActivity() != null && !getActivity().isFinishing()) { FragmentUtils.getParentUnsafe(this, CallLogFragmentListener.class).updateTabUnreadCounts(); } } -- cgit v1.2.3