Reland^2 "Revert "Defer resume of activity while applying wct""

- When the hierarchy is changing, defer resuming the activity until it is ready to let it finish processing the wct.
- If the activity does not wait, there will be extra lifecycle states even if they are applied in the same wct. Update test to not defer resume at the start.
- Only send wct if the activity is in the resumed state since the activity could have been removed already.

Change-Id: I1e2a8d9a26eecee1286967157923b5b3b4fb2ecb
Flag: EXEMPT (bug fix)
Bug: 369186876
Test: atest CtsWindowManagerDeviceActivity com.android.server.wm.ActivityTaskManagerServiceTests
3 files changed