diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 929606e4a4..a4d188f159 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -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. */ diff --git a/src/com/android/launcher3/model/ModelPreload.java b/src/com/android/launcher3/model/ModelPreload.java index 6f33bedb0e..f186e9572d 100644 --- a/src/com/android/launcher3/model/ModelPreload.java +++ b/src/com/android/launcher3/model/ModelPreload.java @@ -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()); }