propagate failures from callback to main thread

Exceptions on CTS callbacks take down the instrumentation; the junit
harness doesn't capture those. Restructure encoding test so that it
captures the exception in the callback and passes it to the main thread.
This avoids a cascade of failures all marked "instrumentation failed,
process crashed".

Bug: 218747863
Test: tradefed run cts -m CtsMediaEncoderTestCases -t android.media.encoder.cts.VideoEncoderTest
Change-Id: Id8ba638b9fbd5bb90d616589a40d4110ce657f93
1 file changed