Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7c9bd99 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Add traces for activity create/resume/pause/stop/destroy

With component name, it is clearer to know which activities
are executed. And the traces are closer to the implementation
of app, so the relative time between app and framework can be
shown by overlapping with the traces of transaction items.

Bug: 175028240
Test: build
Change-Id: I76faf6265f38c211ffd69a36b6e3ad882465251e
(cherry picked from commit d7af5e38)
parent 77bb0b72
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -7877,6 +7877,10 @@ public class Activity extends ContextThemeWrapper

    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    final void performCreate(Bundle icicle, PersistableBundle persistentState) {
        if (Trace.isTagEnabled(Trace.TRACE_TAG_WINDOW_MANAGER)) {
            Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "performCreate:"
                    + mComponent.getClassName());
        }
        dispatchActivityPreCreated(icicle);
        mCanEnterPictureInPicture = true;
        // initialize mIsInMultiWindowMode and mIsInPictureInPictureMode before onCreate
@@ -7899,6 +7903,7 @@ public class Activity extends ContextThemeWrapper
        mFragments.dispatchActivityCreated();
        mActivityTransitionState.setEnterActivityOptions(this, getActivityOptions());
        dispatchActivityPostCreated(icicle);
        Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
    }

    final void performNewIntent(@NonNull Intent intent) {
@@ -8004,6 +8009,10 @@ public class Activity extends ContextThemeWrapper
    }

    final void performResume(boolean followedByPause, String reason) {
        if (Trace.isTagEnabled(Trace.TRACE_TAG_WINDOW_MANAGER)) {
            Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "performResume:"
                    + mComponent.getClassName());
        }
        dispatchActivityPreResumed();
        performRestart(true /* start */, reason);

@@ -8055,9 +8064,14 @@ public class Activity extends ContextThemeWrapper
                " did not call through to super.onPostResume()");
        }
        dispatchActivityPostResumed();
        Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
    }

    final void performPause() {
        if (Trace.isTagEnabled(Trace.TRACE_TAG_WINDOW_MANAGER)) {
            Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "performPause:"
                    + mComponent.getClassName());
        }
        dispatchActivityPrePaused();
        mDoReportFullyDrawn = false;
        mFragments.dispatchPause();
@@ -8073,6 +8087,7 @@ public class Activity extends ContextThemeWrapper
                    " did not call through to super.onPause()");
        }
        dispatchActivityPostPaused();
        Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
    }

    final void performUserLeaving() {
@@ -8081,6 +8096,10 @@ public class Activity extends ContextThemeWrapper
    }

    final void performStop(boolean preserveWindow, String reason) {
        if (Trace.isTagEnabled(Trace.TRACE_TAG_WINDOW_MANAGER)) {
            Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "performStop:"
                    + mComponent.getClassName());
        }
        mDoReportFullyDrawn = false;
        mFragments.doLoaderStop(mChangingConfigurations /*retain*/);

@@ -8126,9 +8145,14 @@ public class Activity extends ContextThemeWrapper
            dispatchActivityPostStopped();
        }
        mResumed = false;
        Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
    }

    final void performDestroy() {
        if (Trace.isTagEnabled(Trace.TRACE_TAG_WINDOW_MANAGER)) {
            Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "performDestroy:"
                    + mComponent.getClassName());
        }
        dispatchActivityPreDestroyed();
        mDestroyed = true;
        mWindow.destroy();
@@ -8141,6 +8165,7 @@ public class Activity extends ContextThemeWrapper
            mVoiceInteractor.detachActivity();
        }
        dispatchActivityPostDestroyed();
        Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
    }

    final void dispatchMultiWindowModeChanged(boolean isInMultiWindowMode,