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

Commit 2d2257fa authored by Peng Xu's avatar Peng Xu Committed by android-build-merger
Browse files

Merge "Increase poll max size, avoid performance issue when batching" into oc-dev

am: 538fa39c

Change-Id: I834c6e72498963bbe48299903e12f79b29a7479b
parents 3b8250a9 538fa39c
Loading
Loading
Loading
Loading
+6 −7
Original line number Original line Diff line number Diff line
@@ -200,8 +200,7 @@ void SensorsHidlEnvironment::pollingThread(
  bool needExit = *stop;
  bool needExit = *stop;


  while(!needExit) {
  while(!needExit) {
    env->sensors->poll(1,
      env->sensors->poll(64, [&](auto result, const auto& events, const auto& dynamicSensorsAdded) {
        [&](auto result, const auto &events, const auto &dynamicSensorsAdded) {
          if (result != Result::OK
          if (result != Result::OK
              || (events.size() == 0 && dynamicSensorsAdded.size() == 0)
              || (events.size() == 0 && dynamicSensorsAdded.size() == 0)
              || *stop) {
              || *stop) {
@@ -209,8 +208,8 @@ void SensorsHidlEnvironment::pollingThread(
              return;
              return;
          }
          }


          if (events.size() > 0) {
          for (const auto& e : events) {
            env->addEvent(events[0]);
              env->addEvent(e);
          }
          }
      });
      });
  }
  }