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

Commit e3f5f579 authored by Ahmad Khalil's avatar Ahmad Khalil
Browse files

Fix flaky test case:...

Fix flaky test case: com.android.server.vibrator.VibratorManagerServiceTest#vibrate_withIntensitySettings_appliesSettingsToScaleVibrations

We're canceling all vibrations at the end of test, because there are cases where the vibrator clean-up step (TurnOffVibratorStep) is taking longer than the clean-up timeout in the teardown.

Fix: 292208387
Test: atest VibratorManagerServiceTest
Change-Id: Ic5f868ab6e99e6fc35d5232c7cb3234cd3271bd5
parent a7d8d2c6
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -509,7 +509,7 @@ public class VibratorManagerServiceTest {
        verify(listeners[0]).onVibrating(eq(true));
        verify(listeners[1]).onVibrating(eq(true));
        verify(listeners[2], never()).onVibrating(eq(true));
        cancelVibrate(service);
        cancelVibrate(service); // Clean up long-ish effect.
    }

    @Test
@@ -1333,6 +1333,8 @@ public class VibratorManagerServiceTest {
        // Alarm vibration will be scaled with SCALE_NONE.
        assertEquals(1f,
                ((PrimitiveSegment) fakeVibrator.getAllEffectSegments().get(2)).getScale(), 1e-5);

        cancelVibrate(service); // Clean up long-ish effect.
    }

    @Test
@@ -1368,7 +1370,7 @@ public class VibratorManagerServiceTest {

        // Vibration is not stopped nearly after updating service.
        assertFalse(waitUntil(s -> !s.isVibrating(1), service, 50));
        cancelVibrate(service);
        cancelVibrate(service); // Clean up long effect.
    }

    @Test