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

Commit 6fcbed0c authored by Liana Kazanova's avatar Liana Kazanova Committed by Android (Google) Code Review
Browse files

Revert "Fix NPVCTest"

This reverts commit aae30804.

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
parent aae30804
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -253,7 +253,6 @@ import java.io.PrintWriter;
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 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    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 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    }

    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 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    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 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        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);
+2 −18
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import static org.mockito.Mockito.spy;
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 kotlinx.coroutines.test.TestScope;

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 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {

    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 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
                    @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 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {

    @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,
+0 −1
Original line number Diff line number Diff line
@@ -705,7 +705,6 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo
    }

    @Test
    @Ignore("b/341163515 - fails to clean up animators correctly")
    public void testSwipeWhileLocked_notifiesKeyguardState() {
        mStatusBarStateController.setState(KEYGUARD);