diff options
author | Joe Onorato <joeo@android.com> | 2009-11-02 12:01:11 -0500 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2009-11-02 12:01:11 -0500 |
commit | 080d9b614e609826dce2606f9e474af674ead933 (patch) | |
tree | 9c686507db61f8f840a21b2a7eb76a980694a2ca /src | |
parent | a4c0cb965575b7a0832d92bc0b33e06c7c66cb10 (diff) | |
download | android_packages_apps_Trebuchet-080d9b614e609826dce2606f9e474af674ead933.tar.gz android_packages_apps_Trebuchet-080d9b614e609826dce2606f9e474af674ead933.tar.bz2 android_packages_apps_Trebuchet-080d9b614e609826dce2606f9e474af674ead933.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/AllAppsView.java | 5 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 15 | ||||
-rw-r--r-- | src/com/android/launcher2/LauncherModel.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher2/Utilities.java | 10 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 24 |
5 files changed, 40 insertions, 16 deletions
diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java index aea8c80df..1b6c470dd 100644 --- a/src/com/android/launcher2/AllAppsView.java +++ b/src/com/android/launcher2/AllAppsView.java @@ -177,10 +177,11 @@ public class AllAppsView extends RSSurfaceView @Override public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { - super.surfaceChanged(holder, format, w, h); - + Log.d(TAG, "starting surfaceChanged"); long startTime = SystemClock.uptimeMillis(); + super.surfaceChanged(holder, format, w, h); + if (mRS != null) { destroyRenderScript(); mRS = null; diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 86bc4ba1b..531e10c12 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -46,6 +46,7 @@ import android.os.MessageQueue; import android.os.Parcelable; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.SystemClock; import android.provider.LiveFolders; import android.text.Selection; import android.text.SpannableStringBuilder; @@ -197,8 +198,12 @@ public final class Launcher extends Activity private static HashMap<Long, FolderInfo> mFolders = new HashMap(); private ArrayList<ApplicationInfo> mAllAppsList = new ArrayList(); + public static long lastStartTime; + @Override protected void onCreate(Bundle savedInstanceState) { + lastStartTime = SystemClock.uptimeMillis(); + super.onCreate(savedInstanceState); mModel = ((LauncherApplication)getApplication()).setLauncher(this); @@ -394,6 +399,10 @@ public final class Launcher extends Activity @Override protected void onResume() { + if (lastStartTime == 0) { + lastStartTime = SystemClock.uptimeMillis(); + } + super.onResume(); if (mRestoring) { @@ -1926,12 +1935,6 @@ public final class Launcher extends Activity mSavedInstanceState = null; } - /* TODO - if (mAllAppsVisible && !mDrawer.hasFocus()) { - mDrawer.requestFocus(); - } - */ - Log.d(TAG, "finishBindingItems done"); mWorkspaceLoading = false; } diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 110d788ce..b917cdd36 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -505,7 +505,7 @@ public class LauncherModel extends BroadcastReceiver { // This way we don't start loading all apps until the workspace has settled // down. synchronized (LoaderThread.this) { - mHandler.post(new Runnable() { + mHandler.postIdle(new Runnable() { public void run() { synchronized (LoaderThread.this) { mWorkspaceDoneBinding = true; diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java index dc095f9d1..d5dd06338 100644 --- a/src/com/android/launcher2/Utilities.java +++ b/src/com/android/launcher2/Utilities.java @@ -380,8 +380,6 @@ final class Utilities { rectPaint.setColor(0xff000000); rectPaint.setAntiAlias(true); - Log.d(TAG, "scale=" + scale + " textSize=" + (13*scale)); - TextPaint textPaint = mTextPaint = new TextPaint(); textPaint.setTypeface(Typeface.DEFAULT); textPaint.setTextSize(13*scale); @@ -403,9 +401,11 @@ final class Utilities { mBubbleRect.offsetTo((mBitmapWidth-mBubbleRect.width())/2, 0); - Log.d(TAG, "mBitmapWidth=" + mBitmapWidth + " mBitmapHeight=" - + mBitmapHeight + " w=" + ((int)(mBubbleRect.width() + 0.5f)) - + " h=" + ((int)((MAX_LINES * mLineHeight) + leading + 0.5f))); + if (false) { + Log.d(TAG, "mBitmapWidth=" + mBitmapWidth + " mBitmapHeight=" + + mBitmapHeight + " w=" + ((int)(mBubbleRect.width() + 0.5f)) + + " h=" + ((int)((MAX_LINES * mLineHeight) + leading + 0.5f))); + } } /** You own the bitmap after this and you must call recycle on it. */ diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index d4a9d95ec..608e7b7cb 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -26,7 +26,11 @@ import android.graphics.Canvas; 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.ViewGroup; 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 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag @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; |