libui: clean up GraphicBuffer interface
Other than transferring the ownership, some callers want to control
whether to register or to clone the handle when creating a
GraphicBuffer from a handle. Add a new constructor with
HandleWrapMethod for finer controls, to replace the one that has
only a boolean, keepOwnership.
The motivation is to enable users to construct GraphicBuffer without
fighting with GraphicBufferMapper::registerBuffer first. More
generally, GraphicBufferMapper::{registerBuffer,unregisterBuffer} is
tricky to use correctly. They should really be considered private
by most.
While at it, deprecate constructors that do not distinguish
producer/consumer usage. It turns out GraphicBuffer is used by some
proprietary libraries. I have to maintain the ABI and cannot remove
the deprecated constructors.
Bug: 36355756
Test: boots
Change-Id: Ieea618d8495f06a6233299d076fb821127cd6bf8
5 files changed