Display "Recent Location Requests" in order
A list of apps with recent location requests is displayed under Settings -> Security & Location -> Location. The apps were sorted in alphabetical order. This CL changes the behavior and displays the apps in original order from RecentLocationApps.getAppList(). Bug: 70350519 Test: Robolectric Test: manual Change-Id: I0fc1ce307b9519f3f324db220b6e2b32ed71cc2f
This commit is contained in:
@@ -32,6 +32,7 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
import com.android.settingslib.location.RecentLocationApps;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class RecentLocationRequestPreferenceController extends LocationBasePreferenceController {
|
||||
@@ -107,15 +108,17 @@ public class RecentLocationRequestPreferenceController extends LocationBasePrefe
|
||||
|
||||
final Context prefContext = preference.getContext();
|
||||
final List<RecentLocationApps.Request> recentLocationRequests =
|
||||
mRecentLocationApps.getAppList();
|
||||
mRecentLocationApps.getAppListSorted();
|
||||
|
||||
final List<Preference> recentLocationPrefs = new ArrayList<>(recentLocationRequests.size());
|
||||
for (final RecentLocationApps.Request request : recentLocationRequests) {
|
||||
recentLocationPrefs.add(createAppPreference(prefContext, request));
|
||||
}
|
||||
if (recentLocationRequests.size() > 0) {
|
||||
LocationSettings.addPreferencesSorted(
|
||||
recentLocationPrefs, mCategoryRecentLocationRequests);
|
||||
// Add preferences to container in original order (already sorted by recency).
|
||||
for (Preference entry : recentLocationPrefs) {
|
||||
mCategoryRecentLocationRequests.addPreference(entry);
|
||||
}
|
||||
} else {
|
||||
// If there's no item to display, add a "No recent apps" item.
|
||||
final Preference banner = createAppPreference(prefContext);
|
||||
|
Reference in New Issue
Block a user