Enhance RetryRule for CtsAutoFillServiceTestCases

The RetryRule will retry tests when the tests fail due to a
RetryableException. But it does not clean all launched activities which
causes the retries are blocked on the exception:
"Could not launch intent Intent { ... } within 45 seconds."
To avoid the same issue, adds mechanism to clean between the retries.

Bug: 146613031
Test: atest CtsAutoFillServiceTestCases
Test: cts-tradefed run cts -m CtsAutoFillServiceTestCases -t android.autofillservice.cts.PreSimpleSaveActivityTest#testTapLink_tapBack_thenStartOverBySayingNoAndManualRequest
Test: atest CompatibilityTestApp:RetryRuleTest
Change-Id: I583f0421862b796d3ba7920e4851cd59b790c53c
Merged-In: I583f0421862b796d3ba7920e4851cd59b790c53c
4 files changed