use of android.app.prediction.AppPredictionManager in project android_packages_apps_Launcher3 by crdroidandroid.
the class QuickstepModelDelegate method recreatePredictors.
@WorkerThread
private void recreatePredictors() {
destroyPredictors();
if (!mActive) {
return;
}
Context context = mApp.getContext();
AppPredictionManager apm = context.getSystemService(AppPredictionManager.class);
if (apm == null) {
return;
}
TrustDatabaseHelper trustData = mApp.getTrustData();
int totalPackageHidden = trustData != null ? trustData.getTotalPackageHidden() : 0;
registerPredictor(mAllAppsState, apm.createAppPredictionSession(new AppPredictionContext.Builder(context).setUiSurface("home").setPredictedTargetCount(mIDP.numDatabaseAllAppsColumns + totalPackageHidden).build()));
// TODO: get bundle
registerPredictor(mHotseatState, apm.createAppPredictionSession(new AppPredictionContext.Builder(context).setUiSurface("hotseat").setPredictedTargetCount(mIDP.numDatabaseHotseatIcons + totalPackageHidden).setExtras(convertDataModelToAppTargetBundle(context, mDataModel)).build()));
registerWidgetsPredictor(apm.createAppPredictionSession(new AppPredictionContext.Builder(context).setUiSurface("widgets").setPredictedTargetCount(NUM_OF_RECOMMENDED_WIDGETS_PREDICATION).build()));
}
Aggregations