Improve VibrationThread assertions for debugging

Improve VibrationThread tests to use Truth assertions to improve error
messages and help debugging flaky tests.

Bug: 368277051
Test: VibrationThreadTest
Flag: EXEMPT test only
Change-Id: I78e9247b92c333af62638ea1f7c25402561570de
diff --git a/services/tests/vibrator/src/com/android/server/vibrator/VibrationThreadTest.java b/services/tests/vibrator/src/com/android/server/vibrator/VibrationThreadTest.java
index 42279e4..04335df 100644
--- a/services/tests/vibrator/src/com/android/server/vibrator/VibrationThreadTest.java
+++ b/services/tests/vibrator/src/com/android/server/vibrator/VibrationThreadTest.java
@@ -20,14 +20,14 @@
 import static android.os.VibrationEffect.Composition.PRIMITIVE_CLICK;
 import static android.os.VibrationEffect.Composition.PRIMITIVE_SPIN;
 import static android.os.VibrationEffect.Composition.PRIMITIVE_TICK;
+import static android.os.VibrationEffect.EFFECT_CLICK;
+import static android.os.VibrationEffect.EFFECT_TICK;
 import static android.os.VibrationEffect.VibrationParameter.targetAmplitude;
 import static android.os.VibrationEffect.VibrationParameter.targetFrequency;
 
 import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyLong;
@@ -189,7 +189,7 @@
     public void vibrate_noVibrator_ignoresVibration() {
         mVibratorProviders.clear();
         CombinedVibration effect = CombinedVibration.createParallel(
-                VibrationEffect.get(VibrationEffect.EFFECT_CLICK));
+                VibrationEffect.get(EFFECT_CLICK));
         HalVibration vibration = startThreadAndDispatcher(effect);
         waitForCompletion();
 
@@ -200,8 +200,8 @@
     @Test
     public void vibrate_missingVibrators_ignoresVibration() {
         CombinedVibration effect = CombinedVibration.startSequential()
-                .addNext(2, VibrationEffect.get(VibrationEffect.EFFECT_CLICK))
-                .addNext(3, VibrationEffect.get(VibrationEffect.EFFECT_TICK))
+                .addNext(2, VibrationEffect.get(EFFECT_CLICK))
+                .addNext(3, VibrationEffect.get(EFFECT_TICK))
                 .combine();
         HalVibration vibration = startThreadAndDispatcher(effect);
         waitForCompletion();
@@ -222,11 +222,12 @@
         verify(mManagerHooks).noteVibratorOff(eq(UID));
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
 
-        assertEquals(Arrays.asList(expectedOneShot(10)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
-        assertEquals(expectedAmplitudes(100), mVibratorProviders.get(VIBRATOR_ID).getAmplitudes());
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(10)).inOrder();
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(100)).inOrder();
     }
 
     @Test
@@ -239,11 +240,11 @@
         verify(mManagerHooks).noteVibratorOff(eq(UID));
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
 
-        assertEquals(Arrays.asList(expectedOneShot(10)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
-        assertTrue(mVibratorProviders.get(VIBRATOR_ID).getAmplitudes().isEmpty());
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(10)).inOrder();
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getAmplitudes()).isEmpty();
     }
 
     @Test
@@ -259,12 +260,12 @@
         verify(mManagerHooks).noteVibratorOff(eq(UID));
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
 
-        assertEquals(Arrays.asList(expectedOneShot(15)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
-        assertEquals(expectedAmplitudes(1, 2, 3),
-                mVibratorProviders.get(VIBRATOR_ID).getAmplitudes());
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(15)).inOrder();
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(1, 2, 3)).inOrder();
     }
 
     @Test
@@ -285,11 +286,12 @@
         waitForCompletion();
 
         verify(mStatsLoggerMock, never()).logVibrationParamRequestTimeout(UID);
-        assertEquals(Arrays.asList(expectedOneShot(15)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(15)).inOrder();
         List<Float> amplitudes = mVibratorProviders.get(VIBRATOR_ID).getAmplitudes();
         for (int i = 0; i < amplitudes.size(); i++) {
-            assertTrue(amplitudes.get(i) < 1 / 255f);
+            assertWithMessage("For amplitude index %s", i)
+                    .that(amplitudes.get(i)).isLessThan(1 / 255f);
         }
     }
 
@@ -309,10 +311,10 @@
         waitForCompletion();
 
         verify(mStatsLoggerMock).logVibrationParamRequestTimeout(UID);
-        assertEquals(Arrays.asList(expectedOneShot(15)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
-        assertEquals(expectedAmplitudes(1, 1, 1),
-                mVibratorProviders.get(VIBRATOR_ID).getAmplitudes());
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(15)).inOrder();
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(1, 1, 1)).inOrder();
     }
 
     @Test
@@ -325,31 +327,33 @@
         VibrationEffect effect = VibrationEffect.createWaveform(new long[]{5, 5, 5}, amplitudes, 0);
         HalVibration vibration = startThreadAndDispatcher(effect);
 
-        assertTrue(
+        assertThat(
                 waitUntil(() -> fakeVibrator.getAmplitudes().size() > 2 * amplitudes.length,
-                        TEST_TIMEOUT_MILLIS));
+                        TEST_TIMEOUT_MILLIS)).isTrue();
         // Vibration still running after 2 cycles.
-        assertTrue(mThread.isRunningVibrationId(vibration.id));
-        assertTrue(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mThread.isRunningVibrationId(vibration.id)).isTrue();
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isTrue();
 
         Vibration.EndInfo cancelVibrationInfo = new Vibration.EndInfo(Status.CANCELLED_SUPERSEDED,
                 new CallerInfo(VibrationAttributes.createForUsage(VibrationAttributes.USAGE_ALARM),
                         /* uid= */ 1, /* deviceId= */ -1, /* opPkg= */ null, /* reason= */ null));
         mVibrationConductor.notifyCancelled(cancelVibrationInfo, /* immediate= */ false);
         waitForCompletion();
-        assertFalse(mThread.isRunningVibrationId(vibration.id));
+        assertThat(mThread.isRunningVibrationId(vibration.id)).isFalse();
 
         verify(mManagerHooks).noteVibratorOn(eq(UID), anyLong());
         verify(mManagerHooks).noteVibratorOff(eq(UID));
         verifyCallbacksTriggered(vibration, Status.CANCELLED_SUPERSEDED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
 
         List<Float> playedAmplitudes = fakeVibrator.getAmplitudes();
-        assertFalse(fakeVibrator.getEffectSegments(vibration.id).isEmpty());
-        assertFalse(playedAmplitudes.isEmpty());
+        assertThat(fakeVibrator.getEffectSegments(vibration.id)).isNotEmpty();
+        assertThat(playedAmplitudes).isNotEmpty();
 
         for (int i = 0; i < playedAmplitudes.size(); i++) {
-            assertEquals(amplitudes[i % amplitudes.length] / 255f, playedAmplitudes.get(i), 1e-5);
+            assertWithMessage("For amplitude index %s", i)
+                    .that(amplitudes[i % amplitudes.length] / 255f)
+                    .isWithin(1e-5f).of(playedAmplitudes.get(i));
         }
     }
 
@@ -364,15 +368,16 @@
                 new long[]{1, 10, 100}, amplitudes, 0);
         HalVibration vibration = startThreadAndDispatcher(effect);
 
-        assertTrue(waitUntil(() -> !fakeVibrator.getAmplitudes().isEmpty(), TEST_TIMEOUT_MILLIS));
+        assertThat(waitUntil(() -> !fakeVibrator.getAmplitudes().isEmpty(), TEST_TIMEOUT_MILLIS))
+                .isTrue();
         mVibrationConductor.notifyCancelled(
                 new Vibration.EndInfo(Status.CANCELLED_BY_USER), /* immediate= */ false);
         waitForCompletion();
 
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BY_USER);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
-        assertEquals(Arrays.asList(expectedOneShot(5000)),
-                fakeVibrator.getEffectSegments(vibration.id));
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
+        assertThat(fakeVibrator.getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(5000)).inOrder();
     }
 
     @Test
@@ -391,7 +396,7 @@
         assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
 
         assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
-                .isEqualTo(expectedOneShots(100L, 150L));
+                .containsExactlyElementsIn(expectedOneShots(100L, 150L)).inOrder();
     }
 
     @Test
@@ -412,7 +417,7 @@
         assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
 
         assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
-                .isEqualTo(expectedOneShots(200L, 50L));
+                .containsExactlyElementsIn(expectedOneShots(200L, 50L)).inOrder();
     }
 
     @EnableFlags(Flags.FLAG_FIX_VIBRATION_THREAD_CALLBACK_HANDLING)
@@ -433,8 +438,8 @@
         // 300ms ON (100ms + 200ms looping to the start and skipping first 0ms)
         // 150ms ON (100ms + 50ms, skips 0ms)
         // 300ms ON (100ms + 200ms looping to the start and skipping first 0ms)
-        assertTrue(waitUntil(() -> fakeVibrator.getEffectSegments(vibration.id).size() >= 5,
-                5000L + TEST_TIMEOUT_MILLIS));
+        assertThat(waitUntil(() -> fakeVibrator.getEffectSegments(vibration.id).size() >= 5,
+                5000L + TEST_TIMEOUT_MILLIS)).isTrue();
         mVibrationConductor.notifyCancelled(
                 new Vibration.EndInfo(Status.CANCELLED_BY_USER), /* immediate= */ false);
         waitForCompletion();
@@ -444,7 +449,8 @@
 
         assertThat(
                 mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id).subList(0, 5))
-                .isEqualTo(expectedOneShots(200L, 150L, 300L, 150L, 300L));
+                .containsExactlyElementsIn(expectedOneShots(200L, 150L, 300L, 150L, 300L))
+                .inOrder();
     }
 
     @EnableFlags(Flags.FLAG_FIX_VIBRATION_THREAD_CALLBACK_HANDLING)
@@ -468,7 +474,7 @@
 
         // First callback ignored, did not cause the vibrator to turn back on during the 400ms step.
         assertThat(fakeVibrator.getEffectSegments(vibration.id))
-                .isEqualTo(expectedOneShots(200L, 400L));
+                .containsExactlyElementsIn(expectedOneShots(200L, 400L)).inOrder();
     }
 
     @Test
@@ -490,16 +496,16 @@
                 .compose();
         HalVibration vibration = startThreadAndDispatcher(repeatingEffect);
 
-        assertTrue(waitUntil(() -> !fakeVibrator.getEffectSegments(vibration.id).isEmpty(),
-                TEST_TIMEOUT_MILLIS));
+        assertThat(waitUntil(() -> !fakeVibrator.getEffectSegments(vibration.id).isEmpty(),
+                TEST_TIMEOUT_MILLIS)).isTrue();
         mVibrationConductor.notifyCancelled(
                 new Vibration.EndInfo(Status.CANCELLED_BY_USER), /* immediate= */ false);
         waitForCompletion();
 
         // PWLE size max was used to generate a single vibrate call with 10 segments.
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BY_USER);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
-        assertEquals(10, fakeVibrator.getEffectSegments(vibration.id).size());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
+        assertThat(fakeVibrator.getEffectSegments(vibration.id)).hasSize(10);
     }
 
     @Test
@@ -519,16 +525,16 @@
                 .compose();
         HalVibration vibration = startThreadAndDispatcher(repeatingEffect);
 
-        assertTrue(waitUntil(() -> !fakeVibrator.getEffectSegments(vibration.id).isEmpty(),
-                TEST_TIMEOUT_MILLIS));
+        assertThat(waitUntil(() -> !fakeVibrator.getEffectSegments(vibration.id).isEmpty(),
+                TEST_TIMEOUT_MILLIS)).isTrue();
         mVibrationConductor.notifyCancelled(
                 new Vibration.EndInfo(Status.CANCELLED_BY_SCREEN_OFF), /* immediate= */ false);
         waitForCompletion();
 
         // Composition size max was used to generate a single vibrate call with 10 primitives.
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BY_SCREEN_OFF);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
-        assertEquals(10, fakeVibrator.getEffectSegments(vibration.id).size());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
+        assertThat(fakeVibrator.getEffectSegments(vibration.id)).hasSize(10);
     }
 
     @Test
@@ -542,15 +548,16 @@
                 new long[]{5000, 500, 50}, amplitudes, 0);
         HalVibration vibration = startThreadAndDispatcher(effect);
 
-        assertTrue(waitUntil(() -> !fakeVibrator.getAmplitudes().isEmpty(), TEST_TIMEOUT_MILLIS));
+        assertThat(waitUntil(() -> !fakeVibrator.getAmplitudes().isEmpty(), TEST_TIMEOUT_MILLIS))
+                .isTrue();
         mVibrationConductor.notifyCancelled(
                 new Vibration.EndInfo(Status.CANCELLED_BY_USER), /* immediate= */ false);
         waitForCompletion();
 
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BY_USER);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
-        assertEquals(Arrays.asList(expectedOneShot(5550)),
-                fakeVibrator.getEffectSegments(vibration.id));
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
+        assertThat(fakeVibrator.getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(5550)).inOrder();
     }
 
     @LargeTest
@@ -566,23 +573,24 @@
                 /* amplitudes= */ new int[]{1, 2}, /* repeat= */ 0);
         HalVibration vibration = startThreadAndDispatcher(effect);
 
-        assertTrue(waitUntil(() -> fakeVibrator.getEffectSegments(vibration.id).size() > 1,
-                expectedOnDuration + TEST_TIMEOUT_MILLIS));
+        assertThat(waitUntil(() -> fakeVibrator.getEffectSegments(vibration.id).size() > 1,
+                expectedOnDuration + TEST_TIMEOUT_MILLIS)).isTrue();
         mVibrationConductor.notifyCancelled(
                 new Vibration.EndInfo(Status.CANCELLED_BY_USER), /* immediate= */ false);
         waitForCompletion();
 
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BY_USER);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
         List<VibrationEffectSegment> effectSegments = fakeVibrator.getEffectSegments(vibration.id);
         // First time, turn vibrator ON for the expected fixed duration.
-        assertEquals(expectedOnDuration, effectSegments.get(0).getDuration());
+        assertThat(effectSegments.get(0).getDuration()).isEqualTo(expectedOnDuration);
         // Vibrator turns off in the middle of the second execution of the first step. Expect it to
         // be turned back ON at least for the fixed duration + the remaining duration of the step.
-        assertTrue(expectedOnDuration < effectSegments.get(1).getDuration());
+        assertThat(effectSegments.get(1).getDuration()).isGreaterThan(expectedOnDuration);
         // Set amplitudes for a cycle {1, 2}, start second loop then turn it back on to same value.
-        assertEquals(expectedAmplitudes(1, 2, 1, 1),
-                mVibratorProviders.get(VIBRATOR_ID).getAmplitudes().subList(0, 4));
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getAmplitudes().subList(0, 4))
+                .containsExactlyElementsIn(expectedAmplitudes(1, 2, 1, 1))
+                .inOrder();
     }
 
     @Test
@@ -598,9 +606,9 @@
                 .compose();
         HalVibration vibration = startThreadAndDispatcher(effect);
 
-        assertTrue(waitUntil(() -> mControllers.get(VIBRATOR_ID).isVibrating(),
-                TEST_TIMEOUT_MILLIS));
-        assertTrue(mThread.isRunningVibrationId(vibration.id));
+        assertThat(waitUntil(() -> mControllers.get(VIBRATOR_ID).isVibrating(),
+                TEST_TIMEOUT_MILLIS)).isTrue();
+        assertThat(mThread.isRunningVibrationId(vibration.id)).isTrue();
 
         // Run cancel in a separate thread so if VibrationThread.cancel blocks then this test should
         // fail at waitForCompletion(vibrationThread) if the vibration not cancelled immediately.
@@ -614,7 +622,7 @@
         cancellingThread.join();
 
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BY_SETTINGS_UPDATE);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
     }
 
     @Test
@@ -628,9 +636,9 @@
         VibrationEffect effect = VibrationEffect.createVendorEffect(createTestVendorData());
         HalVibration vibration = startThreadAndDispatcher(effect);
 
-        assertTrue(waitUntil(() -> mControllers.get(VIBRATOR_ID).isVibrating(),
-                TEST_TIMEOUT_MILLIS));
-        assertTrue(mThread.isRunningVibrationId(vibration.id));
+        assertThat(waitUntil(() -> mControllers.get(VIBRATOR_ID).isVibrating(),
+                TEST_TIMEOUT_MILLIS)).isTrue();
+        assertThat(mThread.isRunningVibrationId(vibration.id)).isTrue();
 
         // Run cancel in a separate thread so if VibrationThread.cancel blocks then this test should
         // fail at waitForCompletion(vibrationThread) if the vibration not cancelled immediately.
@@ -644,7 +652,7 @@
         cancellingThread.join();
 
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BY_SETTINGS_UPDATE);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
     }
 
     @Test
@@ -655,9 +663,9 @@
         VibrationEffect effect = VibrationEffect.createWaveform(new long[]{100}, new int[]{100}, 0);
         HalVibration vibration = startThreadAndDispatcher(effect);
 
-        assertTrue(waitUntil(() -> mControllers.get(VIBRATOR_ID).isVibrating(),
-                TEST_TIMEOUT_MILLIS));
-        assertTrue(mThread.isRunningVibrationId(vibration.id));
+        assertThat(waitUntil(() -> mControllers.get(VIBRATOR_ID).isVibrating(),
+                TEST_TIMEOUT_MILLIS)).isTrue();
+        assertThat(mThread.isRunningVibrationId(vibration.id)).isTrue();
 
         // Run cancel in a separate thread so if VibrationThread.cancel blocks then this test should
         // fail at waitForCompletion(vibrationThread) if the vibration not cancelled immediately.
@@ -671,7 +679,7 @@
         cancellingThread.join();
 
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BY_SCREEN_OFF);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
     }
 
     @Test
@@ -686,10 +694,10 @@
         verify(mManagerHooks).noteVibratorOff(eq(UID));
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
 
-        assertEquals(Arrays.asList(expectedPrebaked(VibrationEffect.EFFECT_THUD)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(expectedPrebaked(VibrationEffect.EFFECT_THUD)).inOrder();
     }
 
     @Test
@@ -698,7 +706,7 @@
 
         VibrationEffect fallback = VibrationEffect.createOneShot(10, 100);
         HalVibration vibration = createVibration(CombinedVibration.createParallel(
-                VibrationEffect.get(VibrationEffect.EFFECT_CLICK)));
+                VibrationEffect.get(EFFECT_CLICK)));
         vibration.fillFallbacks(unused -> fallback);
         startThreadAndDispatcher(vibration);
         waitForCompletion();
@@ -707,16 +715,17 @@
         verify(mManagerHooks).noteVibratorOff(eq(UID));
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
 
-        assertEquals(Arrays.asList(expectedOneShot(10)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
-        assertEquals(expectedAmplitudes(100), mVibratorProviders.get(VIBRATOR_ID).getAmplitudes());
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(10)).inOrder();
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(100)).inOrder();
     }
 
     @Test
     public void vibrate_singleVibratorPrebakedAndUnsupportedEffect_ignoresVibration() {
-        VibrationEffect effect = VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
+        VibrationEffect effect = VibrationEffect.get(EFFECT_CLICK);
         HalVibration vibration = startThreadAndDispatcher(effect);
         waitForCompletion();
 
@@ -725,7 +734,7 @@
         verify(mControllerCallbacks, never())
                 .onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.IGNORED_UNSUPPORTED);
-        assertTrue(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id).isEmpty());
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id)).isEmpty();
     }
 
     @Test
@@ -745,8 +754,7 @@
         assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
 
         assertThat(mVibratorProviders.get(VIBRATOR_ID).getVendorEffects(vibration.id))
-                .containsExactly(effect)
-                .inOrder();
+                .containsExactly(effect).inOrder();
     }
 
     @Test
@@ -766,11 +774,12 @@
         verify(mManagerHooks).noteVibratorOff(eq(UID));
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
-        assertEquals(Arrays.asList(
-                expectedPrimitive(PRIMITIVE_CLICK, 1, 0),
-                expectedPrimitive(PRIMITIVE_TICK, 0.5f, 0)),
-                fakeVibrator.getEffectSegments(vibration.id));
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
+        assertThat(fakeVibrator.getEffectSegments(vibration.id))
+                .containsExactly(
+                        expectedPrimitive(PRIMITIVE_CLICK, 1, 0),
+                        expectedPrimitive(PRIMITIVE_TICK, 0.5f, 0))
+                .inOrder();
     }
 
     @Test
@@ -787,7 +796,7 @@
         verify(mControllerCallbacks, never())
                 .onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.IGNORED_UNSUPPORTED);
-        assertTrue(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id).isEmpty());
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id)).isEmpty();
     }
 
     @Test
@@ -804,7 +813,7 @@
         verify(mControllerCallbacks, never())
                 .onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.IGNORED_UNSUPPORTED);
-        assertTrue(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id).isEmpty());
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id)).isEmpty();
     }
 
     @Test
@@ -826,14 +835,14 @@
         // Vibrator compose called twice.
         verify(mControllerCallbacks, times(2))
                 .onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
-        assertEquals(3, fakeVibrator.getEffectSegments(vibration.id).size());
+        assertThat(fakeVibrator.getEffectSegments(vibration.id)).hasSize(3);
     }
 
     @Test
     @DisableFlags(Flags.FLAG_NORMALIZED_PWLE_EFFECTS)
     public void vibrate_singleVibratorComposedEffects_runsDifferentVibrations() {
         FakeVibratorControllerProvider fakeVibrator = mVibratorProviders.get(VIBRATOR_ID);
-        fakeVibrator.setSupportedEffects(VibrationEffect.EFFECT_CLICK);
+        fakeVibrator.setSupportedEffects(EFFECT_CLICK);
         fakeVibrator.setSupportedPrimitives(PRIMITIVE_CLICK, PRIMITIVE_TICK);
         fakeVibrator.setCapabilities(IVibrator.CAP_COMPOSE_EFFECTS,
                 IVibrator.CAP_COMPOSE_PWLE_EFFECTS, IVibrator.CAP_AMPLITUDE_CONTROL);
@@ -847,13 +856,13 @@
                 .addEffect(VibrationEffect.createOneShot(10, 100))
                 .addPrimitive(PRIMITIVE_CLICK, 1f)
                 .addPrimitive(PRIMITIVE_TICK, 0.5f)
-                .addEffect(VibrationEffect.get(VibrationEffect.EFFECT_CLICK))
+                .addEffect(VibrationEffect.get(EFFECT_CLICK))
                 .addEffect(VibrationEffect.startWaveform()
                         .addTransition(Duration.ofMillis(10),
                                 targetAmplitude(1), targetFrequency(100))
                         .addTransition(Duration.ofMillis(20), targetFrequency(120))
                         .build())
-                .addEffect(VibrationEffect.get(VibrationEffect.EFFECT_CLICK))
+                .addEffect(VibrationEffect.get(EFFECT_CLICK))
                 .compose();
         HalVibration vibration = startThreadAndDispatcher(effect);
         waitForCompletion();
@@ -864,33 +873,37 @@
         verify(mControllerCallbacks, times(5))
                 .onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
-        assertEquals(Arrays.asList(
-                expectedOneShot(10),
-                expectedPrimitive(PRIMITIVE_CLICK, 1, 0),
-                expectedPrimitive(PRIMITIVE_TICK, 0.5f, 0),
-                expectedPrebaked(VibrationEffect.EFFECT_CLICK),
-                expectedRamp(/* startAmplitude= */ 0, /* endAmplitude= */ 0.5f,
-                        /* startFrequencyHz= */ 150, /* endFrequencyHz= */ 100, /* duration= */ 10),
-                expectedRamp(/* startAmplitude= */ 0.5f, /* endAmplitude= */ 0.7f,
-                        /* startFrequencyHz= */ 100, /* endFrequencyHz= */ 120, /* duration= */ 20),
-                expectedPrebaked(VibrationEffect.EFFECT_CLICK)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
-        assertEquals(expectedAmplitudes(100), mVibratorProviders.get(VIBRATOR_ID).getAmplitudes());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(
+                        expectedOneShot(10),
+                        expectedPrimitive(PRIMITIVE_CLICK, 1, 0),
+                        expectedPrimitive(PRIMITIVE_TICK, 0.5f, 0),
+                        expectedPrebaked(EFFECT_CLICK),
+                        expectedRamp(/* startAmplitude= */ 0, /* endAmplitude= */ 0.5f,
+                                /* startFrequencyHz= */ 150, /* endFrequencyHz= */ 100,
+                                /* duration= */ 10),
+                        expectedRamp(/* startAmplitude= */ 0.5f, /* endAmplitude= */ 0.7f,
+                                /* startFrequencyHz= */ 100, /* endFrequencyHz= */ 120,
+                                /* duration= */ 20),
+                        expectedPrebaked(EFFECT_CLICK))
+                .inOrder();
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(100)).inOrder();
     }
 
     @Test
     public void vibrate_singleVibratorComposedWithFallback_replacedInTheMiddleOfComposition() {
         FakeVibratorControllerProvider fakeVibrator = mVibratorProviders.get(VIBRATOR_ID);
-        fakeVibrator.setSupportedEffects(VibrationEffect.EFFECT_CLICK);
+        fakeVibrator.setSupportedEffects(EFFECT_CLICK);
         fakeVibrator.setSupportedPrimitives(PRIMITIVE_CLICK, PRIMITIVE_TICK);
         fakeVibrator.setCapabilities(IVibrator.CAP_COMPOSE_EFFECTS);
 
         VibrationEffect fallback = VibrationEffect.createOneShot(10, 100);
         VibrationEffect effect = VibrationEffect.startComposition()
-                .addEffect(VibrationEffect.get(VibrationEffect.EFFECT_CLICK))
+                .addEffect(VibrationEffect.get(EFFECT_CLICK))
                 .addPrimitive(PRIMITIVE_CLICK, 1f)
-                .addEffect(VibrationEffect.get(VibrationEffect.EFFECT_TICK))
+                .addEffect(VibrationEffect.get(EFFECT_TICK))
                 .addPrimitive(PRIMITIVE_TICK, 0.5f)
                 .compose();
         HalVibration vibration = createVibration(CombinedVibration.createParallel(effect));
@@ -904,18 +917,19 @@
         verify(mControllerCallbacks, times(4))
                 .onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
 
         List<VibrationEffectSegment> segments =
                 mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id);
-        assertTrue("Wrong segments: " + segments, segments.size() >= 4);
-        assertTrue(segments.get(0) instanceof PrebakedSegment);
-        assertTrue(segments.get(1) instanceof PrimitiveSegment);
+        assertWithMessage("Wrong segments: %s", segments).that(segments.size()).isGreaterThan(3);
+        assertThat(segments.get(0)).isInstanceOf(PrebakedSegment.class);
+        assertThat(segments.get(1)).isInstanceOf(PrimitiveSegment.class);
         for (int i = 2; i < segments.size() - 1; i++) {
             // One or more step segments as fallback for the EFFECT_TICK.
-            assertTrue(segments.get(i) instanceof StepSegment);
+            assertWithMessage("For segment index %s", i)
+                    .that(segments.get(i)).isInstanceOf(StepSegment.class);
         }
-        assertTrue(segments.get(segments.size() - 1) instanceof PrimitiveSegment);
+        assertThat(segments.get(segments.size() - 1)).isInstanceOf(PrimitiveSegment.class);
     }
 
     @Test
@@ -942,14 +956,15 @@
         verify(mManagerHooks).noteVibratorOff(eq(UID));
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
-        assertEquals(Arrays.asList(
-                expectedPwle(/*amplitude=*/ 0.0f, /*frequencyHz=*/ 60f, /*timeMillis=*/ 0),
-                expectedPwle(/*amplitude=*/ 0.1f, /*frequencyHz=*/ 60f, /*timeMillis=*/ 20),
-                expectedPwle(/*amplitude=*/ 0.3f, /*frequencyHz=*/ 100f, /*timeMillis=*/ 30),
-                expectedPwle(/*amplitude=*/ 0.4f, /*frequencyHz=*/ 120f, /*timeMillis=*/ 20),
-                expectedPwle(/*amplitude=*/ 0.0f, /*frequencyHz=*/ 120f, /*timeMillis=*/ 30)
-        ), fakeVibrator.getEffectPwlePoints(vibration.id));
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
+        assertThat(fakeVibrator.getEffectPwlePoints(vibration.id))
+                .containsExactly(
+                        expectedPwle(0.0f, 60f, 0),
+                        expectedPwle(0.1f, 60f, 20),
+                        expectedPwle(0.3f, 100f, 30),
+                        expectedPwle(0.4f, 120f, 20),
+                        expectedPwle(0.0f, 120f, 30))
+                .inOrder();
 
     }
 
@@ -978,13 +993,14 @@
         verify(mManagerHooks).noteVibratorOff(eq(UID));
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
-        assertEquals(Arrays.asList(
-                expectedPwle(/*amplitude=*/ 0.0f, /*frequencyHz=*/ 150f, /*timeMillis=*/ 0),
-                expectedPwle(/*amplitude=*/ 1.0f, /*frequencyHz=*/ 150f, /*timeMillis=*/ 20),
-                expectedPwle(/*amplitude=*/ 1.0f, /*frequencyHz=*/ 150f, /*timeMillis=*/ 100),
-                expectedPwle(/*amplitude=*/ 0.0f, /*frequencyHz=*/ 150f, /*timeMillis=*/ 100)
-        ), fakeVibrator.getEffectPwlePoints(vibration.id));
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
+        assertThat(fakeVibrator.getEffectPwlePoints(vibration.id))
+                .containsExactly(
+                        expectedPwle(0.0f, 150f, 0),
+                        expectedPwle(1.0f, 150f, 20),
+                        expectedPwle(1.0f, 150f, 100),
+                        expectedPwle(0.0f, 150f, 100))
+                .inOrder();
 
     }
 
@@ -1014,15 +1030,15 @@
         verify(mManagerHooks).noteVibratorOff(eq(UID));
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
-        assertEquals(Arrays.asList(
-                expectedPwle(/*amplitude=*/ 0.0f, /*frequencyHz=*/ 30f, /*timeMillis=*/ 0),
-                expectedPwle(/*amplitude=*/ 0.1f, /*frequencyHz=*/ 60f, /*timeMillis=*/ 20),
-                expectedPwle(/*amplitude=*/ 0.3f, /*frequencyHz=*/ 100f, /*timeMillis=*/ 30),
-                expectedPwle(/*amplitude=*/ 0.4f, /*frequencyHz=*/ 120f, /*timeMillis=*/ 20),
-                expectedPwle(/*amplitude=*/ 0.0f, /*frequencyHz=*/ 120f, /*timeMillis=*/ 30)
-        ), fakeVibrator.getEffectPwlePoints(vibration.id));
-
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
+        assertThat(fakeVibrator.getEffectPwlePoints(vibration.id))
+                .containsExactly(
+                        expectedPwle(0.0f, 30f, 0),
+                        expectedPwle(0.1f, 60f, 20),
+                        expectedPwle(0.3f, 100f, 30),
+                        expectedPwle(0.4f, 120f, 20),
+                        expectedPwle(0.0f, 120f, 30))
+                .inOrder();
     }
 
     @Test
@@ -1054,18 +1070,17 @@
         // Using best split points instead of max-packing PWLEs.
         verify(mControllerCallbacks, times(3))
                 .onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
-
-        assertEquals(Arrays.asList(
-                expectedPwle(/*amplitude=*/ 0.0f, /*frequencyHz=*/ 100f, /*timeMillis=*/ 0),
-                expectedPwle(/*amplitude=*/ 0.8f, /*frequencyHz=*/ 100f, /*timeMillis=*/ 30),
-                expectedPwle(/*amplitude=*/ 0.0f, /*frequencyHz=*/ 100f, /*timeMillis=*/ 30),
-                expectedPwle(/*amplitude=*/ 0.9f, /*frequencyHz=*/ 100f, /*timeMillis=*/ 0),
-                expectedPwle(/*amplitude=*/ 0.4f, /*frequencyHz=*/ 100f, /*timeMillis=*/ 30),
-                expectedPwle(/*amplitude=*/ 0.6f, /*frequencyHz=*/ 100f, /*timeMillis=*/ 0),
-                expectedPwle(/*amplitude=*/ 0.7f, /*frequencyHz=*/ 100f, /*timeMillis=*/ 30)
-        ), fakeVibrator.getEffectPwlePoints(vibration.id));
-
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
+        assertThat(fakeVibrator.getEffectPwlePoints(vibration.id))
+                .containsExactly(
+                        expectedPwle(0.0f, 100f, 0),
+                        expectedPwle(0.8f, 100f, 30),
+                        expectedPwle(0.0f, 100f, 30),
+                        expectedPwle(0.9f, 100f, 0),
+                        expectedPwle(0.4f, 100f, 30),
+                        expectedPwle(0.6f, 100f, 0),
+                        expectedPwle(0.7f, 100f, 30))
+                .inOrder();
     }
 
     @Test
@@ -1094,17 +1109,21 @@
         verify(mManagerHooks).noteVibratorOff(eq(UID));
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
-        assertEquals(Arrays.asList(
-                expectedRamp(/* amplitude= */ 1, /* frequencyHz= */ 150, /* duration= */ 10),
-                expectedRamp(/* startAmplitude= */ 1, /* endAmplitude= */ 0,
-                        /* startFrequencyHz= */ 150, /* endFrequencyHz= */ 150, /* duration= */ 20),
-                expectedRamp(/* amplitude= */ 0.5f, /* frequencyHz= */ 100, /* duration= */ 30),
-                expectedRamp(/* startAmplitude= */ 0.5f, /* endAmplitude= */ 0.6f,
-                        /* startFrequencyHz= */ 100, /* endFrequencyHz= */ 200,
-                        /* duration= */ 40)),
-                fakeVibrator.getEffectSegments(vibration.id));
-        assertEquals(Arrays.asList(Braking.CLAB), fakeVibrator.getBraking(vibration.id));
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
+        assertThat(fakeVibrator.getEffectSegments(vibration.id))
+                .containsExactly(
+                        expectedRamp(/* amplitude= */ 1, /* frequencyHz= */ 150,
+                                /* duration= */ 10),
+                        expectedRamp(/* startAmplitude= */ 1, /* endAmplitude= */ 0,
+                                /* startFrequencyHz= */ 150, /* endFrequencyHz= */ 150,
+                                /* duration= */ 20),
+                        expectedRamp(/* amplitude= */ 0.5f, /* frequencyHz= */ 100,
+                                /* duration= */ 30),
+                        expectedRamp(/* startAmplitude= */ 0.5f, /* endAmplitude= */ 0.6f,
+                                /* startFrequencyHz= */ 100, /* endFrequencyHz= */ 200,
+                                /* duration= */ 40))
+                .inOrder();
+        assertThat(fakeVibrator.getBraking(vibration.id)).containsExactly(Braking.CLAB).inOrder();
     }
 
     @Test
@@ -1137,7 +1156,7 @@
         // Using best split points instead of max-packing PWLEs.
         verify(mControllerCallbacks, times(3))
                 .onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
-        assertEquals(6, fakeVibrator.getEffectSegments(vibration.id).size());
+        assertThat(fakeVibrator.getEffectSegments(vibration.id)).hasSize(6);
     }
 
     @Test
@@ -1148,15 +1167,16 @@
         VibrationEffect effect = VibrationEffect.createWaveform(new long[]{5}, new int[]{100}, 0);
         HalVibration vibration = startThreadAndDispatcher(effect);
 
-        assertTrue(waitUntil(() -> fakeVibrator.getAmplitudes().size() > 2, TEST_TIMEOUT_MILLIS));
+        assertThat(waitUntil(() -> fakeVibrator.getAmplitudes().size() > 2, TEST_TIMEOUT_MILLIS))
+                .isTrue();
         // Vibration still running after 2 cycles.
-        assertTrue(mThread.isRunningVibrationId(vibration.id));
-        assertTrue(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mThread.isRunningVibrationId(vibration.id)).isTrue();
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isTrue();
 
         mVibrationConductor.notifyCancelled(
                 new Vibration.EndInfo(Status.CANCELLED_BINDER_DIED), /* immediate= */ false);
         waitForCompletion();
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
 
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BINDER_DIED);
     }
@@ -1176,11 +1196,11 @@
 
     @Test
     public void vibrate_multipleExistingAndMissingVibrators_vibratesOnlyExistingOnes() {
-        mVibratorProviders.get(1).setSupportedEffects(VibrationEffect.EFFECT_TICK);
+        mVibratorProviders.get(1).setSupportedEffects(EFFECT_TICK);
 
         CombinedVibration effect = CombinedVibration.startParallel()
-                .addVibrator(VIBRATOR_ID, VibrationEffect.get(VibrationEffect.EFFECT_TICK))
-                .addVibrator(2, VibrationEffect.get(VibrationEffect.EFFECT_TICK))
+                .addVibrator(VIBRATOR_ID, VibrationEffect.get(EFFECT_TICK))
+                .addVibrator(2, VibrationEffect.get(EFFECT_TICK))
                 .combine();
         HalVibration vibration = startThreadAndDispatcher(effect);
         waitForCompletion();
@@ -1190,21 +1210,21 @@
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verify(mControllerCallbacks, never()).onComplete(eq(2), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
 
-        assertEquals(Arrays.asList(expectedPrebaked(VibrationEffect.EFFECT_TICK)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(expectedPrebaked(EFFECT_TICK)).inOrder();
     }
 
     @Test
     public void vibrate_multipleMono_runsSameEffectInAllVibrators() {
         mockVibrators(1, 2, 3);
-        mVibratorProviders.get(1).setSupportedEffects(VibrationEffect.EFFECT_CLICK);
-        mVibratorProviders.get(2).setSupportedEffects(VibrationEffect.EFFECT_CLICK);
-        mVibratorProviders.get(3).setSupportedEffects(VibrationEffect.EFFECT_CLICK);
+        mVibratorProviders.get(1).setSupportedEffects(EFFECT_CLICK);
+        mVibratorProviders.get(2).setSupportedEffects(EFFECT_CLICK);
+        mVibratorProviders.get(3).setSupportedEffects(EFFECT_CLICK);
 
         CombinedVibration effect = CombinedVibration.createParallel(
-                VibrationEffect.get(VibrationEffect.EFFECT_CLICK));
+                VibrationEffect.get(EFFECT_CLICK));
         HalVibration vibration = startThreadAndDispatcher(effect);
         waitForCompletion();
 
@@ -1214,23 +1234,23 @@
         verify(mControllerCallbacks).onComplete(eq(2), eq(vibration.id), anyLong());
         verify(mControllerCallbacks).onComplete(eq(3), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(1).isVibrating());
-        assertFalse(mControllers.get(2).isVibrating());
-        assertFalse(mControllers.get(3).isVibrating());
+        assertThat(mControllers.get(1).isVibrating()).isFalse();
+        assertThat(mControllers.get(2).isVibrating()).isFalse();
+        assertThat(mControllers.get(3).isVibrating()).isFalse();
 
-        VibrationEffectSegment expected = expectedPrebaked(VibrationEffect.EFFECT_CLICK);
-        assertEquals(Arrays.asList(expected),
-                mVibratorProviders.get(1).getEffectSegments(vibration.id));
-        assertEquals(Arrays.asList(expected),
-                mVibratorProviders.get(2).getEffectSegments(vibration.id));
-        assertEquals(Arrays.asList(expected),
-                mVibratorProviders.get(3).getEffectSegments(vibration.id));
+        VibrationEffectSegment expected = expectedPrebaked(EFFECT_CLICK);
+        assertThat(mVibratorProviders.get(1).getEffectSegments(vibration.id))
+                .containsExactly(expected).inOrder();
+        assertThat(mVibratorProviders.get(2).getEffectSegments(vibration.id))
+                .containsExactly(expected).inOrder();
+        assertThat(mVibratorProviders.get(3).getEffectSegments(vibration.id))
+                .containsExactly(expected).inOrder();
     }
 
     @Test
     public void vibrate_multipleStereo_runsVibrationOnRightVibrators() {
         mockVibrators(1, 2, 3, 4);
-        mVibratorProviders.get(1).setSupportedEffects(VibrationEffect.EFFECT_CLICK);
+        mVibratorProviders.get(1).setSupportedEffects(EFFECT_CLICK);
         mVibratorProviders.get(2).setCapabilities(IVibrator.CAP_AMPLITUDE_CONTROL);
         mVibratorProviders.get(3).setCapabilities(IVibrator.CAP_AMPLITUDE_CONTROL);
         mVibratorProviders.get(4).setCapabilities(IVibrator.CAP_COMPOSE_EFFECTS);
@@ -1240,7 +1260,7 @@
                 .addPrimitive(PRIMITIVE_CLICK)
                 .compose();
         CombinedVibration effect = CombinedVibration.startParallel()
-                .addVibrator(1, VibrationEffect.get(VibrationEffect.EFFECT_CLICK))
+                .addVibrator(1, VibrationEffect.get(EFFECT_CLICK))
                 .addVibrator(2, VibrationEffect.createOneShot(10, 100))
                 .addVibrator(3, VibrationEffect.createWaveform(
                         new long[]{10, 10}, new int[]{1, 2}, -1))
@@ -1256,21 +1276,23 @@
         verify(mControllerCallbacks).onComplete(eq(3), eq(vibration.id), anyLong());
         verify(mControllerCallbacks).onComplete(eq(4), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(1).isVibrating());
-        assertFalse(mControllers.get(2).isVibrating());
-        assertFalse(mControllers.get(3).isVibrating());
-        assertFalse(mControllers.get(4).isVibrating());
+        assertThat(mControllers.get(1).isVibrating()).isFalse();
+        assertThat(mControllers.get(2).isVibrating()).isFalse();
+        assertThat(mControllers.get(3).isVibrating()).isFalse();
+        assertThat(mControllers.get(4).isVibrating()).isFalse();
 
-        assertEquals(Arrays.asList(expectedPrebaked(VibrationEffect.EFFECT_CLICK)),
-                mVibratorProviders.get(1).getEffectSegments(vibration.id));
-        assertEquals(Arrays.asList(expectedOneShot(10)),
-                mVibratorProviders.get(2).getEffectSegments(vibration.id));
-        assertEquals(expectedAmplitudes(100), mVibratorProviders.get(2).getAmplitudes());
-        assertEquals(Arrays.asList(expectedOneShot(20)),
-                mVibratorProviders.get(3).getEffectSegments(vibration.id));
-        assertEquals(expectedAmplitudes(1, 2), mVibratorProviders.get(3).getAmplitudes());
-        assertEquals(Arrays.asList(expectedPrimitive(PRIMITIVE_CLICK, 1, 0)),
-                mVibratorProviders.get(4).getEffectSegments(vibration.id));
+        assertThat(mVibratorProviders.get(1).getEffectSegments(vibration.id))
+                .containsExactly(expectedPrebaked(EFFECT_CLICK)).inOrder();
+        assertThat(mVibratorProviders.get(2).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(10)).inOrder();
+        assertThat(mVibratorProviders.get(2).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(100)).inOrder();
+        assertThat(mVibratorProviders.get(3).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(20)).inOrder();
+        assertThat(mVibratorProviders.get(3).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(1, 2)).inOrder();
+        assertThat(mVibratorProviders.get(4).getEffectSegments(vibration.id))
+                .containsExactly(expectedPrimitive(PRIMITIVE_CLICK, 1, 0)).inOrder();
     }
 
     @Test
@@ -1279,13 +1301,13 @@
         mVibratorProviders.get(1).setCapabilities(IVibrator.CAP_AMPLITUDE_CONTROL);
         mVibratorProviders.get(2).setCapabilities(IVibrator.CAP_COMPOSE_EFFECTS);
         mVibratorProviders.get(2).setSupportedPrimitives(PRIMITIVE_CLICK);
-        mVibratorProviders.get(3).setSupportedEffects(VibrationEffect.EFFECT_CLICK);
+        mVibratorProviders.get(3).setSupportedEffects(EFFECT_CLICK);
 
         VibrationEffect composed = VibrationEffect.startComposition()
                 .addPrimitive(PRIMITIVE_CLICK)
                 .compose();
         CombinedVibration effect = CombinedVibration.startSequential()
-                .addNext(3, VibrationEffect.get(VibrationEffect.EFFECT_CLICK), /* delay= */ 50)
+                .addNext(3, VibrationEffect.get(EFFECT_CLICK), /* delay= */ 50)
                 .addNext(1, VibrationEffect.createOneShot(10, 100), /* delay= */ 50)
                 .addNext(2, composed, /* delay= */ 50)
                 .combine();
@@ -1306,17 +1328,18 @@
         batteryVerifier.verify(mManagerHooks).noteVibratorOff(eq(UID));
 
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(1).isVibrating());
-        assertFalse(mControllers.get(2).isVibrating());
-        assertFalse(mControllers.get(3).isVibrating());
+        assertThat(mControllers.get(1).isVibrating()).isFalse();
+        assertThat(mControllers.get(2).isVibrating()).isFalse();
+        assertThat(mControllers.get(3).isVibrating()).isFalse();
 
-        assertEquals(Arrays.asList(expectedOneShot(10)),
-                mVibratorProviders.get(1).getEffectSegments(vibration.id));
-        assertEquals(expectedAmplitudes(100), mVibratorProviders.get(1).getAmplitudes());
-        assertEquals(Arrays.asList(expectedPrimitive(PRIMITIVE_CLICK, 1, 0)),
-                mVibratorProviders.get(2).getEffectSegments(vibration.id));
-        assertEquals(Arrays.asList(expectedPrebaked(VibrationEffect.EFFECT_CLICK)),
-                mVibratorProviders.get(3).getEffectSegments(vibration.id));
+        assertThat(mVibratorProviders.get(1).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(10)).inOrder();
+        assertThat(mVibratorProviders.get(1).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(100)).inOrder();
+        assertThat(mVibratorProviders.get(2).getEffectSegments(vibration.id))
+                .containsExactly(expectedPrimitive(PRIMITIVE_CLICK, 1, 0)).inOrder();
+        assertThat(mVibratorProviders.get(3).getEffectSegments(vibration.id))
+                .containsExactly(expectedPrebaked(EFFECT_CLICK)).inOrder();
     }
 
     @Test
@@ -1339,10 +1362,10 @@
         when(mManagerHooks.triggerSyncedVibration(eq(vibration.id))).thenReturn(true);
         startThreadAndDispatcher(vibration);
 
-        assertTrue(waitUntil(
+        assertThat(waitUntil(
                 () -> !mVibratorProviders.get(1).getEffectSegments(vibration.id).isEmpty()
                         && !mVibratorProviders.get(2).getEffectSegments(vibration.id).isEmpty(),
-                TEST_TIMEOUT_MILLIS));
+                TEST_TIMEOUT_MILLIS)).isTrue();
         mVibrationConductor.notifySyncedVibrationComplete();
         waitForCompletion();
 
@@ -1353,17 +1376,17 @@
         verifyCallbacksTriggered(vibration, Status.FINISHED);
 
         VibrationEffectSegment expected = expectedPrimitive(PRIMITIVE_CLICK, 1, 100);
-        assertEquals(Arrays.asList(expected),
-                mVibratorProviders.get(1).getEffectSegments(vibration.id));
-        assertEquals(Arrays.asList(expected),
-                mVibratorProviders.get(2).getEffectSegments(vibration.id));
+        assertThat(mVibratorProviders.get(1).getEffectSegments(vibration.id))
+                .containsExactly(expected).inOrder();
+        assertThat(mVibratorProviders.get(2).getEffectSegments(vibration.id))
+                .containsExactly(expected).inOrder();
     }
 
     @Test
     public void vibrate_multipleSynced_callsPrepareAndTriggerCallbacks() {
         int[] vibratorIds = new int[]{1, 2, 3, 4};
         mockVibrators(vibratorIds);
-        mVibratorProviders.get(1).setSupportedEffects(VibrationEffect.EFFECT_CLICK);
+        mVibratorProviders.get(1).setSupportedEffects(EFFECT_CLICK);
         mVibratorProviders.get(4).setCapabilities(IVibrator.CAP_COMPOSE_EFFECTS);
         mVibratorProviders.get(4).setSupportedPrimitives(PRIMITIVE_CLICK);
         when(mManagerHooks.prepareSyncedVibration(anyLong(), any())).thenReturn(true);
@@ -1372,7 +1395,7 @@
                 .addPrimitive(PRIMITIVE_CLICK)
                 .compose();
         CombinedVibration effect = CombinedVibration.startParallel()
-                .addVibrator(1, VibrationEffect.get(VibrationEffect.EFFECT_CLICK))
+                .addVibrator(1, VibrationEffect.get(EFFECT_CLICK))
                 .addVibrator(2, VibrationEffect.createOneShot(10, 100))
                 .addVibrator(3, VibrationEffect.createWaveform(new long[]{10}, new int[]{100}, -1))
                 .addVibrator(4, composed)
@@ -1417,24 +1440,26 @@
         verify(mManagerHooks, never()).triggerSyncedVibration(eq(vibration.id));
         verify(mManagerHooks, never()).cancelSyncedVibration();
 
-        assertEquals(Arrays.asList(expectedOneShot(10)),
-                mVibratorProviders.get(1).getEffectSegments(vibration.id));
-        assertEquals(expectedAmplitudes(100), mVibratorProviders.get(1).getAmplitudes());
-        assertEquals(Arrays.asList(expectedOneShot(5)),
-                mVibratorProviders.get(2).getEffectSegments(vibration.id));
-        assertEquals(expectedAmplitudes(200), mVibratorProviders.get(2).getAmplitudes());
+        assertThat(mVibratorProviders.get(1).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(10)).inOrder();
+        assertThat(mVibratorProviders.get(1).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(100)).inOrder();
+        assertThat(mVibratorProviders.get(2).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(5)).inOrder();
+        assertThat(mVibratorProviders.get(2).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(200)).inOrder();
     }
 
     @Test
     public void vibrate_multipleSyncedTriggerFailed_cancelPreparedVibrationAndSkipSetAmplitude() {
         int[] vibratorIds = new int[]{1, 2};
         mockVibrators(vibratorIds);
-        mVibratorProviders.get(2).setSupportedEffects(VibrationEffect.EFFECT_CLICK);
+        mVibratorProviders.get(2).setSupportedEffects(EFFECT_CLICK);
         when(mManagerHooks.prepareSyncedVibration(anyLong(), any())).thenReturn(true);
 
         CombinedVibration effect = CombinedVibration.startParallel()
                 .addVibrator(1, VibrationEffect.createOneShot(10, 100))
-                .addVibrator(2, VibrationEffect.get(VibrationEffect.EFFECT_CLICK))
+                .addVibrator(2, VibrationEffect.get(EFFECT_CLICK))
                 .combine();
         // We create the HalVibration here to obtain the vibration id and use it to mock the
         // required response when calling triggerSyncedVibration.
@@ -1451,7 +1476,7 @@
         verify(mManagerHooks).prepareSyncedVibration(eq(expectedCap), eq(vibratorIds));
         verify(mManagerHooks).triggerSyncedVibration(eq(vibration.id));
         verify(mManagerHooks).cancelSyncedVibration();
-        assertTrue(mVibratorProviders.get(1).getAmplitudes().isEmpty());
+        assertThat(mVibratorProviders.get(1).getAmplitudes()).isEmpty();
     }
 
     @Test
@@ -1472,11 +1497,11 @@
         HalVibration vibration = startThreadAndDispatcher(effect);
 
         // All vibrators are turned on in parallel.
-        assertTrue(waitUntil(
+        assertThat(waitUntil(
                 () -> mControllers.get(1).isVibrating()
                         && mControllers.get(2).isVibrating()
                         && mControllers.get(3).isVibrating(),
-                TEST_TIMEOUT_MILLIS));
+                TEST_TIMEOUT_MILLIS)).isTrue();
 
         waitForCompletion();
 
@@ -1486,19 +1511,23 @@
         verify(mControllerCallbacks).onComplete(eq(2), eq(vibration.id), anyLong());
         verify(mControllerCallbacks).onComplete(eq(3), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertFalse(mControllers.get(1).isVibrating());
-        assertFalse(mControllers.get(2).isVibrating());
-        assertFalse(mControllers.get(3).isVibrating());
+        assertThat(mControllers.get(1).isVibrating()).isFalse();
+        assertThat(mControllers.get(2).isVibrating()).isFalse();
+        assertThat(mControllers.get(3).isVibrating()).isFalse();
 
-        assertEquals(Arrays.asList(expectedOneShot(25)),
-                mVibratorProviders.get(1).getEffectSegments(vibration.id));
-        assertEquals(Arrays.asList(expectedOneShot(80)),
-                mVibratorProviders.get(2).getEffectSegments(vibration.id));
-        assertEquals(Arrays.asList(expectedOneShot(60)),
-                mVibratorProviders.get(3).getEffectSegments(vibration.id));
-        assertEquals(expectedAmplitudes(1, 2, 3), mVibratorProviders.get(1).getAmplitudes());
-        assertEquals(expectedAmplitudes(4, 5), mVibratorProviders.get(2).getAmplitudes());
-        assertEquals(expectedAmplitudes(6), mVibratorProviders.get(3).getAmplitudes());
+        assertThat(mVibratorProviders.get(1).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(25)).inOrder();
+        assertThat(mVibratorProviders.get(2).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(80)).inOrder();
+        assertThat(mVibratorProviders.get(3).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(60)).inOrder();
+        assertThat(mVibratorProviders.get(1).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(1, 2, 3)).inOrder();
+        assertThat(mVibratorProviders.get(2).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(4, 5)).inOrder();
+        assertThat(mVibratorProviders.get(3).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(6)).inOrder();
+
     }
 
     @Test
@@ -1545,8 +1574,8 @@
                         VibrationEffect.createOneShot(
                                 expectedDuration, VibrationEffect.DEFAULT_AMPLITUDE)));
 
-        startThreadAndDispatcher(vibration);
         long startTime = SystemClock.elapsedRealtime();
+        startThreadAndDispatcher(vibration);
 
         vibration.waitForEnd();
         long vibrationEndTime = SystemClock.elapsedRealtime();
@@ -1616,26 +1645,24 @@
 
         // Allow some delay for thread scheduling and callback triggering.
         int maxDelay = (int) (0.05 * totalDuration); // < 5% of total duration
-        assertTrue("Waveform with perceived delay of " + delay + "ms,"
-                        + " expected less than " + maxDelay + "ms",
-                delay < maxDelay);
+        assertThat(delay).isLessThan(maxDelay);
     }
 
     @LargeTest
     @Test
     public void vibrate_cancelSlowVibrator_cancelIsNotBlockedByVibrationThread() throws Exception {
         FakeVibratorControllerProvider fakeVibrator = mVibratorProviders.get(VIBRATOR_ID);
-        fakeVibrator.setSupportedEffects(VibrationEffect.EFFECT_CLICK);
+        fakeVibrator.setSupportedEffects(EFFECT_CLICK);
 
         long latency = 5_000; // 5s
         fakeVibrator.setOnLatency(latency);
 
-        VibrationEffect effect = VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
+        VibrationEffect effect = VibrationEffect.get(EFFECT_CLICK);
         HalVibration vibration = startThreadAndDispatcher(effect);
 
-        assertTrue(waitUntil(() -> !fakeVibrator.getEffectSegments(vibration.id).isEmpty(),
-                TEST_TIMEOUT_MILLIS));
-        assertTrue(mThread.isRunningVibrationId(vibration.id));
+        assertThat(waitUntil(() -> !fakeVibrator.getEffectSegments(vibration.id).isEmpty(),
+                TEST_TIMEOUT_MILLIS)).isTrue();
+        assertThat(mThread.isRunningVibrationId(vibration.id)).isTrue();
 
         // Run cancel in a separate thread so if VibrationThread.cancel blocks then this test should
         // fail at waitForCompletion(cancellingThread).
@@ -1651,18 +1678,18 @@
         // After the vibrator call ends the vibration is cancelled and the vibrator is turned off.
         waitForCompletion(/* timeout= */ latency + TEST_TIMEOUT_MILLIS);
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BY_USER);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
     }
 
     @Test
     public void vibrate_multiplePredefinedCancel_cancelsVibrationImmediately() throws Exception {
         mockVibrators(1, 2);
-        mVibratorProviders.get(1).setSupportedEffects(VibrationEffect.EFFECT_CLICK);
+        mVibratorProviders.get(1).setSupportedEffects(EFFECT_CLICK);
         mVibratorProviders.get(2).setCapabilities(IVibrator.CAP_COMPOSE_EFFECTS);
         mVibratorProviders.get(2).setSupportedPrimitives(PRIMITIVE_CLICK);
 
         CombinedVibration effect = CombinedVibration.startParallel()
-                .addVibrator(1, VibrationEffect.get(VibrationEffect.EFFECT_CLICK))
+                .addVibrator(1, VibrationEffect.get(EFFECT_CLICK))
                 .addVibrator(2, VibrationEffect.startComposition()
                         .addPrimitive(PRIMITIVE_CLICK, 1f, 100)
                         .addPrimitive(PRIMITIVE_CLICK, 1f, 100)
@@ -1671,8 +1698,9 @@
                 .combine();
         HalVibration vibration = startThreadAndDispatcher(effect);
 
-        assertTrue(waitUntil(() -> mControllers.get(2).isVibrating(), TEST_TIMEOUT_MILLIS));
-        assertTrue(mThread.isRunningVibrationId(vibration.id));
+        assertThat(waitUntil(() -> mControllers.get(2).isVibrating(), TEST_TIMEOUT_MILLIS))
+                .isTrue();
+        assertThat(mThread.isRunningVibrationId(vibration.id)).isTrue();
 
         // Run cancel in a separate thread so if VibrationThread.cancel blocks then this test should
         // fail at waitForCompletion(vibrationThread) if the vibration not cancelled immediately.
@@ -1686,8 +1714,8 @@
         cancellingThread.join();
 
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BY_SCREEN_OFF);
-        assertFalse(mControllers.get(1).isVibrating());
-        assertFalse(mControllers.get(2).isVibrating());
+        assertThat(mControllers.get(1).isVibrating()).isFalse();
+        assertThat(mControllers.get(2).isVibrating()).isFalse();
     }
 
     @Test
@@ -1705,8 +1733,9 @@
                 .combine();
         HalVibration vibration = startThreadAndDispatcher(effect);
 
-        assertTrue(waitUntil(() -> mControllers.get(2).isVibrating(), TEST_TIMEOUT_MILLIS));
-        assertTrue(mThread.isRunningVibrationId(vibration.id));
+        assertThat(waitUntil(() -> mControllers.get(2).isVibrating(), TEST_TIMEOUT_MILLIS))
+                .isTrue();
+        assertThat(mThread.isRunningVibrationId(vibration.id)).isTrue();
 
         // Run cancel in a separate thread so if VibrationThread.cancel blocks then this test should
         // fail at waitForCompletion(vibrationThread) if the vibration not cancelled immediately.
@@ -1720,8 +1749,8 @@
         cancellingThread.join();
 
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BY_SCREEN_OFF);
-        assertFalse(mControllers.get(1).isVibrating());
-        assertFalse(mControllers.get(2).isVibrating());
+        assertThat(mControllers.get(1).isVibrating()).isFalse();
+        assertThat(mControllers.get(2).isVibrating()).isFalse();
     }
 
     @Test
@@ -1737,10 +1766,10 @@
                 .combine();
         HalVibration vibration = startThreadAndDispatcher(effect);
 
-        assertTrue(waitUntil(() -> mControllers.get(1).isVibrating()
+        assertThat(waitUntil(() -> mControllers.get(1).isVibrating()
                         && mControllers.get(2).isVibrating(),
-                TEST_TIMEOUT_MILLIS));
-        assertTrue(mThread.isRunningVibrationId(vibration.id));
+                TEST_TIMEOUT_MILLIS)).isTrue();
+        assertThat(mThread.isRunningVibrationId(vibration.id)).isTrue();
 
         // Run cancel in a separate thread so if VibrationThread.cancel blocks then this test should
         // fail at waitForCompletion(vibrationThread) if the vibration not cancelled immediately.
@@ -1754,8 +1783,8 @@
         cancellingThread.join();
 
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BY_SCREEN_OFF);
-        assertFalse(mControllers.get(1).isVibrating());
-        assertFalse(mControllers.get(2).isVibrating());
+        assertThat(mControllers.get(1).isVibrating()).isFalse();
+        assertThat(mControllers.get(2).isVibrating()).isFalse();
     }
 
     @Test
@@ -1763,17 +1792,18 @@
         VibrationEffect effect = VibrationEffect.createWaveform(new long[]{5}, new int[]{100}, 0);
         HalVibration vibration = startThreadAndDispatcher(effect);
 
-        assertTrue(waitUntil(() -> mControllers.get(VIBRATOR_ID).isVibrating(),
-                TEST_TIMEOUT_MILLIS));
-        assertTrue(mThread.isRunningVibrationId(vibration.id));
+        assertThat(waitUntil(() -> mControllers.get(VIBRATOR_ID).isVibrating(),
+                TEST_TIMEOUT_MILLIS)).isTrue();
+        assertThat(mThread.isRunningVibrationId(vibration.id)).isTrue();
 
         mVibrationConductor.notifyCancelled(
                 new Vibration.EndInfo(Status.CANCELLED_BINDER_DIED), /* immediate= */ false);
         waitForCompletion();
 
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BINDER_DIED);
-        assertFalse(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id).isEmpty());
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .isNotEmpty();
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
     }
 
     @Test
@@ -1790,13 +1820,16 @@
         verifyCallbacksTriggered(vibration, Status.FINISHED);
 
         // Duration extended for 5 + 5 + 5 + 15.
-        assertEquals(Arrays.asList(expectedOneShot(30)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(30)).inOrder();
         List<Float> amplitudes = mVibratorProviders.get(VIBRATOR_ID).getAmplitudes();
-        assertTrue(amplitudes.size() > 3);
-        assertEquals(expectedAmplitudes(60, 120, 240), amplitudes.subList(0, 3));
+        assertThat(amplitudes.size()).isGreaterThan(3);
+        assertThat(amplitudes.subList(0, 3))
+                .containsExactlyElementsIn(expectedAmplitudes(60, 120, 240))
+                .inOrder();
         for (int i = 3; i < amplitudes.size(); i++) {
-            assertTrue(amplitudes.get(i) < amplitudes.get(i - 1));
+            assertWithMessage("For amplitude index %s", i)
+                    .that(amplitudes.get(i)).isLessThan(amplitudes.get(i - 1));
         }
     }
 
@@ -1814,11 +1847,11 @@
         verify(mManagerHooks, never()).onVibrationThreadReleased(anyLong());
 
         // Thread still running ramp down.
-        assertTrue(mThread.isRunningVibrationId(vibration.id));
+        assertThat(mThread.isRunningVibrationId(vibration.id)).isTrue();
 
         // Duration extended for 10 + 10000.
-        assertEquals(Arrays.asList(expectedOneShot(10_010)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(10_010)).inOrder();
 
         // Will stop the ramp down right away.
         mVibrationConductor.notifyCancelled(
@@ -1838,8 +1871,8 @@
 
         VibrationEffect effect = VibrationEffect.createOneShot(10_000, 240);
         HalVibration vibration = startThreadAndDispatcher(effect);
-        assertTrue(waitUntil(() -> mControllers.get(VIBRATOR_ID).isVibrating(),
-                TEST_TIMEOUT_MILLIS));
+        assertThat(waitUntil(() -> mControllers.get(VIBRATOR_ID).isVibrating(),
+                TEST_TIMEOUT_MILLIS)).isTrue();
         mVibrationConductor.notifyCancelled(
                 new Vibration.EndInfo(Status.CANCELLED_BY_USER), /* immediate= */ false);
         waitForCompletion();
@@ -1847,12 +1880,13 @@
         verifyCallbacksTriggered(vibration, Status.CANCELLED_BY_USER);
 
         // Duration extended for 10000 + 15.
-        assertEquals(Arrays.asList(expectedOneShot(10_015)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(10_015)).inOrder();
         List<Float> amplitudes = mVibratorProviders.get(VIBRATOR_ID).getAmplitudes();
-        assertTrue(amplitudes.size() > 1);
+        assertThat(amplitudes.size()).isGreaterThan(1);
         for (int i = 1; i < amplitudes.size(); i++) {
-            assertTrue(amplitudes.get(i) < amplitudes.get(i - 1));
+            assertWithMessage("For amplitude index %s", i)
+                    .that(amplitudes.get(i)).isLessThan(amplitudes.get(i - 1));
         }
     }
 
@@ -1860,18 +1894,18 @@
     public void vibrate_predefinedWithRampDown_doesNotAddRampDown() {
         when(mVibrationConfigMock.getRampDownDurationMs()).thenReturn(15);
         mVibratorProviders.get(VIBRATOR_ID).setCapabilities(IVibrator.CAP_AMPLITUDE_CONTROL);
-        mVibratorProviders.get(VIBRATOR_ID).setSupportedEffects(VibrationEffect.EFFECT_CLICK);
+        mVibratorProviders.get(VIBRATOR_ID).setSupportedEffects(EFFECT_CLICK);
 
-        VibrationEffect effect = VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
+        VibrationEffect effect = VibrationEffect.get(EFFECT_CLICK);
         HalVibration vibration = startThreadAndDispatcher(effect);
         waitForCompletion();
 
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
 
-        assertEquals(Arrays.asList(expectedPrebaked(VibrationEffect.EFFECT_CLICK)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
-        assertTrue(mVibratorProviders.get(VIBRATOR_ID).getAmplitudes().isEmpty());
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(expectedPrebaked(EFFECT_CLICK)).inOrder();
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getAmplitudes()).isEmpty();
     }
 
     @Test
@@ -1888,8 +1922,7 @@
         verifyCallbacksTriggered(vibration, Status.FINISHED);
 
         assertThat(mVibratorProviders.get(VIBRATOR_ID).getVendorEffects(vibration.id))
-                .containsExactly(effect)
-                .inOrder();
+                .containsExactly(effect).inOrder();
         assertThat(mVibratorProviders.get(VIBRATOR_ID).getAmplitudes()).isEmpty();
     }
 
@@ -1909,9 +1942,9 @@
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
 
-        assertEquals(Arrays.asList(expectedPrimitive(PRIMITIVE_CLICK, 1, 0)),
-                mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id));
-        assertTrue(mVibratorProviders.get(VIBRATOR_ID).getAmplitudes().isEmpty());
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getEffectSegments(vibration.id))
+                .containsExactly(expectedPrimitive(PRIMITIVE_CLICK, 1, 0)).inOrder();
+        assertThat(mVibratorProviders.get(VIBRATOR_ID).getAmplitudes()).isEmpty();
     }
 
     @Test
@@ -1936,30 +1969,29 @@
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration.id), anyLong());
         verifyCallbacksTriggered(vibration, Status.FINISHED);
 
-        assertEquals(Arrays.asList(expectedRamp(0, 1, 150, 150, 1)),
-                fakeVibrator.getEffectSegments(vibration.id));
-        assertTrue(fakeVibrator.getAmplitudes().isEmpty());
+        assertThat(fakeVibrator.getEffectSegments(vibration.id))
+                .containsExactly(expectedRamp(0, 1, 150, 150, 1)).inOrder();
+        assertThat(fakeVibrator.getAmplitudes()).isEmpty();
     }
 
     @Test
     public void vibrate_multipleVibrations_withCancel() throws Exception {
-        mVibratorProviders.get(VIBRATOR_ID).setSupportedEffects(
-                VibrationEffect.EFFECT_CLICK, VibrationEffect.EFFECT_TICK);
+        mVibratorProviders.get(VIBRATOR_ID).setSupportedEffects(EFFECT_CLICK, EFFECT_TICK);
         mVibratorProviders.get(VIBRATOR_ID).setSupportedPrimitives(PRIMITIVE_CLICK);
         mVibratorProviders.get(VIBRATOR_ID).setCapabilities(IVibrator.CAP_AMPLITUDE_CONTROL,
                 IVibrator.CAP_COMPOSE_EFFECTS);
 
         // A simple effect, followed by a repeating effect that gets cancelled, followed by another
         // simple effect.
-        VibrationEffect effect1 = VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
+        VibrationEffect effect1 = VibrationEffect.get(EFFECT_CLICK);
         VibrationEffect effect2 = VibrationEffect.startComposition()
-                .repeatEffectIndefinitely(VibrationEffect.get(VibrationEffect.EFFECT_TICK))
+                .repeatEffectIndefinitely(VibrationEffect.get(EFFECT_TICK))
                 .compose();
         VibrationEffect effect3 = VibrationEffect.startComposition()
                 .addPrimitive(PRIMITIVE_CLICK)
                 .compose();
         VibrationEffect effect4 = VibrationEffect.createOneShot(8000, 100);
-        VibrationEffect effect5 = VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
+        VibrationEffect effect5 = VibrationEffect.get(EFFECT_CLICK);
 
         HalVibration vibration1 = startThreadAndDispatcher(effect1);
         waitForCompletion();
@@ -1987,14 +2019,14 @@
         waitForCompletion();
 
         FakeVibratorControllerProvider fakeVibrator = mVibratorProviders.get(VIBRATOR_ID);
-        assertFalse(mControllers.get(VIBRATOR_ID).isVibrating());
+        assertThat(mControllers.get(VIBRATOR_ID).isVibrating()).isFalse();
 
         // Effect1
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration1.id), anyLong());
         verifyCallbacksTriggered(vibration1, Status.FINISHED);
 
-        assertEquals(Arrays.asList(expectedPrebaked(VibrationEffect.EFFECT_CLICK)),
-                fakeVibrator.getEffectSegments(vibration1.id));
+        assertThat(fakeVibrator.getEffectSegments(vibration1.id))
+                .containsExactly(expectedPrebaked(EFFECT_CLICK)).inOrder();
 
         // Effect2: repeating, cancelled.
         verify(mControllerCallbacks, atLeast(2))
@@ -2005,24 +2037,24 @@
         // all elements are the same segment.
         List<VibrationEffectSegment> actualSegments2 =
                 fakeVibrator.getEffectSegments(vibration2.id);
-        assertTrue(actualSegments2.size() + " > 2", actualSegments2.size() > 2);
+        assertThat(actualSegments2.size()).isGreaterThan(2);
         for (VibrationEffectSegment segment : actualSegments2) {
-            assertEquals(expectedPrebaked(VibrationEffect.EFFECT_TICK), segment);
+            assertThat(segment).isEqualTo(expectedPrebaked(EFFECT_TICK));
         }
 
         // Effect3
         verify(mControllerCallbacks).onComplete(eq(VIBRATOR_ID), eq(vibration3.id), anyLong());
         verifyCallbacksTriggered(vibration3, Status.FINISHED);
-        assertEquals(Arrays.asList(expectedPrimitive(PRIMITIVE_CLICK, 1, 0)),
-                fakeVibrator.getEffectSegments(vibration3.id));
+        assertThat(fakeVibrator.getEffectSegments(vibration3.id))
+                .containsExactly(expectedPrimitive(PRIMITIVE_CLICK, 1, 0)).inOrder();
 
         // Effect4: cancelled quickly.
         verifyCallbacksTriggered(vibration4, Status.CANCELLED_BY_SCREEN_OFF);
-        assertTrue("Tested duration=" + duration4, duration4 < 2000);
+        assertThat(duration4).isLessThan(2000);
 
         // Effect5: played normally after effect4, which may or may not have played.
-        assertEquals(Arrays.asList(expectedPrebaked(VibrationEffect.EFFECT_CLICK)),
-                fakeVibrator.getEffectSegments(vibration5.id));
+        assertThat(fakeVibrator.getEffectSegments(vibration5.id))
+                .containsExactly(expectedPrebaked(EFFECT_CLICK)).inOrder();
     }
 
     @Test
@@ -2031,16 +2063,13 @@
         mVibratorProviders.get(1).setCapabilities(IVibrator.CAP_AMPLITUDE_CONTROL);
         mVibratorProviders.get(2).setCapabilities(IVibrator.CAP_COMPOSE_EFFECTS);
         mVibratorProviders.get(2).setSupportedPrimitives(PRIMITIVE_CLICK);
-        mVibratorProviders.get(3).setSupportedEffects(VibrationEffect.EFFECT_CLICK);
+        mVibratorProviders.get(3).setSupportedEffects(EFFECT_CLICK);
 
         CombinedVibration effect = CombinedVibration.startSequential()
-                .addNext(3,
-                        VibrationEffect.get(VibrationEffect.EFFECT_CLICK),
-                        /* delay= */ TEST_TIMEOUT_MILLIS)
+                .addNext(3, VibrationEffect.get(EFFECT_CLICK), /* delay= */ TEST_TIMEOUT_MILLIS)
                 .addNext(1,
                         VibrationEffect.createWaveform(
-                                new long[] {TEST_TIMEOUT_MILLIS, TEST_TIMEOUT_MILLIS},
-                                /* repeat= */ -1),
+                                new long[] {TEST_TIMEOUT_MILLIS, TEST_TIMEOUT_MILLIS}, -1),
                         /* delay= */ TEST_TIMEOUT_MILLIS)
                 .addNext(2,
                         VibrationEffect.startComposition()
@@ -2055,20 +2084,22 @@
 
         // Vibrating state remains ON until session resets it.
         verifyCallbacksTriggered(vibration, Status.FINISHED);
-        assertTrue(mControllers.get(1).isVibrating());
-        assertTrue(mControllers.get(2).isVibrating());
-        assertTrue(mControllers.get(3).isVibrating());
+        assertThat(mControllers.get(1).isVibrating()).isTrue();
+        assertThat(mControllers.get(2).isVibrating()).isTrue();
+        assertThat(mControllers.get(3).isVibrating()).isTrue();
 
-        assertEquals(0, mVibratorProviders.get(1).getOffCount());
-        assertEquals(0, mVibratorProviders.get(2).getOffCount());
-        assertEquals(0, mVibratorProviders.get(3).getOffCount());
-        assertEquals(Arrays.asList(expectedOneShot(TEST_TIMEOUT_MILLIS)),
-                mVibratorProviders.get(1).getEffectSegments(vibration.id));
-        assertEquals(expectedAmplitudes(255), mVibratorProviders.get(1).getAmplitudes());
-        assertEquals(Arrays.asList(expectedPrimitive(PRIMITIVE_CLICK, 1, TEST_TIMEOUT_MILLIS)),
-                mVibratorProviders.get(2).getEffectSegments(vibration.id));
-        assertEquals(Arrays.asList(expectedPrebaked(VibrationEffect.EFFECT_CLICK)),
-                mVibratorProviders.get(3).getEffectSegments(vibration.id));
+        assertThat(mVibratorProviders.get(1).getOffCount()).isEqualTo(0);
+        assertThat(mVibratorProviders.get(2).getOffCount()).isEqualTo(0);
+        assertThat(mVibratorProviders.get(3).getOffCount()).isEqualTo(0);
+        assertThat(mVibratorProviders.get(1).getEffectSegments(vibration.id))
+                .containsExactly(expectedOneShot(TEST_TIMEOUT_MILLIS)).inOrder();
+        assertThat(mVibratorProviders.get(1).getAmplitudes())
+                .containsExactlyElementsIn(expectedAmplitudes(255)).inOrder();
+        assertThat(mVibratorProviders.get(2).getEffectSegments(vibration.id))
+                .containsExactly(expectedPrimitive(PRIMITIVE_CLICK, 1, TEST_TIMEOUT_MILLIS))
+                .inOrder();
+        assertThat(mVibratorProviders.get(3).getEffectSegments(vibration.id))
+                .containsExactly(expectedPrebaked(EFFECT_CLICK)).inOrder();
     }
 
     private void mockVibrators(int... vibratorIds) {
@@ -2122,7 +2153,7 @@
         mVibrationConductor = new VibrationStepConductor(vib, isInSession, mVibrationSettings,
                 deviceAdapter, mVibrationScaler, mStatsLoggerMock, requestVibrationParamsFuture,
                 mManagerHooks);
-        assertTrue(mThread.runVibrationOnVibrationThread(mVibrationConductor));
+        assertThat(mThread.runVibrationOnVibrationThread(mVibrationConductor)).isTrue();
         return mVibrationConductor.getVibration();
     }
 
@@ -2142,8 +2173,8 @@
     }
 
     private void waitForCompletion(long timeout) {
-        assertTrue("Timed out waiting for VibrationThread to become idle",
-                mThread.waitForThreadIdle(timeout));
+        assertWithMessage("Timed out waiting for VibrationThread to become idle")
+                .that(mThread.waitForThreadIdle(timeout)).isTrue();
         mTestLooper.dispatchAll();  // Flush callbacks
     }