Fix tracing shutdown
Method tracing was being disabled before the listener was removed.
In some cases, this would cause the stack restoration to trigger
trace entries - resulting in out-of-order method exits.
By removing the listeners before disabling tracing, no one is around
to receive the erroneous stack restoration "exits".
Bug: 129716777
Test: Builds, ran on x86 emulator:
adb shell am start -S -W --start-profiler \
/data/local/tmp/test.trace --sampling 1 \
-a \android.intent.action.MAIN \
-n com.android.calendar/com.android.calendar.AllInOneActivity && \
sleep 5 && \
adb shell am profile stop com.android.calendar && \
adb pull /data/local/tmp/test.trace
and inspected resulting tracefile; parsed fine in Android Studio 3.0.1
(cherry picked from commit ecd21be250c434d854833aa368610c879fea9245)
Change-Id: I1d14e647eb8801220c78f4487ac4f787806e83d8
Merged-In: I90f0751f4b4253c7c9711d05d53f31b3e545fc3b
1 file changed