Merge "gralloc: set ION_SECURE to flags instead of heap_mask during ion alloc."
diff --git a/libgralloc/ionalloc.cpp b/libgralloc/ionalloc.cpp
index b9b9717..8cee7fd 100644
--- a/libgralloc/ionalloc.cpp
+++ b/libgralloc/ionalloc.cpp
@@ -69,14 +69,18 @@
struct ion_handle_data handle_data;
struct ion_fd_data fd_data;
struct ion_allocation_data ionAllocData;
-
void *base = 0;
ionAllocData.len = data.size;
ionAllocData.align = data.align;
- ionAllocData.heap_mask = data.flags;
+ ionAllocData.heap_mask = data.flags & ~ION_SECURE;
ionAllocData.flags = data.uncached ? 0 : ION_FLAG_CACHED;
+ // ToDo: replace usage of alloc data structure with
+ // ionallocdata structure.
+ if (data.flags & ION_SECURE)
+ ionAllocData.flags |= ION_SECURE;
+
err = open_device();
if (err)
return err;