diff options
| author | 2021-03-11 09:01:44 +0000 | |
|---|---|---|
| committer | 2021-03-11 18:59:31 +0800 | |
| commit | 517a46d989775a24dc02714fc43feb8c9a7f870c (patch) | |
| tree | 78e13b24e9a0fd390d224ed2ad0364a9b38d0ad6 | |
| parent | 7dfa3fcee800fb47e37bdaa075f40bc584a7da8b (diff) | |
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
| -rw-r--r-- | core/java/com/android/internal/jank/FrameTracker.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/core/java/com/android/internal/jank/FrameTracker.java b/core/java/com/android/internal/jank/FrameTracker.java index 5829047ad642..7f0178e29d85 100644 --- a/core/java/com/android/internal/jank/FrameTracker.java +++ b/core/java/com/android/internal/jank/FrameTracker.java @@ -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; |