MH2 | Implement injectSensorData method of HalProxy

Bug: 136511617
Test: Compiles. No unit tests needed right now for such simple change.
Change-Id: Iaaf74579c26393ef8854ae717f01bb7a451de496
This commit is contained in:
Stan Rokita 2019-09-24 10:16:08 -07:00
parent ab9f70a5ce
commit 83e4370aec

View file

@ -146,9 +146,20 @@ Return<Result> HalProxy::flush(int32_t sensorHandle) {
return getSubHalForSensorHandle(sensorHandle)->flush(clearSubHalIndex(sensorHandle));
}
Return<Result> HalProxy::injectSensorData(const Event& /* event */) {
// TODO: Proxy API call to appropriate sub-HAL.
return Result::INVALID_OPERATION;
Return<Result> HalProxy::injectSensorData(const Event& event) {
Result result = Result::OK;
if (mCurrentOperationMode == OperationMode::NORMAL &&
event.sensorType != V1_0::SensorType::ADDITIONAL_INFO) {
ALOGE("An event with type != ADDITIONAL_INFO passed to injectSensorData while operation"
" mode was NORMAL.");
result = Result::BAD_VALUE;
}
if (result == Result::OK) {
Event subHalEvent = event;
subHalEvent.sensorHandle = clearSubHalIndex(event.sensorHandle);
result = getSubHalForSensorHandle(event.sensorHandle)->injectSensorData(subHalEvent);
}
return result;
}
Return<void> HalProxy::registerDirectChannel(const SharedMemInfo& /* mem */,