OSDN Git Service

Ignore tasks if the LauncherModel is still pending.
authorJon Miranda <jonmiranda@google.com>
Thu, 23 Feb 2017 23:12:42 +0000 (15:12 -0800)
committerJon Miranda <jonmiranda@google.com>
Thu, 23 Feb 2017 23:12:42 +0000 (15:12 -0800)
The tasks will be enqueued after the model is loaded when it
gets to the final state.

Bug: 31509386
Change-Id: Id72aaedb025a91a49b25e1ef103cc1976d603b21

src/com/android/launcher3/LauncherModel.java

index 40bd3d4..590c242 100644 (file)
@@ -1800,6 +1800,12 @@ public class LauncherModel extends BroadcastReceiver
     }
 
     void enqueueModelUpdateTask(BaseModelUpdateTask task) {
+        if (!mModelLoaded && mLoaderTask == null) {
+            if (DEBUG_LOADERS) {
+                Log.d(TAG, "enqueueModelUpdateTask Ignoring task since loader is pending=" + task);
+            }
+            return;
+        }
         task.init(this);
         runOnWorkerThread(task);
     }