summaryrefslogtreecommitdiffstats
path: root/libs/gui/Sensor.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-05-04 15:47:13 -0700
committerMathias Agopian <mathias@google.com>2012-05-04 15:47:13 -0700
commit2ebc4d6d947ef488198b8777d9190c93904b4b9a (patch)
tree3f2d90525315cd4804b37297ea2da67043e9a466 /libs/gui/Sensor.cpp
parent5c8a608497f12ecea4d6e8f1f286baf57c161ea3 (diff)
downloadframeworks_native-2ebc4d6d947ef488198b8777d9190c93904b4b9a.zip
frameworks_native-2ebc4d6d947ef488198b8777d9190c93904b4b9a.tar.gz
frameworks_native-2ebc4d6d947ef488198b8777d9190c93904b4b9a.tar.bz2
set a Sensor's version properly
Bug: 6447433 Change-Id: Iaa5d074a8137d9543ea78c2c6f63a750774b3057
Diffstat (limited to 'libs/gui/Sensor.cpp')
-rw-r--r--libs/gui/Sensor.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/gui/Sensor.cpp b/libs/gui/Sensor.cpp
index f9a2c04..5cc76b4 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);