gralloc: Add metadata type buffer_type

CRs-Fixed: 2730864
Change-Id: I8f96b5dc905f1b8cedc498d3853be27a8f92ae58
diff --git a/gralloc/QtiGralloc.cpp b/gralloc/QtiGralloc.cpp
index aab5754..903ccba 100644
--- a/gralloc/QtiGralloc.cpp
+++ b/gralloc/QtiGralloc.cpp
@@ -202,6 +202,8 @@
       return MetadataType_StandardMetadataStatus;
     case QTI_VENDOR_METADATA_STATUS:
       return MetadataType_VendorMetadataStatus;
+    case QTI_BUFFER_TYPE:
+      return MetadataType_BufferType;
     default:
       return MetadataType_Invalid;
   }
@@ -291,6 +293,10 @@
     case QTI_VENDOR_METADATA_STATUS:
       err = decodeMetadataState(bytestream, (bool *)param);
       break;
+    case QTI_BUFFER_TYPE:
+      err = static_cast<Error>(android::gralloc4::decodeUint32(
+          qtigralloc::MetadataType_BufferType, bytestream, (uint32_t *)param));
+      break;
     default:
       param = nullptr;
       return Error::UNSUPPORTED;
diff --git a/gralloc/QtiGralloc.h b/gralloc/QtiGralloc.h
index 4be74e2..9ab8732 100644
--- a/gralloc/QtiGralloc.h
+++ b/gralloc/QtiGralloc.h
@@ -109,6 +109,9 @@
 static const MetadataType MetadataType_VendorMetadataStatus = {VENDOR_QTI,
                                                                QTI_VENDOR_METADATA_STATUS};
 
+static const MetadataType MetadataType_BufferType = {VENDOR_QTI,
+                                                     QTI_BUFFER_TYPE};
+
 // 0 is also used as invalid value in standard metadata
 static const MetadataType MetadataType_Invalid = {VENDOR_QTI, 0};
 
diff --git a/gralloc/QtiGrallocMetadata.h b/gralloc/QtiGrallocMetadata.h
index cc134a8..35bf4a0 100644
--- a/gralloc/QtiGrallocMetadata.h
+++ b/gralloc/QtiGrallocMetadata.h
@@ -55,6 +55,7 @@
 // Indicates whether metadata is using default value or has been set
 #define QTI_STANDARD_METADATA_STATUS 10016
 #define QTI_VENDOR_METADATA_STATUS 10017
+#define QTI_BUFFER_TYPE 10018
 
 // Used to indicate to framework that internal definitions are used instead
 #define COMPRESSION_QTI_UBWC 20001