gralloc: add vendor encode/decode helpers

Add helper functions so vendors can encode and decode
basic C++ types without writing their own encode/decode
functions.

Test: Gralloc4_test and libgralloctypes_fuzzer
Bug: 145624669

Change-Id: I91f7a69c76a8ff633fe88f0deb6be6996b789ba0
6 files changed