Adding some tracing sections around launcher startup
Bug: 29007436 Change-Id: I53afd9130a2dc70a2223f1623e862faf44370f26
This commit is contained in:
@@ -64,6 +64,7 @@ import android.os.Handler;
|
||||
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 class Launcher extends Activity
|
||||
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 @@ public class Launcher extends Activity
|
||||
.penaltyDeath()
|
||||
.build());
|
||||
}
|
||||
if (LauncherAppState.PROFILE_STARTUP) {
|
||||
Trace.beginSection("Launcher-onCreate");
|
||||
}
|
||||
|
||||
if (mLauncherCallbacks != null) {
|
||||
mLauncherCallbacks.preOnCreate();
|
||||
@@ -433,11 +436,6 @@ public class Launcher extends Activity
|
||||
// LauncherModel load.
|
||||
mPaused = false;
|
||||
|
||||
if (PROFILE_STARTUP) {
|
||||
android.os.Debug.startMethodTracing(
|
||||
Environment.getExternalStorageDirectory() + "/launcher");
|
||||
}
|
||||
|
||||
setContentView(R.layout.launcher);
|
||||
|
||||
setupViews();
|
||||
@@ -453,8 +451,8 @@ public class Launcher extends Activity
|
||||
mSavedState = savedInstanceState;
|
||||
restoreState(mSavedState);
|
||||
|
||||
if (PROFILE_STARTUP) {
|
||||
android.os.Debug.stopMethodTracing();
|
||||
if (LauncherAppState.PROFILE_STARTUP) {
|
||||
Trace.endSection();
|
||||
}
|
||||
|
||||
if (!mRestoring) {
|
||||
@@ -3587,6 +3585,9 @@ public class Launcher extends Activity
|
||||
* 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 @@ public class Launcher extends Activity
|
||||
if (mHotseat != null) {
|
||||
mHotseat.resetLayout();
|
||||
}
|
||||
if (LauncherAppState.PROFILE_STARTUP) {
|
||||
Trace.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -3962,6 +3966,9 @@ public class Launcher extends Activity
|
||||
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 @@ public class Launcher extends Activity
|
||||
if (mLauncherCallbacks != null) {
|
||||
mLauncherCallbacks.finishBindingItems(false);
|
||||
}
|
||||
if (LauncherAppState.PROFILE_STARTUP) {
|
||||
Trace.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canRunNewAppsAnimation() {
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.util.Log;
|
||||
import com.android.launcher3.compat.LauncherAppsCompat;
|
||||
import com.android.launcher3.compat.PackageInstallerCompat;
|
||||
import com.android.launcher3.compat.UserManagerCompat;
|
||||
import com.android.launcher3.config.ProviderConfig;
|
||||
import com.android.launcher3.dynamicui.ExtractionUtils;
|
||||
import com.android.launcher3.logging.FileLog;
|
||||
import com.android.launcher3.util.ConfigMonitor;
|
||||
@@ -35,6 +36,8 @@ import java.lang.ref.WeakReference;
|
||||
|
||||
public class LauncherAppState {
|
||||
|
||||
public static final boolean PROFILE_STARTUP = ProviderConfig.IS_DOGFOOD_BUILD;
|
||||
|
||||
private final AppFilter mAppFilter;
|
||||
@Thunk final LauncherModel mModel;
|
||||
private final IconCache mIconCache;
|
||||
|
||||
@@ -37,6 +37,7 @@ import android.os.Looper;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Process;
|
||||
import android.os.SystemClock;
|
||||
import android.os.Trace;
|
||||
import android.provider.BaseColumns;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -1542,6 +1543,9 @@ public class LauncherModel extends BroadcastReceiver
|
||||
}
|
||||
|
||||
private void loadWorkspace() {
|
||||
if (LauncherAppState.PROFILE_STARTUP) {
|
||||
Trace.beginSection("Loading Workspace");
|
||||
}
|
||||
final long t = DEBUG_LOADERS ? SystemClock.uptimeMillis() : 0;
|
||||
|
||||
final Context context = mContext;
|
||||
@@ -2157,6 +2161,9 @@ public class LauncherModel extends BroadcastReceiver
|
||||
}
|
||||
}
|
||||
}
|
||||
if (LauncherAppState.PROFILE_STARTUP) {
|
||||
Trace.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,6 +44,7 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Process;
|
||||
import android.os.Trace;
|
||||
import android.os.UserManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -86,6 +87,9 @@ public class LauncherProvider extends ContentProvider {
|
||||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
if (ProviderConfig.IS_DOGFOOD_BUILD) {
|
||||
Log.d(TAG, "Launcher process started");
|
||||
}
|
||||
mListenerHandler = new Handler(mListenerWrapper);
|
||||
|
||||
LauncherAppState.setLauncherProvider(this);
|
||||
@@ -115,6 +119,9 @@ public class LauncherProvider extends ContentProvider {
|
||||
*/
|
||||
protected synchronized void createDbIfNotExists() {
|
||||
if (mOpenHelper == null) {
|
||||
if (LauncherAppState.PROFILE_STARTUP) {
|
||||
Trace.beginSection("Opening workspace DB");
|
||||
}
|
||||
mOpenHelper = new DatabaseHelper(getContext(), mListenerHandler);
|
||||
|
||||
if (RestoreDbTask.isPending(getContext())) {
|
||||
@@ -125,6 +132,10 @@ public class LauncherProvider extends ContentProvider {
|
||||
// executed again.
|
||||
RestoreDbTask.setPending(getContext(), false);
|
||||
}
|
||||
|
||||
if (LauncherAppState.PROFILE_STARTUP) {
|
||||
Trace.endSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user