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:
parent
ab9f70a5ce
commit
83e4370aec
1 changed files with 14 additions and 3 deletions
|
@ -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 */,
|
||||
|
|
Loading…
Reference in a new issue