Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73409df3 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

resolved conflicts for merge of 02513855 to master

Change-Id: Ie33d57798d3d5b800edde753dac86de062bc270c
parents 19f9950b 9d6f84ea
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ public:
    float getMaxValue() const;
    float getResolution() const;
    float getPowerUsage() const;
    int32_t getMinDelay() const;

    // Flattenable interface
    virtual size_t getFlattenedSize() const;
@@ -81,6 +82,7 @@ private:
    float   mMaxValue;
    float   mResolution;
    float   mPower;
    int32_t mMinDelay;
};

// ----------------------------------------------------------------------------
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ public:
    status_t setEventRate(Sensor const* sensor, nsecs_t ns) const;

    // these are here only to support SensorManager.java
    status_t enableSensor(int32_t handle, int32_t ms) const;
    status_t enableSensor(int32_t handle, int32_t us) const;
    status_t disableSensor(int32_t handle) const;

private:
+10 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ namespace android {
Sensor::Sensor()
    : mHandle(0), mType(0),
      mMinValue(0), mMaxValue(0), mResolution(0),
      mPower(0)
      mPower(0), mMinDelay(0)
{
}

@@ -46,6 +46,7 @@ Sensor::Sensor(struct sensor_t const* hwSensor)
    mMaxValue = hwSensor->maxRange;     // FIXME: maxValue
    mResolution = hwSensor->resolution;
    mPower = hwSensor->power;
    mMinDelay = hwSensor->minDelay;
}

Sensor::~Sensor()
@@ -84,12 +85,17 @@ float Sensor::getPowerUsage() const {
    return mPower;
}

int32_t Sensor::getMinDelay() const {
    return mMinDelay;
}

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(float) * 4;
            sizeof(float) * 4 +
            sizeof(int32_t);
}

size_t Sensor::getFdCount() const
@@ -132,6 +138,7 @@ status_t Sensor::flatten(void* buffer, size_t size,
    offset += write(buffer, offset, mMaxValue);
    offset += write(buffer, offset, mResolution);
    offset += write(buffer, offset, mPower);
    offset += write(buffer, offset, mMinDelay);

    return NO_ERROR;
}
@@ -169,6 +176,7 @@ status_t Sensor::unflatten(void const* buffer, size_t size,
    offset += read(buffer, offset, &mMaxValue);
    offset += read(buffer, offset, &mResolution);
    offset += read(buffer, offset, &mPower);
    offset += read(buffer, offset, &mMinDelay);

    return NO_ERROR;
}
+2 −2
Original line number Diff line number Diff line
@@ -114,10 +114,10 @@ status_t SensorEventQueue::disableSensor(Sensor const* sensor) const {
    return mSensorEventConnection->enableDisable(sensor->getHandle(), false);
}

status_t SensorEventQueue::enableSensor(int32_t handle, int32_t ms) const {
status_t SensorEventQueue::enableSensor(int32_t handle, int32_t us) const {
    status_t err = mSensorEventConnection->enableDisable(handle, true);
    if (err == NO_ERROR) {
        mSensorEventConnection->setEventRate(handle, ms2ns(ms));
        mSensorEventConnection->setEventRate(handle, us2ns(us));
    }
    return err;
}