From 2ebc4d6d947ef488198b8777d9190c93904b4b9a Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 4 May 2012 15:47:13 -0700 Subject: [PATCH] set a Sensor's version properly Bug: 6447433 Change-Id: Iaa5d074a8137d9543ea78c2c6f63a750774b3057 --- libs/gui/Sensor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/gui/Sensor.cpp b/libs/gui/Sensor.cpp index f9a2c046d..5cc76b4cd 100644 --- a/libs/gui/Sensor.cpp +++ b/libs/gui/Sensor.cpp @@ -40,6 +40,7 @@ Sensor::Sensor(struct sensor_t const* hwSensor) { mName = hwSensor->name; mVendor = hwSensor->vendor; + mVersion = hwSensor->version; mHandle = hwSensor->handle; mType = hwSensor->type; mMinValue = 0; // FIXME: minValue @@ -101,7 +102,7 @@ size_t Sensor::getFlattenedSize() const { return sizeof(int32_t) + ((mName.length() + 3) & ~3) + sizeof(int32_t) + ((mVendor.length() + 3) & ~3) + - sizeof(int32_t) * 2 + + sizeof(int32_t) * 3 + sizeof(float) * 4 + sizeof(int32_t); } @@ -140,6 +141,7 @@ status_t Sensor::flatten(void* buffer, size_t size, offset += write(buffer, offset, mName); offset += write(buffer, offset, int32_t(mVendor.length())); offset += write(buffer, offset, mVendor); + offset += write(buffer, offset, mVersion); offset += write(buffer, offset, mHandle); offset += write(buffer, offset, mType); offset += write(buffer, offset, mMinValue); @@ -178,6 +180,7 @@ status_t Sensor::unflatten(void const* buffer, size_t size, offset += read(buffer, offset, &mName, len); offset += read(buffer, offset, &len); offset += read(buffer, offset, &mVendor, len); + offset += read(buffer, offset, &mVersion); offset += read(buffer, offset, &mHandle); offset += read(buffer, offset, &mType); offset += read(buffer, offset, &mMinValue);