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

Commit 6dbc3f6c authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Reset InputClassifier HAL when system starts

Under normal operation, the system and the HAL will both start at the
same time, and will have initial state. However, since they are in
separate, and independent, processes, one can crash while another would
remain functional. For example, if the system crashes, the HAL may still
be operational.
To account for these situations, send a complete reset to the HAL when
the system loads. This would help ensure that HAL has consistent state
every time the system starts.

Test: none
Bug: 117935272
Change-Id: I90e53fd4205f018c87af8eb8ac16d54fe9a62011
parent 4b70146a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -505,6 +505,11 @@ MotionClassifier::MotionClassifier(
    // Set the thread name for debugging
    pthread_setname_np(mHalThread.native_handle(), "InputClassifier");
#endif
    // Under normal operation, we do not need to reset the HAL here. But in the case where system
    // crashed, but HAL didn't, we may be connecting to an existing HAL process that might already
    // have received events in the past. That means, that HAL could be in an inconsistent state
    // once it receives events from the newly created MotionClassifier.
    mEvents.push(ClassifierEvent::createHalResetEvent());
}

MotionClassifier::~MotionClassifier() {