Adjust logging of launcher2 launch times, and make all apps loading wait a little longer,
even though usually it happens later anyway.

For bug 2226555.
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index d4a9d95..608e7b7 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -26,7 +26,11 @@
 import android.graphics.RectF;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
+import android.os.Parcelable;
+import android.os.Parcel;
+import android.os.SystemClock;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.MotionEvent;
 import android.view.VelocityTracker;
 import android.view.View;
@@ -35,8 +39,6 @@
 import android.view.ViewParent;
 import android.widget.Scroller;
 import android.widget.TextView;
-import android.os.Parcelable;
-import android.os.Parcel;
 
 import java.util.ArrayList;
 
@@ -468,6 +470,24 @@
 
     @Override
     protected void dispatchDraw(Canvas canvas) {
+        if (Launcher.lastStartTime != 0) {
+            int itemCount = 0;
+            for (int i=0; i<getChildCount(); i++) {
+                View child = getChildAt(i);
+                if (child instanceof ViewGroup) {
+                    itemCount += ((ViewGroup)child).getChildCount();
+                }
+            }
+            if (!mLauncher.isWorkspaceLocked()) {
+                Log.d(Launcher.TAG, "time from start to draw (" + itemCount + " items): "
+                        + (SystemClock.uptimeMillis() - Launcher.lastStartTime) + "ms");
+                Launcher.lastStartTime = 0;
+            } else {
+                Log.d(Launcher.TAG, "drawing but not ready yet (" + itemCount + " items): "
+                        + (SystemClock.uptimeMillis() - Launcher.lastStartTime) + "ms");
+            }
+        }
+
         boolean restore = false;
         int restoreCount = 0;