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:
Kate Montgomery
2022-01-19 18:15:28 +00:00
parent d0e27f8dbd
commit 14e6c73687
6 changed files with 64 additions and 16 deletions

View File

@@ -17,6 +17,7 @@ import android.content.Context;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
@@ -83,8 +84,11 @@ public class RecentLocationRequestPreferenceController extends LocationBasePrefe
final Context prefContext = mCategoryRecentLocationRequests.getContext();
final List<RecentLocationApps.Request> recentLocationRequests = new ArrayList<>();
final UserManager userManager = UserManager.get(mContext);
final boolean showSystem = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 0) == 1;
for (RecentLocationApps.Request request : mRecentLocationApps.getAppListSorted(
false /* systemApps */)) {
showSystem)) {
if (isRequestMatchesProfileType(userManager, request, mType)) {
recentLocationRequests.add(request);
if (recentLocationRequests.size() == MAX_APPS) {