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

Commit f80d575d authored by Chris Kuiper's avatar Chris Kuiper Committed by Automerger Merge Worker
Browse files

sensorservice: ProximitySensor needs to report correct sensor state. am: cebf2e6c am: 92a114dc

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15459770

Change-Id: Iba0ac2c980d02e48f051001d97ff5856d8f4eced
parents 96ff19f4 92a114dc
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -92,14 +92,16 @@ ProximitySensor::ProximitySensor(const sensor_t& sensor, SensorService& service)
}
}


status_t ProximitySensor::activate(void* ident, bool enabled) {
status_t ProximitySensor::activate(void* ident, bool enabled) {
    bool wasActive = mActive;
    bool lastState = mSensorDevice.isSensorActive(mSensor.getHandle());

    status_t status = HardwareSensor::activate(ident, enabled);
    status_t status = HardwareSensor::activate(ident, enabled);
    if (status != NO_ERROR) {
    if (status != NO_ERROR) {
        return status;
        return status;
    }
    }
    mActive = enabled;

    if (wasActive != enabled) {
    bool currentState = mSensorDevice.isSensorActive(mSensor.getHandle());
        mSensorService.onProximityActiveLocked(enabled);
    if (currentState != lastState) {
        mSensorService.onProximityActiveLocked(currentState);
    }
    }
    return NO_ERROR;
    return NO_ERROR;
}
}
+0 −1
Original line number Original line Diff line number Diff line
@@ -119,7 +119,6 @@ public:
    void didEnableAllSensors() override;
    void didEnableAllSensors() override;
private:
private:
    SensorService& mSensorService;
    SensorService& mSensorService;
    bool mActive;
};
};


// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------