Merge "Enhance StateMachine Quitting and logging support. DO NOT MERGE" into jb-dev-plus-aosp