Add new api Instrumentation.ActivityMonitor.onMatchIntent.

During testing, sometimes it's sufficient to know that intent is being
triggered and no need to actually launch the target activity as part of
the test. Currently, ActivityMonitor solves this problem but we have to
know all the intents that will be triggered during the test and provide
ActivityMonitors for each of them. So, this change adds a new api
ActivityMonitor.onMatchIntent which can be used for intercepting any
outgoing intents during tests.

Bug: 31810293
Test: cts-tradefed run singleCommand cts-dev --module CtsAppTestCases -t \
      android.app.cts.Instrumentation_ActivityMonitorTest
Change-Id: I46ba4b9a21da000492f9e7b242c01999ebc54423
4 files changed