Sync search result loaders

The loaders should be syncronized so the results can be
properly ranked without sudden insertions.

This means InstalledAppsLoader needs to finish faster,
which is accomplished by delaying icon loading to bind time
rather than as the apps are queried.

Bug: 34772522
Test: make RunSettingsRoboTests
Change-Id: I7f5244c574d37c6cfd8bbd0d3d40488f38211be3
This commit is contained in:
Matthew Fritze
2017-02-02 14:55:49 -08:00
parent 249077a0cd
commit 40ce0fab75
17 changed files with 473 additions and 103 deletions

View File

@@ -31,7 +31,7 @@ import java.util.List;
/**
* Loader for recently searched queries.
*/
public class SavedQueryLoader extends AsyncLoader<List<SearchResult>> {
public class SavedQueryLoader extends AsyncLoader<List<? extends SearchResult>> {
// Max number of proposed suggestions
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
@@ -45,12 +45,12 @@ public class SavedQueryLoader extends AsyncLoader<List<SearchResult>> {
}
@Override
protected void onDiscardResult(List<SearchResult> result) {
protected void onDiscardResult(List<? extends SearchResult> result) {
}
@Override
public List<SearchResult> loadInBackground() {
public List<? extends SearchResult> loadInBackground() {
Cursor cursor = mDatabase.query(IndexDatabaseHelper.Tables.TABLE_SAVED_QUERIES /* table */,
new String[]{SavedQueriesColumns.QUERY} /* columns */,
null /* selection */,