Adding some tracing sections around launcher startup
Bug: 29007436
Change-Id: I53afd9130a2dc70a2223f1623e862faf44370f26
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index e24adf9..271c69b 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -64,6 +64,7 @@
import android.os.Message;
import android.os.StrictMode;
import android.os.SystemClock;
+import android.os.Trace;
import android.os.UserHandle;
import android.text.Selection;
import android.text.SpannableStringBuilder;
@@ -146,7 +147,6 @@
public static final String TAG = "Launcher";
static final boolean LOGD = false;
- static final boolean PROFILE_STARTUP = false;
static final boolean DEBUG_WIDGETS = false;
static final boolean DEBUG_STRICT_MODE = false;
static final boolean DEBUG_RESUME_TIME = false;
@@ -398,6 +398,9 @@
.penaltyDeath()
.build());
}
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.beginSection("Launcher-onCreate");
+ }
if (mLauncherCallbacks != null) {
mLauncherCallbacks.preOnCreate();
@@ -433,11 +436,6 @@
// LauncherModel load.
mPaused = false;
- if (PROFILE_STARTUP) {
- android.os.Debug.startMethodTracing(
- Environment.getExternalStorageDirectory() + "/launcher");
- }
-
setContentView(R.layout.launcher);
setupViews();
@@ -453,8 +451,8 @@
mSavedState = savedInstanceState;
restoreState(mSavedState);
- if (PROFILE_STARTUP) {
- android.os.Debug.stopMethodTracing();
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.endSection();
}
if (!mRestoring) {
@@ -3587,6 +3585,9 @@
* Implementation of the method from LauncherModel.Callbacks.
*/
public void startBinding() {
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.beginSection("Starting page bind");
+ }
setWorkspaceLoading(true);
// Clear the workspace because it's going to be rebound
@@ -3597,6 +3598,9 @@
if (mHotseat != null) {
mHotseat.resetLayout();
}
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.endSection();
+ }
}
@Override
@@ -3962,6 +3966,9 @@
if (waitUntilResume(r)) {
return;
}
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.beginSection("Page bind completed");
+ }
if (mSavedState != null) {
if (!mWorkspace.hasFocus()) {
mWorkspace.getChildAt(mWorkspace.getCurrentPage()).requestFocus();
@@ -3996,6 +4003,9 @@
if (mLauncherCallbacks != null) {
mLauncherCallbacks.finishBindingItems(false);
}
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.endSection();
+ }
}
private boolean canRunNewAppsAnimation() {