Fixes the regression that the resumed activity not paused beforehand

The resumed activity of the same TaskFragmnet is not paused before
resuming the next activity. This is a regression from commit 7943b5c.

This CL fixes the issue by restoring the original implementation and
also adding `andResume` check to ensure this is happening only if the
activity restarting is going to be started to resumed state.

Bug: 300019674
Test: atest PinActivityStackTests
Change-Id: I6b3e61ba63680fc47b152f5564392a21da3e803d
1 file changed