Search in sources :

Example 1 with AppPredictionManager

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()));
}
Also used : Context(android.content.Context) AppPredictionContext(android.app.prediction.AppPredictionContext) TrustDatabaseHelper(com.android.launcher3.lineage.trust.db.TrustDatabaseHelper) 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 Context (android.content.Context)1 WorkerThread (androidx.annotation.WorkerThread)1 TrustDatabaseHelper (com.android.launcher3.lineage.trust.db.TrustDatabaseHelper)1