Starting the loader if the previous loader is not complete, instead of binding page synchronously

Bug: 21107637
Change-Id: If04952c7d5c8a38a739ce5536ecac394011ab61a
This commit is contained in:
Sunny Goyal
2015-05-18 15:19:29 -07:00
parent a926343d5c
commit f5cd998c25

View File

@@ -1390,10 +1390,10 @@ public class LauncherModel extends BroadcastReceiver
if (mCallbacks != null && mCallbacks.get() != null) {
// If there is already one running, tell it to stop.
// also, don't downgrade isLaunching if we're already running
isLaunching = isLaunching || stopLoaderLocked();
isLaunching = stopLoaderLocked() || isLaunching;
mLoaderTask = new LoaderTask(mApp.getContext(), isLaunching, loadFlags);
if (synchronousBindPage != PagedView.INVALID_RESTORE_PAGE
&& mAllAppsLoaded && mWorkspaceLoaded) {
&& mAllAppsLoaded && mWorkspaceLoaded && !mIsLoaderTaskRunning) {
mLoaderTask.runBindSynchronousPage(synchronousBindPage);
} else {
sWorkerThread.setPriority(Thread.NORM_PRIORITY);
@@ -1600,6 +1600,9 @@ public class LauncherModel extends BroadcastReceiver
public void run() {
synchronized (mLock) {
if (mStopped) {
return;
}
mIsLoaderTaskRunning = true;
}
// Optimize for end-user experience: if the Launcher is up and // running with the
@@ -2783,6 +2786,11 @@ public class LauncherModel extends BroadcastReceiver
}
if (!mAllAppsLoaded) {
loadAllApps();
synchronized (LoaderTask.this) {
if (mStopped) {
return;
}
}
updateAllAppsIconsCache();
synchronized (LoaderTask.this) {
if (mStopped) {