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

Commit 517a46d9 authored by Ahan Wu's avatar Ahan Wu
Browse files

End the trace section in FrameTracker#cancel if it has begun

We didn't end the trace section in FrameTracker#cancel if the end
vsync id equals to the begin vsync id which is not an invalid value.
This cl fixes above problem.

Bug: 181683700
Test: atest FrameworksCoreTests:InteractionJankMonitorTest
FrameworksCoreTests: FrameTrackerTest --iteration 10
Change-Id: I6280e9b1e9b949cb6f144217ed78d21ec46eafd5
parent 7dfa3fce
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -206,9 +206,8 @@ public class FrameTracker extends SurfaceControl.OnJankDataListener
     * Cancel the trace session of the CUJ.
     */
    public synchronized void cancel() {
        // The session is ongoing, end the trace session.
        // That means the cancel call is from external invocation, not from end().
        if (mBeginVsyncId != INVALID_ID && mEndVsyncId == INVALID_ID) {
        // We don't need to end the trace section if it never begun.
        if (mBeginVsyncId != INVALID_ID) {
            Trace.endAsyncSection(mSession.getName(), (int) mBeginVsyncId);
        }
        mCancelled = true;