Revert "Fix NPVCTest"
This reverts commit aae308045f43bb18fd2c80fe9b10d52a9d51649e.
Reason for revert: DroidMonitor: Potential culprit for Bug b/341339424 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.
Change-Id: I86e1024a97f22780196c60ef7fe9d51e839ad783
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index 32e383a..6bb30c7 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -253,7 +253,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Optional;
-import java.util.Set;
import java.util.function.Consumer;
import javax.inject.Inject;
@@ -450,9 +449,6 @@
private final ShadeHeadsUpTrackerImpl mShadeHeadsUpTracker = new ShadeHeadsUpTrackerImpl();
private final ShadeFoldAnimatorImpl mShadeFoldAnimator = new ShadeFoldAnimatorImpl();
- @VisibleForTesting
- Set<Animator> mTestSetOfAnimatorsUsed;
-
private boolean mShowIconsWhenExpanded;
private int mIndicationBottomPadding;
private int mAmbientIndicationBottomPadding;
@@ -4153,8 +4149,6 @@
}
private void setAnimator(ValueAnimator animator) {
- // TODO(b/341163515): Should we clean up the old animator?
- registerAnimatorForTest(animator);
mHeightAnimator = animator;
if (animator == null && mPanelUpdateWhenAnimatorEnds) {
mPanelUpdateWhenAnimatorEnds = false;
@@ -4199,7 +4193,6 @@
private ValueAnimator createHeightAnimator(float targetHeight, float overshootAmount) {
float startExpansion = mOverExpansion;
ValueAnimator animator = ValueAnimator.ofFloat(mExpandedHeight, targetHeight);
- registerAnimatorForTest(animator);
animator.addUpdateListener(
animation -> {
if (overshootAmount > 0.0f
@@ -4217,12 +4210,6 @@
return animator;
}
- private void registerAnimatorForTest(Animator animator) {
- if (mTestSetOfAnimatorsUsed != null) {
- mTestSetOfAnimatorsUsed.add(animator);
- }
- }
-
/** Update the visibility of {@link NotificationPanelView} if necessary. */
private void updateVisibility() {
mView.setVisibility(shouldPanelBeVisible() ? VISIBLE : INVISIBLE);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java
index 4d32cc4..8e32907 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java
@@ -40,7 +40,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import android.animation.Animator;
import android.annotation.IdRes;
import android.content.ContentResolver;
import android.content.res.Configuration;
@@ -208,15 +207,12 @@
import org.junit.After;
import org.junit.Before;
-import org.junit.Rule;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnit;
-import org.mockito.junit.MockitoRule;
+import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;
-import java.util.HashSet;
import java.util.List;
import java.util.Optional;
@@ -391,11 +387,9 @@
protected FragmentHostManager.FragmentListener mFragmentListener;
- @Rule(order = 200)
- public MockitoRule mMockitoRule = MockitoJUnit.rule();
-
@Before
public void setup() {
+ MockitoAnnotations.initMocks(this);
mFeatureFlags.set(Flags.LOCKSCREEN_ENABLE_LANDSCAPE, false);
mFeatureFlags.set(Flags.QS_USER_DETAIL_SHORTCUT, false);
@@ -767,9 +761,6 @@
@Override
public void onOpenStarted() {}
});
- // Create a set to which the class will add all animators used, so that we can
- // verify that they are all stopped.
- mNotificationPanelViewController.mTestSetOfAnimatorsUsed = new HashSet<>();
ArgumentCaptor<View.OnAttachStateChangeListener> onAttachStateChangeListenerArgumentCaptor =
ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class);
verify(mView, atLeast(1)).addOnAttachStateChangeListener(
@@ -831,20 +822,13 @@
@After
public void tearDown() {
- List<Animator> leakedAnimators = null;
if (mNotificationPanelViewController != null) {
mNotificationPanelViewController.mBottomAreaShadeAlphaAnimator.cancel();
mNotificationPanelViewController.cancelHeightAnimator();
- leakedAnimators = mNotificationPanelViewController.mTestSetOfAnimatorsUsed.stream()
- .filter(Animator::isRunning).toList();
- mNotificationPanelViewController.mTestSetOfAnimatorsUsed.forEach(Animator::cancel);
}
if (mMainHandler != null) {
mMainHandler.removeCallbacksAndMessages(null);
}
- if (leakedAnimators != null) {
- assertThat(leakedAnimators).isEmpty();
- }
}
protected void setBottomPadding(int stackBottom, int lockIconPadding, int indicationPadding,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java
index 6536405..e1cdda4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java
@@ -705,7 +705,6 @@
}
@Test
- @Ignore("b/341163515 - fails to clean up animators correctly")
public void testSwipeWhileLocked_notifiesKeyguardState() {
mStatusBarStateController.setState(KEYGUARD);