Setting a wallpaper must be synchronous

Observable state needs to be fully established by the time the
caller is allowed to proceed, otherwise they might read stale
information.  In particular, we hadn't yet committed changes to
the backing store by the time observers were released, so they
could then read a stale generation number as the "current" state.

With this fix, the flaky CTS test is now reliably passing.

Test: cts-tradefed run cts-dev -m CtsAppTestCases -t android.app.cts.WallpaperManagerTest\#setBitmapTest
Bug: 65016846
Change-Id: I93fc690caedfbcd455a91625a3c67fff9168483b
1 file changed