Search in sources :

Example 1 with AppPredictor

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;
}
Also used : AppPredictor(android.app.prediction.AppPredictor) AppPredictionManager(android.app.prediction.AppPredictionManager) AppPredictionContext(android.app.prediction.AppPredictionContext) WorkerThread(androidx.annotation.WorkerThread)

Aggregations

AppPredictionContext (android.app.prediction.AppPredictionContext)1 AppPredictionManager (android.app.prediction.AppPredictionManager)1 AppPredictor (android.app.prediction.AppPredictor)1 WorkerThread (androidx.annotation.WorkerThread)1