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

Commit bff6d33b authored by Peter Kalauskas's avatar Peter Kalauskas
Browse files

Fix malformed trace sections

In some scenarios, the following trace sections would never close:

 - "KeyguardViewMediator#handleShow"
 - "KeyguardViewMediator#handleStartKeyguardExitAnimation"

Test: Capture perfetto trace, inspect trace to verify all slices end
Flag: EXEMPT system tracing only
Change-Id: Ia3c92130672988449061167663f8faf33894f037
parent 66cb05e9
Loading
Loading
Loading
Loading
+0 −33
Original line number Diff line number Diff line
@@ -9166,39 +9166,6 @@
            column="15"/>
    </issue>
    <issue
        id="UnclosedTrace"
        message="The `beginSection()` call is not always closed with a matching `endSection()` because the code in between may return early"
        errorLine1="        Trace.beginSection(&quot;KeyguardViewMediator#handleKeyguardDone&quot;);"
        errorLine2="              ~~~~~~~~~~~~">
        <location
            file="frameworks/base/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java"
            line="2654"
            column="15"/>
    </issue>
    <issue
        id="UnclosedTrace"
        message="The `beginSection()` call is not always closed with a matching `endSection()` because the code in between may return early"
        errorLine1="        Trace.beginSection(&quot;KeyguardViewMediator#handleShow&quot;);"
        errorLine2="              ~~~~~~~~~~~~">
        <location
            file="frameworks/base/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java"
            line="2780"
            column="15"/>
    </issue>
    <issue
        id="UnclosedTrace"
        message="The `beginSection()` call is not always closed with a matching `endSection()` because the code in between may return early"
        errorLine1="        Trace.beginSection(&quot;KeyguardViewMediator#handleStartKeyguardExitAnimation&quot;);"
        errorLine2="              ~~~~~~~~~~~~">
        <location
            file="frameworks/base/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java"
            line="3011"
            column="15"/>
    </issue>
    <issue
        id="UnclosedTrace"
        message="The `traceBegin()` call is not always closed with a matching `traceEnd()` because the code in between may return early"
+19 −4
Original line number Diff line number Diff line
@@ -2834,6 +2834,14 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
     */
    private void handleShow(Bundle options) {
        Trace.beginSection("KeyguardViewMediator#handleShow");
        try {
            handleShowInner(options);
        } finally {
            Trace.endSection();
        }
    }

    private void handleShowInner(Bundle options) {
        final boolean showUnlocked = options != null
                && options.getBoolean(OPTION_SHOW_DISMISSIBLE, false);
        final int currentUser = mSelectedUserInteractor.getSelectedUserId();
@@ -2885,8 +2893,6 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
        mKeyguardDisplayManager.show();

        scheduleNonStrongBiometricIdleTimeout();

        Trace.endSection();
    }

    /**
@@ -3065,6 +3071,17 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
            RemoteAnimationTarget[] apps, RemoteAnimationTarget[] wallpapers,
            RemoteAnimationTarget[] nonApps, IRemoteAnimationFinishedCallback finishedCallback) {
        Trace.beginSection("KeyguardViewMediator#handleStartKeyguardExitAnimation");
        try {
            handleStartKeyguardExitAnimationInner(startTime, fadeoutDuration, apps, wallpapers,
                    nonApps, finishedCallback);
        } finally {
            Trace.endSection();
        }
    }

    private void handleStartKeyguardExitAnimationInner(long startTime, long fadeoutDuration,
            RemoteAnimationTarget[] apps, RemoteAnimationTarget[] wallpapers,
            RemoteAnimationTarget[] nonApps, IRemoteAnimationFinishedCallback finishedCallback) {
        Log.d(TAG, "handleStartKeyguardExitAnimation startTime=" + startTime
                + " fadeoutDuration=" + fadeoutDuration);
        synchronized (KeyguardViewMediator.this) {
@@ -3253,8 +3270,6 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
                onKeyguardExitFinished();
            }
        }

        Trace.endSection();
    }

    private void onKeyguardExitFinished() {