Merge "gralloc: stub out IMapper@4.0::lockYCbCr in C2Allocator"
diff --git a/media/codec2/vndk/C2AllocatorGralloc.cpp b/media/codec2/vndk/C2AllocatorGralloc.cpp
index cd179be..fecbba3 100644
--- a/media/codec2/vndk/C2AllocatorGralloc.cpp
+++ b/media/codec2/vndk/C2AllocatorGralloc.cpp
@@ -605,14 +605,11 @@
                           (int32_t)rect.width, (int32_t)rect.height },
                         // TODO: fence
                         hidl_handle(),
-                        [&err, &pointer](const auto &maperr, const auto &mapPointer,
-                                         int32_t bytesPerPixel, int32_t bytesPerStride) {
+                        [&err, &pointer](const auto &maperr, const auto &mapPointer) {
                             err = maperr2error(maperr);
                             if (err == C2_OK) {
                                 pointer = mapPointer;
                             }
-                            (void)bytesPerPixel;
-                            (void)bytesPerStride;
                         }).isOk()) {
                     ALOGE("failed transaction: lock(RGBA_1010102) (@4.0)");
                     return C2_CORRUPTED;
@@ -743,14 +740,11 @@
                           (int32_t)rect.width, (int32_t)rect.height },
                         // TODO: fence
                         hidl_handle(),
-                        [&err, &pointer](const auto &maperr, const auto &mapPointer,
-                                         int32_t bytesPerPixel, int32_t bytesPerStride) {
+                        [&err, &pointer](const auto &maperr, const auto &mapPointer) {
                             err = maperr2error(maperr);
                             if (err == C2_OK) {
                                 pointer = mapPointer;
                             }
-                            (void)bytesPerPixel;
-                            (void)bytesPerStride;
                         }).isOk()) {
                     ALOGE("failed transaction: lock(RGBA_8888) (@4.0)");
                     return C2_CORRUPTED;
@@ -875,27 +869,14 @@
                     return C2_CORRUPTED;
                 }
             } else {
-                if (!mMapper4->lockYCbCr(
-                        const_cast<native_handle_t *>(mBuffer), grallocUsage,
-                        { (int32_t)rect.left, (int32_t)rect.top,
-                          (int32_t)rect.width, (int32_t)rect.height },
-                        // TODO: fence
-                        hidl_handle(),
-                        [&err, &ycbcrLayout](const auto &maperr, const auto &mapLayout) {
-                            err = maperr2error(maperr);
-                            if (err == C2_OK) {
-                                ycbcrLayout = YCbCrLayout{
-                                        mapLayout.y,
-                                        mapLayout.cb,
-                                        mapLayout.cr,
-                                        mapLayout.yStride,
-                                        mapLayout.cStride,
-                                        mapLayout.chromaStep};
-                            }
-                        }).isOk()) {
-                    ALOGE("failed transaction: lockYCbCr (@4.0)");
-                    return C2_CORRUPTED;
-                }
+                // No device currently supports IMapper 4.0 so it is safe to just return an error
+                // code here.
+                //
+                // This will be supported by a combination of lock and BufferMetadata getters.
+                // We are going to refactor all the IAllocator/IMapper versioning code into a
+                // shared library. We will then add the IMapper 4.0 lockYCbCr support then.
+                ALOGE("failed transaction: lockYCbCr (@4.0)");
+                return C2_CORRUPTED;
             }
             if (err != C2_OK) {
                 ALOGD("lockYCbCr failed: %d", err);