diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java index 823155b0d7e62..b8f2cab3019e5 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java @@ -81,7 +81,7 @@ import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.util.time.FakeSystemClock; import org.junit.Before; -import org.junit.ClassRule; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; @@ -136,8 +136,8 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { private StatusBarWindowStateController mStatusBarWindowStateController; @Mock private KeyguardUpdateMonitor mKeyguardUpdateMonitor; - @ClassRule - public static AnimatorTestRule mAnimatorTestRule = new AnimatorTestRule(); + @Rule + public final AnimatorTestRule mAnimatorTestRule = new AnimatorTestRule(); private List mStatusBarWindowStateListeners = new ArrayList<>(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java index ef39ff8ed521a..79feb417a0629 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java @@ -82,7 +82,7 @@ import com.android.systemui.statusbar.phone.LightBarController; import org.junit.After; import org.junit.Before; -import org.junit.ClassRule; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; @@ -111,8 +111,8 @@ public class RemoteInputViewTest extends SysuiTestCase { private BlockingQueueIntentReceiver mReceiver; private final UiEventLoggerFake mUiEventLoggerFake = new UiEventLoggerFake(); - @ClassRule - public static AnimatorTestRule mAnimatorTestRule = new AnimatorTestRule(); + @Rule + public final AnimatorTestRule mAnimatorTestRule = new AnimatorTestRule(); @Before public void setUp() throws Exception { diff --git a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java index 2828eb2a7b561..21e4f5ad589a3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java @@ -39,7 +39,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import android.animation.AnimatorTestRule; import android.app.KeyguardManager; import android.content.res.Configuration; import android.media.AudioManager; @@ -86,8 +85,6 @@ import java.util.function.Predicate; @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper public class VolumeDialogImplTest extends SysuiTestCase { - private static final AnimatorTestRule sAnimatorTestRule = new AnimatorTestRule(); - VolumeDialogImpl mDialog; View mActiveRinger; View mDrawerContainer; @@ -753,7 +750,6 @@ public class VolumeDialogImplTest extends SysuiTestCase { public void teardown() { cleanUp(mDialog); setOrientation(mOriginalOrientation); - sAnimatorTestRule.advanceTimeBy(mLongestHideShowAnimationDuration); mTestableLooper.moveTimeForward(mLongestHideShowAnimationDuration); mTestableLooper.processAllMessages(); reset(mPostureController); diff --git a/packages/SystemUI/tests/utils/src/android/animation/AnimatorTestRule.java b/packages/SystemUI/tests/utils/src/android/animation/AnimatorTestRule.java index 19c68e86e5dc0..41dbc147dfc52 100644 --- a/packages/SystemUI/tests/utils/src/android/animation/AnimatorTestRule.java +++ b/packages/SystemUI/tests/utils/src/android/animation/AnimatorTestRule.java @@ -49,7 +49,7 @@ import java.util.function.Consumer; * public class SampleAnimatorTest { * * {@literal @}Rule - * public AnimatorTestRule sAnimatorTestRule = new AnimatorTestRule(); + * public final AnimatorTestRule mAnimatorTestRule = new AnimatorTestRule(); * * {@literal @}UiThreadTest * {@literal @}Test @@ -58,7 +58,7 @@ import java.util.function.Consumer; * animator.setDuration(1000L); * assertThat(animator.getAnimatedValue(), is(0)); * animator.start(); - * sAnimatorTestRule.advanceTimeBy(500L); + * mAnimatorTestRule.advanceTimeBy(500L); * assertThat(animator.getAnimatedValue(), is(500)); * } * }