Fix ANR caused by VibrationThread

The awaitUntil method that waits for vibration completion is waiting on
a CountDownLatch in a block synchrnized on the VibrationThread. This
causes any call to VibrationThread.cancel() to lock on this wait block
and triggers ANR when vibration is cancelled by the main thread.

The awaitUntil methods should only wait on the VibrationThread instance
so the calls to cancel() will notify and interrupt this wait.

Changed the VibrationThreadTest to test the cancel call on a longer
vibration pattern, that should cause the test to fail if the Thread is
not cancelled right away (i.e. similar conditions that would trigger an
ANR on the main thread).

Fix: 177974811
Test: VibrationThread
Change-Id: Id4346e60292e96df26f5c12e2e088bbf83f416c8
(cherry picked from commit 966e8f29f634e4f2296c2ca8bacaa47def9fe8cf)
3 files changed