Merge changes I8a7ff4b0,Id121ecd4,I23375d73
* changes:
[hardware][interfaces][sensors] fix -Wreorder-init-list
[hardware][interfaces][sensors] fix -Wreorder-init-list again
[hardware][interfaces][graphics] fix -Wimplicit-int-float-conversion
diff --git a/graphics/composer/2.1/utils/hwc2on1adapter/HWC2On1Adapter.cpp b/graphics/composer/2.1/utils/hwc2on1adapter/HWC2On1Adapter.cpp
index 3d138f7..5a75ae1 100644
--- a/graphics/composer/2.1/utils/hwc2on1adapter/HWC2On1Adapter.cpp
+++ b/graphics/composer/2.1/utils/hwc2on1adapter/HWC2On1Adapter.cpp
@@ -1389,7 +1389,7 @@
}
static std::string approximateFloatString(float f) {
- if (static_cast<int32_t>(f) == f) {
+ if (static_cast<float>(static_cast<int32_t>(f)) == f) {
return std::to_string(static_cast<int32_t>(f));
}
int32_t truncated = static_cast<int32_t>(f * 10);
@@ -1680,10 +1680,10 @@
if (mAttributes.count(HWC2::Attribute::DpiX) != 0 &&
mAttributes.at(HWC2::Attribute::DpiX) != -1) {
std::memset(buffer, 0, BUFFER_SIZE);
- writtenBytes = snprintf(buffer, BUFFER_SIZE,
- ", DPI: %.1f x %.1f",
- mAttributes.at(HWC2::Attribute::DpiX) / 1000.0f,
- mAttributes.at(HWC2::Attribute::DpiY) / 1000.0f);
+ writtenBytes =
+ snprintf(buffer, BUFFER_SIZE, ", DPI: %.1f x %.1f",
+ static_cast<float>(mAttributes.at(HWC2::Attribute::DpiX)) / 1000.0f,
+ static_cast<float>(mAttributes.at(HWC2::Attribute::DpiY)) / 1000.0f);
output.append(buffer, writtenBytes);
}
diff --git a/sensors/1.0/default/convert.cpp b/sensors/1.0/default/convert.cpp
index 52f5e4f..53ceb0d 100644
--- a/sensors/1.0/default/convert.cpp
+++ b/sensors/1.0/default/convert.cpp
@@ -68,9 +68,9 @@
typedef ::android::hardware::sensors::V1_0::MetaDataEventType MetaDataEventType;
*dst = {
- .sensorHandle = src.sensor,
- .sensorType = (SensorType)src.type,
- .timestamp = src.timestamp
+ .timestamp = src.timestamp,
+ .sensorHandle = src.sensor,
+ .sensorType = (SensorType)src.type,
};
switch (dst->sensorType) {
diff --git a/sensors/common/vts/utils/GrallocWrapper.cpp b/sensors/common/vts/utils/GrallocWrapper.cpp
index 1cad913..e63faa2 100644
--- a/sensors/common/vts/utils/GrallocWrapper.cpp
+++ b/sensors/common/vts/utils/GrallocWrapper.cpp
@@ -147,8 +147,8 @@
.width = size,
.height = 1,
.layerCount = 1,
- .usage = kBufferUsage,
.format = static_cast<decltype(descriptorInfo.format)>(PixelFormat::BLOB),
+ .usage = kBufferUsage,
};
BufferDescriptor descriptor;