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
Change-Id: I90f0751f4b4253c7c9711d05d53f31b3e545fc3b
1 file changed