Fix flaky VibrationThread test with multiple vibrations.

Replace last vibration in test with a predefined click, which is
only completed after the native callback. This should ensure the verify
assertion on the mock callback will always be successful.

This should avoid a flakiness that can happen for one-shot vibrations
that are turned off at the fixed end time and might cause the vibration
to finish before the native callback is triggered and ignored.

Fix: 328784973
Test: atest --rerun-until-failure 1000 com.android.server.vibrator.VibrationThreadTest#vibrate_multipleVibrations_withCancel
Change-Id: I93eb568236a4429b37f11823fc49283b61118164
1 file changed