sm8450-common: sensors: Use wake-up version of nonui sensor
Change-Id: I4858cd37b98839c00cc2e533d7e50720cd7280c8
This commit is contained in:
@@ -78,11 +78,29 @@ int main() {
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t sensorHandle = -1;
|
std::vector<SensorInfo> sensorList;
|
||||||
manager->getDefaultSensor(static_cast<SensorType>(SENSOR_TYPE_XIAOMI_SENSOR_NONUI),
|
manager->getSensorList([&sensorList, &res](const auto& l, auto r) {
|
||||||
[&sensorHandle](const auto& info, auto r) {
|
sensorList = l;
|
||||||
sensorHandle = info.sensorHandle;
|
res = r;
|
||||||
});
|
});
|
||||||
|
if (res != Result::OK) {
|
||||||
|
LOG(ERROR) << "failed to get getSensorList";
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
auto it = std::find_if(sensorList.begin(), sensorList.end(), [](const SensorInfo& sensor) {
|
||||||
|
return (sensor.typeAsString == SENSOR_NAME_XIAOMI_SENSOR_NONUI) &&
|
||||||
|
(sensor.flags & SensorFlagBits::WAKE_UP);
|
||||||
|
});
|
||||||
|
|
||||||
|
int32_t sensorHandle = -1;
|
||||||
|
if (it != sensorList.end()) {
|
||||||
|
sensorHandle = it->sensorHandle;
|
||||||
|
} else {
|
||||||
|
LOG(ERROR) << "failed to get wake-up version of nonui sensor";
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
sensorList.clear();
|
||||||
|
|
||||||
manager->createEventQueue(new NonUiSensorCallback(), [&queue, &res](const auto& q, auto r) {
|
manager->createEventQueue(new NonUiSensorCallback(), [&queue, &res](const auto& q, auto r) {
|
||||||
queue = q;
|
queue = q;
|
||||||
|
Reference in New Issue
Block a user