mirror of
https://github.com/oplus-giulia-dev/android_hardware_oplus
synced 2025-12-16 05:48:36 +08:00
sensors: Move one shot sensor out of main class
Change-Id: Ib7ac0c55409f2dc7f8fb114167e9f4b2e8859223
This commit is contained in:
@@ -93,7 +93,7 @@ void Sensor::activate(bool enable) {
|
||||
Result Sensor::flush() {
|
||||
// Only generate a flush complete event if the sensor is enabled and if the sensor is not a
|
||||
// one-shot sensor.
|
||||
if (!mIsEnabled || (mSensorInfo.flags & static_cast<uint32_t>(SensorFlagBits::ONE_SHOT_MODE))) {
|
||||
if (!mIsEnabled) {
|
||||
return Result::BAD_VALUE;
|
||||
}
|
||||
|
||||
@@ -184,6 +184,13 @@ Result Sensor::injectEvent(const Event& event) {
|
||||
return result;
|
||||
}
|
||||
|
||||
OneShotSensor::OneShotSensor(int32_t sensorHandle, ISensorsEventCallback* callback)
|
||||
: Sensor(sensorHandle, callback) {
|
||||
mSensorInfo.minDelay = -1;
|
||||
mSensorInfo.maxDelay = 0;
|
||||
mSensorInfo.flags |= SensorFlagBits::ONE_SHOT_MODE;
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace subhal
|
||||
} // namespace V2_1
|
||||
|
||||
Reference in New Issue
Block a user