Revert "Revert "Synchronizing loader preload to avoid launcher getting stuck in loading state,""

This reverts commit 73aa3025c0.

Reason for revert: Post-drop revert

Change-Id: Ife752d26e07d9c064c938ff8d33d40457b54217a
This commit is contained in:
Winson Chung 2018-02-16 03:23:51 +00:00
parent 73aa3025c0
commit d6519668bf
2 changed files with 11 additions and 5 deletions

View File

@ -493,6 +493,15 @@ public class LauncherModel extends BroadcastReceiver
}
}
public void startLoaderForResultsIfNotLoaded(LoaderResults results) {
synchronized (mLock) {
if (!isModelLoaded()) {
Log.d(TAG, "Workspace not loaded, loading now");
startLoaderForResults(results);
}
}
}
/**
* Loads the workspace screen ids in an ordered list.
*/

View File

@ -49,11 +49,8 @@ public class ModelPreload implements ModelUpdateTask {
@Override
public final void run() {
if (!mModel.isModelLoaded()) {
Log.d(TAG, "Workspace not loaded, loading now");
mModel.startLoaderForResults(
new LoaderResults(mApp, mBgDataModel, mAllAppsList, 0, null));
}
mModel.startLoaderForResultsIfNotLoaded(
new LoaderResults(mApp, mBgDataModel, mAllAppsList, 0, null));
Log.d(TAG, "Preload completed : " + mModel.isModelLoaded());
onComplete(mModel.isModelLoaded());
}