Enable binderized Gralloc HAL

Test: manual
Change-Id: Iafece0f2622f121e3e7e08a9b82a1829aa577b34
diff --git a/device-common.mk b/device-common.mk
index 5aa7ec0..7e27b8f 100644
--- a/device-common.mk
+++ b/device-common.mk
@@ -476,6 +476,12 @@
     android.hardware.vr@1.0-service
 endif
 
+# Gralloc
+PRODUCT_PACKAGES += \
+    android.hardware.graphics.allocator@2.0-impl \
+    android.hardware.graphics.allocator@2.0-service \
+    android.hardware.graphics.mapper@2.0-impl
+
 # HW Composer
 PRODUCT_PACKAGES += \
     android.hardware.graphics.composer@2.1-impl \
diff --git a/marlin/BoardConfig.mk b/marlin/BoardConfig.mk
index 84757bb..8fb4b83 100644
--- a/marlin/BoardConfig.mk
+++ b/marlin/BoardConfig.mk
@@ -39,6 +39,7 @@
 TARGET_USES_OVERLAY := true
 TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS := true
 MAX_VIRTUAL_DISPLAY_DIMENSION := 4096
+TARGET_USES_GRALLOC1 := true
 TARGET_USES_HWC2 := true
 VSYNC_EVENT_PHASE_OFFSET_NS := 2000000
 SF_VSYNC_EVENT_PHASE_OFFSET_NS := 6000000
diff --git a/sailfish/BoardConfig.mk b/sailfish/BoardConfig.mk
index 94a79e4..93c5275 100644
--- a/sailfish/BoardConfig.mk
+++ b/sailfish/BoardConfig.mk
@@ -39,6 +39,7 @@
 TARGET_USES_OVERLAY := true
 TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS := true
 MAX_VIRTUAL_DISPLAY_DIMENSION := 4096
+TARGET_USES_GRALLOC1 := true
 TARGET_USES_HWC2 := true
 VSYNC_EVENT_PHASE_OFFSET_NS := 2000000
 SF_VSYNC_EVENT_PHASE_OFFSET_NS := 6000000
diff --git a/sepolicy/camera.te b/sepolicy/camera.te
index 96201f4..938c9be 100644
--- a/sepolicy/camera.te
+++ b/sepolicy/camera.te
@@ -27,6 +27,7 @@
 set_prop(camera, camera_prop)
 
 allow camera surfaceflinger:fd use;
+allow camera hal_graphics_allocator:fd use;
 allow camera cameraserver:fd use;
 
 allow camera camera_data_file:dir rw_dir_perms;
diff --git a/sepolicy/hal_graphics_allocator.te b/sepolicy/hal_graphics_allocator.te
new file mode 100644
index 0000000..fa7fce3
--- /dev/null
+++ b/sepolicy/hal_graphics_allocator.te
@@ -0,0 +1 @@
+r_dir_file(hal_graphics_allocator, sysfs_type)
diff --git a/vintf.xml b/vintf.xml
index bac2da1..8c6e1cf 100644
--- a/vintf.xml
+++ b/vintf.xml
@@ -66,6 +66,18 @@
         <version>1.0</version>
     </hal>
     <hal format="hidl">
+        <name>android.hardware.graphics.allocator</name>
+        <transport>toggled</transport>
+        <impl level="generic"></impl>
+        <version>2.0</version>
+    </hal>
+    <hal format="hidl">
+        <name>android.hardware.graphics.mapper</name>
+        <transport>passthrough</transport>
+        <impl level="generic"></impl>
+        <version>2.0</version>
+    </hal>
+    <hal format="hidl">
         <name>android.hardware.graphics.composer</name>
         <transport>toggled</transport>
         <impl level="generic"></impl>