From 37375565e5c95ff58c859c339749668d4e34dcc6 Mon Sep 17 00:00:00 2001 From: Chaohui Wang Date: Fri, 15 Apr 2022 13:53:42 +0800 Subject: [PATCH] Fix sub status of LocationSettings Fix the followings: Recent access apps are not displayed after toggling off/on "Use location". When "Use location" is enabled, "Location for work profile" switch is disable and gray out. Fix: 227621199 Fix: 227265216 Test: manual Change-Id: I9f955a381827eb020fbd0d6ebeb9fced3dec1dcf --- .../RecentLocationAccessPreferenceController.java | 10 ++-------- ...LocationAccessSeeAllButtonPreferenceController.java | 6 ++---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java index f4044ed03d1..35f62572df0 100644 --- a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java +++ b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java @@ -28,7 +28,6 @@ import androidx.preference.PreferenceCategory; import androidx.preference.PreferenceScreen; import com.android.settings.R; -import com.android.settings.core.BasePreferenceController; import com.android.settings.dashboard.DashboardFragment; import com.android.settings.dashboard.profileselector.ProfileSelectFragment; import com.android.settingslib.applications.RecentAppOpsAccess; @@ -41,8 +40,7 @@ import java.util.List; /** * Preference controller that handles the display of apps that access locations. */ -public class RecentLocationAccessPreferenceController extends LocationBasePreferenceController - implements BasePreferenceController.UiBlocker { +public class RecentLocationAccessPreferenceController extends LocationBasePreferenceController { public static final int MAX_APPS = 3; @VisibleForTesting RecentAppOpsAccess mRecentLocationApps; @@ -131,16 +129,12 @@ 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); - updatePreferenceVisibilityDelegate(mCategoryRecentLocationRequests, enabled); + mCategoryRecentLocationRequests.setVisible(enabled); } /** diff --git a/src/com/android/settings/location/RecentLocationAccessSeeAllButtonPreferenceController.java b/src/com/android/settings/location/RecentLocationAccessSeeAllButtonPreferenceController.java index b0dfae40c31..68cde637eeb 100644 --- a/src/com/android/settings/location/RecentLocationAccessSeeAllButtonPreferenceController.java +++ b/src/com/android/settings/location/RecentLocationAccessSeeAllButtonPreferenceController.java @@ -20,13 +20,11 @@ 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 implements BasePreferenceController.UiBlocker { + LocationBasePreferenceController { private Preference mPreference; @@ -46,6 +44,6 @@ public class RecentLocationAccessSeeAllButtonPreferenceController extends @Override public void onLocationModeChanged(int mode, boolean restricted) { boolean enabled = mLocationEnabler.isEnabled(mode); - updatePreferenceVisibilityDelegate(mPreference, enabled); + mPreference.setVisible(enabled); } }