libdmabufheap: Do not create heap mappings without ION support am: 0f2cc9e07e am: d2e5cc71c9 am: 6bfd49e95e

Original change: https://android-review.googlesource.com/c/platform/system/memory/libdmabufheap/+/1792810

Change-Id: Ie76ec18bc224d16bead9adddea5d3a23bf2aef94
diff --git a/BufferAllocator.cpp b/BufferAllocator.cpp
index ce075d6..6dc3f68 100644
--- a/BufferAllocator.cpp
+++ b/BufferAllocator.cpp
@@ -165,6 +165,9 @@
     if (ret >= 0)
         return 0;
 
+    /* If ION support is not detected, ignore the mappings */
+    if (ion_fd_ < 0) return 0;
+
     if (uses_legacy_ion_iface_ || ion_heap_name == "") {
         ret = MapNameToIonMask(heap_name, legacy_ion_heap_mask, legacy_ion_heap_flags);
     } else if (!ion_heap_name.empty()) {