Merge "Adding warmup call API for Settings search ranking."

This commit is contained in:
Soroosh Mariooryad
2017-07-11 23:01:12 +00:00
committed by Android (Google) Code Review
3 changed files with 40 additions and 0 deletions

View File

@@ -130,4 +130,10 @@ public interface SearchFeatureProvider {
return false;
}
/**
* Prepare for search ranking predictions to avoid latency on the first prediction call.
*/
default void searchRankingWarmup(Context context) {
}
}

View File

@@ -209,6 +209,10 @@ public class SearchFragment extends InstrumentedFragment implements SearchView.O
@Override
public void onResume() {
super.onResume();
Context appContext = getContext().getApplicationContext();
if (mSearchFeatureProvider.isSmartSearchRankingEnabled(appContext)) {
mSearchFeatureProvider.searchRankingWarmup(appContext);
}
requery();
}