Don't leak flattened buffers from cached sets.

unbindExternalTextureBuffer needs to be called when a CachedSet is
destroyed. Otherwise GPU textures are leaked.

This is implemented as a Texture RAII instead of modifying CachedSet's
destructor directly, because that's closer to the long-term buffer
lifecycle solution for RenderEngine.

Bug: 182415252
Test: observe dumpsys SurfaceFlinger while playing youtube video

Change-Id: Ib2d0a497621c121021189827cdc64b11ce9ef458
4 files changed