Finish pending activity or dialog when the current session ends

If a pending activity or a pending dialog exists, it must be finished
when the current session ends regardless of the current command.
Otherwise, the pending one may remain on the screen without accepting
any user operation.

Bug: 73894141
Test: Manually confirmed that pending activity is finished as expected.

Change-Id: I90c12d1a0694bf8c35f68e9429136935392f9496
1 file changed