Make the show/hide system setting for recent location acccesses sticky.
This is in order to align the location indicator with the list of recent accesses shown in Settings. Bug: 191503437 Test: manual Change-Id: I7aaa65390567ca644e7137de15c558cdcdb29935
This commit is contained in:
@@ -20,6 +20,7 @@ import android.content.Intent;
|
||||
import android.icu.text.RelativeDateTimeFormatter;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
@@ -85,11 +86,17 @@ public class RecentLocationAccessPreferenceController extends LocationBasePrefer
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
mCategoryRecentLocationRequests = screen.findPreference(getPreferenceKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
mCategoryRecentLocationRequests.removeAll();
|
||||
final Context prefContext = mCategoryRecentLocationRequests.getContext();
|
||||
final List<RecentAppOpsAccess.Access> recentLocationAccesses = new ArrayList<>();
|
||||
final UserManager userManager = UserManager.get(mContext);
|
||||
for (RecentAppOpsAccess.Access access : mRecentLocationApps.getAppListSorted(
|
||||
/* showSystemApps= */ false)) {
|
||||
final boolean showSystem = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 0) == 1;
|
||||
for (RecentAppOpsAccess.Access access : mRecentLocationApps.getAppListSorted(showSystem)) {
|
||||
if (isRequestMatchesProfileType(userManager, access, mType)) {
|
||||
recentLocationAccesses.add(access);
|
||||
if (recentLocationAccesses.size() == MAX_APPS) {
|
||||
|
Reference in New Issue
Block a user