Don't recycle the bitmap on CanvasEngine.onDestroy

A crash was possible due to race conditions if CanvasEngine.onDestroy is called before drawFrame has enough time to finish drawing.

We don't want to recycle the bitmap when onDestroy is called. The bitmap will be automatically recycled after loading, once the frame is drawn. We simply wait for the automatic recycling. This is similar to what was done in GLEngine.onDestroy: a message is queued to destroy the GL context, so the GLEngine first waits that other operations (i.e. drawFrame) are finished before unloading.

Bug: 255920551
Test: manual
Test: atest ImageWallpaperTest
Change-Id: I45b99f572dd89926ccdc1632abb20442bafcf854
1 file changed