Couple mResumedActivity to Activity lifecycle.

mResumedActivity is a cached reference to the currently resumed
activity in a stack. Previously, this value was set on demand at
various points in the code. This can lead to discord with the
ActivityRecord if the activity updates state without the containing
ActivityStack being directly aware of the change.

This changelist addresses the issue by placing mResumedActivity
behind an accessor. A callback path has been added from
ActivityRecord to the ActivityStack, signaling when the activity's
state has changed. The stack can then update the state accordingly.

Test: atest FrameworksServicesTests:com.android.server.am.ActivityStackTests#testResumedActivity
Bug: 66344012
Fixes: 74118620
Change-Id: If950fd4c41f044ec67722ccc5b1d631cead70bce
7 files changed