Refactor Autofill CTS tests so calls made by framework don't block main thread.

The Autofill CTS tests contains 3 "distinct" entities: test case,
app being autofilled, and service.

In a real world, these would belong to 3 different apks and process, but for
simplicity, they're bundled together. As such, the main thread of the service is
the UI thread of the app, which is also used to launch new activities. Hence,
failures in one of them could impact the others, way down the road. For example,
PreSimpleSaveActivity often fails because it could not launch the activity
intent within 45 seconds - most likely because a previous test is hosing the
UI thread.

This CL fixes the problem by using dedicated threads to the autofill service
callbacks. It also change all calls to BlockedQueue.offer() to use the version
that times out.

Test: atest CtsAutoFillServiceTestCases

Fixes: 70734123

Change-Id: I3305482b8ee4525885ee506cbd2f1e8116a87634
4 files changed