Move static search ranking from DatabaseResultLoader to Search Adapter.

This will avoid unnecessary static ranking if smart ranking is used.

Since loader does not need to provided sorted collection of results,
the loading data type has changed from List<> to Set<>. This will also
faster lookup in the Adapter.

Fixes: 38447799
Test: make RunSettingsRoboTests

Change-Id: I448b29bd4e8700c8ec4b5766cbeab4b3087ae39a
This commit is contained in:
Soroosh Mariooryad
2017-05-25 14:15:00 -07:00
parent 21aab578c9
commit 683ccdf97b
10 changed files with 100 additions and 76 deletions

View File

@@ -21,8 +21,8 @@ import android.content.Context;
import com.android.settings.search.InstalledAppResultLoader;
import com.android.settings.search.SearchResult;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
import java.util.Set;
/**
* Mock loader to subvert the requirements of returning data while also driving the Loader
@@ -35,12 +35,12 @@ class MockAppLoader extends InstalledAppResultLoader {
}
@Override
public List<? extends SearchResult> loadInBackground() {
return new ArrayList<>();
public Set<? extends SearchResult> loadInBackground() {
return new HashSet<>();
}
@Override
protected void onDiscardResult(List<? extends SearchResult> result) {
protected void onDiscardResult(Set<? extends SearchResult> result) {
}
}