This variable can be checked outside the lock because it's only
set from the ui thread.

This will help the ANR in LauncherModel.onReceive because if
we're under contention, there's a good chance that we haven't loaded
yet.  It won't completely fix it, but that will take a large refactoring.

Bug 2672967

Change-Id: I2c97a416767b4bb6aac0252f02e2aa2055ae8a4e
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index 17cd151..17f7573 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -304,13 +304,13 @@
         ArrayList<ApplicationInfo> removed = null;
         ArrayList<ApplicationInfo> modified = null;
 
-        synchronized (mAllAppsListLock) {
-            if (mBeforeFirstLoad) {
-                // If we haven't even loaded yet, don't bother, since we'll just pick
-                // up the changes.
-                return;
-            }
+        if (mBeforeFirstLoad) {
+            // If we haven't even loaded yet, don't bother, since we'll just pick
+            // up the changes.
+            return;
+        }
 
+        synchronized (mAllAppsListLock) {
             final String action = intent.getAction();
 
             if (Intent.ACTION_PACKAGE_CHANGED.equals(action)