Use ANDROID_NATIVE_UNSIGNED_CAST() in GraphicBufferMapper::lockAsync() and GraphicBuffer::lockAsync()
If bit 31 of the return value of android_convertGralloc1To0Usage() is 1,
the high 32 bits of "usage" is all 1.
To fix, add ANDROID_NATIVE_UNSIGNED_CAST().
Change-Id: Ie8fe138e4626a179284f079d728e1fd14d83b130
Signed-off-by: Fang Hui <hui.fang@nxp.com>
diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp
index ffb6cdb..b0c6e44 100644
--- a/libs/ui/GraphicBuffer.cpp
+++ b/libs/ui/GraphicBuffer.cpp
@@ -388,8 +388,8 @@
}
}
- const uint64_t usage = static_cast<uint64_t>(
- android_convertGralloc1To0Usage(inProducerUsage, inConsumerUsage));
+ const uint64_t usage = static_cast<uint64_t>(ANDROID_NATIVE_UNSIGNED_CAST(
+ android_convertGralloc1To0Usage(inProducerUsage, inConsumerUsage)));
auto result = getBufferMapper().lock(handle, usage, rect, base::unique_fd{fenceFd});