gralloc: Refactor gralloc4.0 for some concerns in code review
There were some concerns raised in the intern code review process. Since
Qualcomm has merged their Gralloc4.0 changes into their codebase, the
patch created another standlane change to address the concerns within
the code review.
Bug: 141596968
Test: VtsHalGraphicsMapperV4_0TargetTest
Change-Id: I33905f5f1198089a1e3fe16e1fd46a8f614e8679
(cherry picked from commit 3dfff2a5af39b14422ede072e3e9d95596e5fc3f)
diff --git a/gralloc/QtiGralloc.cpp b/gralloc/QtiGralloc.cpp
index 19ff2ab..912d360 100644
--- a/gralloc/QtiGralloc.cpp
+++ b/gralloc/QtiGralloc.cpp
@@ -33,6 +33,7 @@
namespace qtigralloc {
using android::hardware::graphics::mapper::V4_0::IMapper;
+
static sp<IMapper> getInstance() {
static sp<IMapper> mapper = IMapper::getService();
return mapper;
@@ -84,7 +85,7 @@
return Error::BAD_VALUE;
}
out->resize(UBWC_STATS_ARRAY_SIZE * sizeof(UBWCStats));
- memcpy(out->data(), &in[0], UBWC_STATS_ARRAY_SIZE * sizeof(UBWCStats));
+ memcpy(out->data(), in, UBWC_STATS_ARRAY_SIZE * sizeof(UBWCStats));
return Error::NONE;
}
diff --git a/gralloc/QtiGralloc.h b/gralloc/QtiGralloc.h
index 37593e5..08053cc 100644
--- a/gralloc/QtiGralloc.h
+++ b/gralloc/QtiGralloc.h
@@ -62,7 +62,7 @@
};
// Metadata
-const std::string VENDOR_QTI = "QTI";
+static const std::string VENDOR_QTI = "QTI";
Error get(void *buffer, uint32_t type, void *param);
Error set(void *buffer, uint32_t type, void *param);