Dialer: Fix callstats
* We need to pass the child fragment manager for this to work, not use
the supportFragmentManager of the parent in order to not crash here
Change-Id: I8df2076032480dcf9c9902dee743d767cdaed137
diff --git a/java/com/android/dialer/app/contactinfo/ExpirableCacheHeadlessFragment.java b/java/com/android/dialer/app/contactinfo/ExpirableCacheHeadlessFragment.java
index 61f8497..dc059d8 100644
--- a/java/com/android/dialer/app/contactinfo/ExpirableCacheHeadlessFragment.java
+++ b/java/com/android/dialer/app/contactinfo/ExpirableCacheHeadlessFragment.java
@@ -20,7 +20,6 @@
import android.os.Bundle;
import androidx.annotation.NonNull;
-import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
@@ -41,11 +40,6 @@
ExpirableCache.create(CONTACT_INFO_CACHE_SIZE);
@NonNull
- public static ExpirableCacheHeadlessFragment attach(@NonNull AppCompatActivity parentActivity) {
- return attach(parentActivity.getSupportFragmentManager());
- }
-
- @NonNull
public static ExpirableCacheHeadlessFragment attach(FragmentManager fragmentManager) {
ExpirableCacheHeadlessFragment fragment =
(ExpirableCacheHeadlessFragment) fragmentManager.findFragmentByTag(FRAGMENT_TAG);
diff --git a/java/com/android/dialer/callstats/CallStatsFragment.java b/java/com/android/dialer/callstats/CallStatsFragment.java
index b84cd3d..da39d08 100644
--- a/java/com/android/dialer/callstats/CallStatsFragment.java
+++ b/java/com/android/dialer/callstats/CallStatsFragment.java
@@ -40,7 +40,6 @@
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
-import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -109,7 +108,7 @@
setHasOptionsMenu(true);
ExpirableCacheHeadlessFragment cacheFragment =
- ExpirableCacheHeadlessFragment.attach((AppCompatActivity) getActivity());
+ ExpirableCacheHeadlessFragment.attach(getChildFragmentManager());
mAdapter = new CallStatsAdapter(getActivity(),
ContactsComponent.get(requireActivity()).contactDisplayPreferences(),
cacheFragment.getRetainedCache());