Merge changes from topic 'o-usage64-2' into oc-dev

* changes:
  automotive: Adjust tests for libui gralloc flags change
  camera: Adjust for libui gralloc flags change
diff --git a/automotive/evs/1.0/default/EvsCamera.cpp b/automotive/evs/1.0/default/EvsCamera.cpp
index 148b796..e0782ec 100644
--- a/automotive/evs/1.0/default/EvsCamera.cpp
+++ b/automotive/evs/1.0/default/EvsCamera.cpp
@@ -311,9 +311,7 @@
 
     while (added < numToAdd) {
         buffer_handle_t memHandle = nullptr;
-        status_t result = alloc.allocate(mWidth, mHeight,
-                                         mFormat, 1,
-                                         mUsage, mUsage,
+        status_t result = alloc.allocate(mWidth, mHeight, mFormat, 1, mUsage,
                                          &memHandle, &mStride, 0, "EvsCamera");
         if (result != NO_ERROR) {
             ALOGE("Error %d allocating %d x %d graphics buffer", result, mWidth, mHeight);
diff --git a/automotive/evs/1.0/default/EvsDisplay.cpp b/automotive/evs/1.0/default/EvsDisplay.cpp
index 9ad332a..9dd546d 100644
--- a/automotive/evs/1.0/default/EvsDisplay.cpp
+++ b/automotive/evs/1.0/default/EvsDisplay.cpp
@@ -166,11 +166,9 @@
         // Allocate the buffer that will hold our displayable image
         buffer_handle_t handle = nullptr;
         GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
-        status_t result = alloc.allocate(mBuffer.width, mBuffer.height,
-                                         mBuffer.format, 1, mBuffer.usage,
-                                         mBuffer.usage, &handle,
-                                         &mBuffer.stride,
-                                         0, "EvsDisplay");
+        status_t result = alloc.allocate(
+            mBuffer.width, mBuffer.height, mBuffer.format, 1, mBuffer.usage,
+            &handle, &mBuffer.stride, 0, "EvsDisplay");
         if (result != NO_ERROR) {
             ALOGE("Error %d allocating %d x %d graphics buffer",
                   result, mBuffer.width, mBuffer.height);
diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp
index a0be5cb..85312c1 100644
--- a/camera/provider/2.4/vts/functional/Android.bp
+++ b/camera/provider/2.4/vts/functional/Android.bp
@@ -33,7 +33,7 @@
         "libgui",
         "libui"
     ],
-    static_libs: ["VtsHalHidlTargetTestBase"],
+    static_libs: ["VtsHalHidlTargetTestBase", "libgrallocusage"],
     cflags: [
         "-O0",
         "-g",
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index b7ce858..c8e44d3 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -15,28 +15,29 @@
  */
 
 #define LOG_TAG "camera_hidl_hal_test"
-#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
-#include <android/hardware/camera/device/3.2/ICameraDevice.h>
-#include <android/hardware/camera/device/1.0/ICameraDevice.h>
-#include "CameraParameters.h"
-#include <system/camera.h>
-#include <android/log.h>
-#include <ui/GraphicBuffer.h>
 #include <VtsHalHidlTargetTestBase.h>
+#include <android/hardware/camera/device/1.0/ICameraDevice.h>
+#include <android/hardware/camera/device/3.2/ICameraDevice.h>
+#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
+#include <android/log.h>
+#include <binder/MemoryHeapBase.h>
+#include <grallocusage/GrallocUsageConversion.h>
+#include <gui/BufferItemConsumer.h>
 #include <gui/BufferQueue.h>
 #include <gui/Surface.h>
-#include <gui/BufferItemConsumer.h>
-#include <binder/MemoryHeapBase.h>
-#include <regex>
-#include "system/camera_metadata.h"
 #include <hardware/gralloc.h>
 #include <hardware/gralloc1.h>
-#include <unordered_map>
-#include <mutex>
-#include <condition_variable>
-#include <chrono>
 #include <inttypes.h>
+#include <system/camera.h>
+#include <ui/GraphicBuffer.h>
 #include <utils/Errors.h>
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+#include <regex>
+#include <unordered_map>
+#include "CameraParameters.h"
+#include "system/camera_metadata.h"
 
 using ::android::hardware::Return;
 using ::android::hardware::Void;
@@ -2480,11 +2481,12 @@
                     settings = req; });
             ASSERT_TRUE(ret.isOk());
 
-            sp<GraphicBuffer> gb = new GraphicBuffer(previewStream.width,
-                    previewStream.height,
-                    static_cast<int32_t> (halStreamConfig.streams[0].overrideFormat),
-                    1, halStreamConfig.streams[0].producerUsage,
-                    halStreamConfig.streams[0].consumerUsage);
+            sp<GraphicBuffer> gb = new GraphicBuffer(
+                previewStream.width, previewStream.height,
+                static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
+                1, android_convertGralloc1To0Usage(
+                       halStreamConfig.streams[0].producerUsage,
+                       halStreamConfig.streams[0].consumerUsage));
             ASSERT_NE(nullptr, gb.get());
             StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
                     bufferId, hidl_handle(gb->getNativeBuffer()->handle),
@@ -2586,11 +2588,12 @@
                     &session /*out*/, &previewStream /*out*/,
                     &halStreamConfig /*out*/);
 
-            sp<GraphicBuffer> gb = new GraphicBuffer(previewStream.width,
-                    previewStream.height,
-                    static_cast<int32_t> (halStreamConfig.streams[0].overrideFormat),
-                    1, halStreamConfig.streams[0].producerUsage,
-                    halStreamConfig.streams[0].consumerUsage);
+            sp<GraphicBuffer> gb = new GraphicBuffer(
+                previewStream.width, previewStream.height,
+                static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
+                1, android_convertGralloc1To0Usage(
+                       halStreamConfig.streams[0].producerUsage,
+                       halStreamConfig.streams[0].consumerUsage));
 
             StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
                     bufferId, hidl_handle(gb->getNativeBuffer()->handle),
@@ -2706,11 +2709,12 @@
                     settings = req; });
             ASSERT_TRUE(ret.isOk());
 
-            sp<GraphicBuffer> gb = new GraphicBuffer(previewStream.width,
-                    previewStream.height,
-                    static_cast<int32_t> (halStreamConfig.streams[0].overrideFormat),
-                    1, halStreamConfig.streams[0].producerUsage,
-                    halStreamConfig.streams[0].consumerUsage);
+            sp<GraphicBuffer> gb = new GraphicBuffer(
+                previewStream.width, previewStream.height,
+                static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
+                1, android_convertGralloc1To0Usage(
+                       halStreamConfig.streams[0].producerUsage,
+                       halStreamConfig.streams[0].consumerUsage));
             ASSERT_NE(nullptr, gb.get());
             StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
                     bufferId, hidl_handle(gb->getNativeBuffer()->handle),