Refactor ProfilingService
Refactor to state-machine-esque approach for general readability, as
well as preparing for future additions.
Detailed explanation of changes:
- Consolidate logic of updating state and progressing into new
methods
- keeps consistent behaviour when progressing both through
regular execution and the queue
- ensures that states progress according to expected flow,
handling issues if they arise.
- Adding more states to better break down points that the execution
process would have to go back to in case of failure
- new states REQUESTED and APPROVED to keep flow consolidated
- new state ERROR_OCCURRED so error callbacks can be queued
- new state NOTIFIED_REQUESTER for better handling of returning
to cleanup (handled by general filesystem cleanup before)
and to keep advancing in one place
- renamed state DISCARDED to CLEANED_UP
- Added error fields to TracingSession to support queueing error
callbacks and to keep advancing methods streamlined
Test: run new and existing profiling tests
Bug: 343963007
Flag: EXEMPT - n/a
Change-Id: Ib678c12fe7050886efb8ff0faa55a191c6d4fbf1
3 files changed