Use gralloc usage conversion library

Converting from ..graphics.allocator@2.0 usage to gralloc0 usage isn't
quite as simple as ORing and truncating, which is what the default
implementation was doing. Switch to using library functions that do it
correctly.

Test: boot bullhead
Change-Id: Ibe644b53655e191b9bca9d619825a8918e8fc365
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index 5017e14..5574da2 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -16,6 +16,7 @@
 
 #include <algorithm>
 
+#include <grallocusage/GrallocUsageConversion.h>
 #include <log/log.h>
 #include <ui/BufferQueueDefs.h>
 #include <sync/sync.h>
@@ -995,11 +996,8 @@
             ALOGE("vkGetSwapchainGrallocUsage2ANDROID failed: %d", result);
             return VK_ERROR_SURFACE_LOST_KHR;
         }
-        // TODO: This is the same translation done by Gralloc1On0Adapter.
-        // Remove it once ANativeWindow has been updated to take gralloc1-style
-        // usages.
         gralloc_usage =
-            static_cast<int>(consumer_usage) | static_cast<int>(producer_usage);
+            android_convertGralloc1To0Usage(producer_usage, consumer_usage);
     } else if (dispatch.GetSwapchainGrallocUsageANDROID) {
         result = dispatch.GetSwapchainGrallocUsageANDROID(
             device, create_info->imageFormat, create_info->imageUsage,