Fix DreamService race condition with overlay
When the service is finished, there is a race condition which exists if
an overlay connection is active. This causes the finish call to become
async, and therefore some of the internal state of the dream might
change by the time finish runs. This is causing the cleanup logic in
DreamController to be skipped, which is not correctly sending the
DREAMING_STOPPED broadcast.
Bug: 329305299
Test: atest android.service.dreams.cts.DreamServiceTest#testDreamServiceOnDestroyCallback
Flag: NA
Change-Id: I3c439938106e57c963889fa2281398acb5a1fac2
1 file changed