Adjust preferene to align the lastest mock

- Because removeAll in updateState will cause preference list janking,
move updateState code to displayPreference.

Bug: 141601408
Fixes: 145369584
Test: manual and robolectric
Change-Id: Ic6ffeedfdd7a64671e497a61894d7c0d443750ef
This commit is contained in:
Raff Tsai
2019-12-02 15:09:26 +08:00
parent 0a2a6cfef7
commit 91aa4b853a
4 changed files with 41 additions and 63 deletions

View File

@@ -74,12 +74,7 @@ public class RecentLocationRequestPreferenceController extends LocationBasePrefe
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mCategoryRecentLocationRequests = screen.findPreference(getPreferenceKey());
}
@Override
public void updateState(Preference preference) {
mCategoryRecentLocationRequests.removeAll();
final Context prefContext = preference.getContext();
final Context prefContext = mCategoryRecentLocationRequests.getContext();
final List<RecentLocationApps.Request> recentLocationRequests =
mRecentLocationApps.getAppListSorted(false);
if (recentLocationRequests.size() > 3) {