graphics: Base resource classes need virtual dtor

ComposerResources allows a derived class to define specializations of
the ComposerDisplayResource and ComposerLayerResource classes, which are
returned by overrides of the createDisplayResources() and
createLayerResources() member functions. The pointers are wrapped using
a std::unique_ptr, which destroys the owned instance via the base class
destructor.

As the destructor was not virtual, this meant that only the base class
destructor functionality would be used. Any additional cleanup done by
the derived class destructor would not be run!

This impacts the composer-hal 2.2 utility code for example, which adds a
readback buffer cache as a display resource. Any readback buffers that
are imported there will not be released, effectively leaking graphic
buffer memory.

It also affected an ARC++ specialization where a similar per-layer buffer
resource cache was added, and where the leak was observable since layers
are created and destroyed much more often than displays.

Bug: 117877825
Test: No leaks for ARC++ devices
Change-Id: I6e604b415d3ed787c2e51729a77278594e41e7a9
diff --git a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h
index 2cbf044..f249f1a 100644
--- a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h
+++ b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h
@@ -186,6 +186,8 @@
         : mBufferCache(importer, ComposerHandleCache::HandleType::BUFFER, bufferCacheSize),
           mSidebandStreamCache(importer, ComposerHandleCache::HandleType::STREAM, 1) {}
 
+    virtual ~ComposerLayerResource() = default;
+
     Error getBuffer(uint32_t slot, bool fromCache, const native_handle_t* inHandle,
                     const native_handle_t** outHandle, const native_handle** outReplacedHandle) {
         return mBufferCache.getHandle(slot, fromCache, inHandle, outHandle, outReplacedHandle);
@@ -211,6 +213,8 @@
         VIRTUAL,
     };
 
+    virtual ~ComposerDisplayResource() = default;
+
     ComposerDisplayResource(DisplayType type, ComposerHandleImporter& importer,
                             uint32_t outputBufferCacheSize)
         : mType(type),