use of android.app.prediction.AppPredictor in project android_packages_apps_Trebuchet by LineageOS.
the class PredictionAppTracker method createPredictor.
@WorkerThread
private AppPredictor createPredictor(Client client, int count) {
AppPredictionManager apm = mContext.getSystemService(AppPredictionManager.class);
if (apm == null) {
return null;
}
AppPredictor predictor = apm.createAppPredictionSession(new AppPredictionContext.Builder(mContext).setUiSurface(client.id).setPredictedTargetCount(count).setExtras(getAppPredictionContextExtras(client)).build());
predictor.registerPredictionUpdates(mContext.getMainExecutor(), PredictionUiStateManager.INSTANCE.get(mContext).appPredictorCallback(client));
predictor.requestPredictionUpdate();
return predictor;
}
Aggregations