Fix flaky cts tests

PreSimpleSaveActivityTest#testTapLinkAfterUpdateAppliedToAnotherView
-There are still some Activity lifecycle coming while TestWatcher is
 doing Activity finish. We should wait for the application to be idle
 and then start the clean up jobs.

LoginActivityTest#testSaveOnlyPreFilled
-Use another way to select username and wait for application to be
 idle to avoid flaky case.

Bug: 156256469
Test: atest --iterations 30 android.autofillservice.cts.\
PreSimpleSaveActivityTest#testTapLinkAfterUpdateAppliedToAnotherView
Test: atest --iterations 30 android.autofillservice.cts.\
LoginActivityTest#testSaveOnlyPreFilled

Change-Id: I40a64722c50d293950de1cc36298237d77b2c671
2 files changed