Improve the latency of first entering Apps page

Root cause:
AppsPreferenceController will query the recent app usages twice on
the main thread.

Solution:
Set flag to ensure only triggering refreshUi() once when entering
the Apps page.

Also correct the preference key of apps.xml since we don’t have
duplicated preferences now.

Fixes: 183176038
Test: robotests & visual
Change-Id: Ia41ee1e4a1946b8122deca63e318d3915afcc426
This commit is contained in:
Yanting Yang
2021-06-25 03:43:14 +08:00
parent 54c1ff8489
commit 4124284bb7
3 changed files with 25 additions and 4 deletions

View File

@@ -69,6 +69,7 @@ public class AppDashboardFragment extends DashboardFragment {
use(SpecialAppAccessPreferenceController.class).setSession(getSettingsLifecycle());
mAppsPreferenceController = use(AppsPreferenceController.class);
mAppsPreferenceController.setFragment(this /* fragment */);
getSettingsLifecycle().addObserver(mAppsPreferenceController);
final HibernatedAppsPreferenceController hibernatedAppsPreferenceController =
use(HibernatedAppsPreferenceController.class);