summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcalderwoodra <calderwoodra@google.com>2018-03-02 19:19:45 -0800
committerCopybara-Service <copybara-piper@google.com>2018-03-05 10:50:48 -0800
commiteb3ae0a822a408d2b48c6d91e68bc649b3791ab8 (patch)
treea15cb23aa34b43b6c6c62df2af85b97012c5088e
parent1efd9579502d164bac214006d582ca26e2bc123e (diff)
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
-rw-r--r--java/com/android/dialer/app/calllog/CallLogFragment.java2
1 files changed, 1 insertions, 1 deletions
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();
}
}