Attempt to fix flaky test testBackgroundCheckActivityService

Dismiss the keyguard, and exclude the test activity from recents.

Also added a couple of delays in notification test to workaround
the timing issue in notification manager service, for example,
notificaton cancellation is performed in separated thread.

Bug: 140910584
Test: atest CtsAppTestCases:ActivityManagerProcessStateTest
Change-Id: Ia704c9423905a4ff2598faedc6cea88626e50276
4 files changed