Moving all-apps predictions to Launcher model

Predictions are loaded and managed by Launcher model and follow
the model lifecycle. They are then bound to the callback which
handles the UI

Bug: 160748731
Change-Id: I4a3ea0698d80fafe94afb4ce66ffa7f4a6a91c68
This commit is contained in:
Sunny Goyal
2020-07-27 17:50:33 -07:00
parent 52b1c94b76
commit 8b74cc761b
20 changed files with 424 additions and 805 deletions

View File

@@ -109,6 +109,7 @@ public class LoaderTask implements Runnable {
protected final LauncherAppState mApp;
private final AllAppsList mBgAllAppsList;
protected final BgDataModel mBgDataModel;
private final ModelDelegate mModelDelegate;
private FirstScreenBroadcast mFirstScreenBroadcast;
@@ -128,10 +129,11 @@ public class LoaderTask implements Runnable {
private boolean mStopped;
public LoaderTask(LauncherAppState app, AllAppsList bgAllAppsList, BgDataModel dataModel,
LoaderResults results) {
ModelDelegate modelDelegate, LoaderResults results) {
mApp = app;
mBgAllAppsList = bgAllAppsList;
mBgDataModel = dataModel;
mModelDelegate = modelDelegate;
mResults = results;
mLauncherApps = mApp.getContext().getSystemService(LauncherApps.class);
@@ -767,6 +769,9 @@ public class LoaderTask implements Runnable {
IOUtils.closeSilently(c);
}
// Load delegate items
mModelDelegate.loadItems();
// Break early if we've stopped loading
if (mStopped) {
mBgDataModel.clear();