From 0bf3ed99eb338844dc9173794013b89113687151 Mon Sep 17 00:00:00 2001 From: Yi-Ling Chuang Date: Thu, 24 Mar 2022 19:31:07 +0800 Subject: [PATCH] Fix flickers on the Location page Use the UiBlocker and its delegate method to prevent the flicker. Fixes: 220837804 Test: Go to Settings > Location and see all items appearing at the same time. Change-Id: I2095289b9436ca66970b6a868d5c9780f2b19664 --- .../location/RecentLocationAccessPreferenceController.java | 6 +++++- ...ecentLocationAccessSeeAllButtonPreferenceController.java | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java index 18221d0f409..f4044ed03d1 100644 --- a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java +++ b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java @@ -131,12 +131,16 @@ public class RecentLocationAccessPreferenceController extends LocationBasePrefer banner.setSelectable(false); mCategoryRecentLocationRequests.addPreference(banner); } + + if (mUiBlockListener != null) { + mUiBlockListener.onBlockerWorkFinished(this); + } } @Override public void onLocationModeChanged(int mode, boolean restricted) { boolean enabled = mLocationEnabler.isEnabled(mode); - mCategoryRecentLocationRequests.setVisible(enabled); + updatePreferenceVisibilityDelegate(mCategoryRecentLocationRequests, enabled); } /** diff --git a/src/com/android/settings/location/RecentLocationAccessSeeAllButtonPreferenceController.java b/src/com/android/settings/location/RecentLocationAccessSeeAllButtonPreferenceController.java index 68cde637eeb..b0dfae40c31 100644 --- a/src/com/android/settings/location/RecentLocationAccessSeeAllButtonPreferenceController.java +++ b/src/com/android/settings/location/RecentLocationAccessSeeAllButtonPreferenceController.java @@ -20,11 +20,13 @@ import android.content.Context; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; +import com.android.settings.core.BasePreferenceController; + /** * Preference controller that handles the "See All" button for recent location access. */ public class RecentLocationAccessSeeAllButtonPreferenceController extends - LocationBasePreferenceController { + LocationBasePreferenceController implements BasePreferenceController.UiBlocker { private Preference mPreference; @@ -44,6 +46,6 @@ public class RecentLocationAccessSeeAllButtonPreferenceController extends @Override public void onLocationModeChanged(int mode, boolean restricted) { boolean enabled = mLocationEnabler.isEnabled(mode); - mPreference.setVisible(enabled); + updatePreferenceVisibilityDelegate(mPreference, enabled); } }