Wait until any background events are processed.

Some MediaProvider events (such as thumbnail invalidation) are
handled on a background thread.  To reduce flaky tests, wait until
all background events have been processed, which is more robust
than sleep.

Bug: 134879702
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: If9f9b3b5adebeacb93a3b8fa2aba6dd7d98b083b
(cherry picked from commit 4209a84b7115238753c2201937350b1e321a0bad)
1 file changed