Loading
Fix VibrationThread handling old HAL callbacks
The VibrationThread does not differentiate between HAL callbacks from different IVibrator calls, causing older callbacks to affect the vibration playback. This can be seen when the VibrationThread or Vibrator HAL are slower to schedule the steps / callbacks execution, breaking the execution of pattern waveforms that depends on strict timings. This fix adds an extra id to the vibrate calls, which will be sent back by the HAL callback once complete. The VibrationThread can use this to control which callbacks should be ignored during the vibration playback. A regression test was introduced where a latency is set to the fake HAL implementation to check the vibration is executed as expected. This test replicates the flaky failure caught by a separate test. Fix: 395005081 Test: VibrationThreadTest Flag: android.os.vibrator.fix_vibration_thread_callback_handling Change-Id: I1d2bc2d15698e71127e87c164d9b147135cff1a1