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

Commit 006a03aa authored by Mady Mellor's avatar Mady Mellor
Browse files

Ensure Bubbles get removed at the end of the test

- Fix an NPE found when removing bubbles at the end of the test
- Remove all the bubbles at the end of the test
- Remove the @Flaky annotation

Bug: 259961387
Test: run the tests in gradle and check the ahprof file
Change-Id: Ic7eff0c3cd1dd78c25c9e80479134f2e0ce2cbd7
parent 1c9f5069
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2923,8 +2923,10 @@ public class BubbleStackView extends FrameLayout
                    .withEndActions(() -> {
                        View child = mManageMenu.getChildAt(0);
                        child.requestAccessibilityFocus();
                        // Update the AV's obscured touchable region for the new visibility state.
                        if (mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) {
                            // Update the AV's obscured touchable region for the new state.
                            mExpandedBubble.getExpandedView().updateObscuredTouchableRegion();
                        }
                    })
                    .start();

+11 −2
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ import android.view.View;
import android.view.ViewTreeObserver;
import android.view.WindowManager;

import androidx.test.filters.FlakyTest;
import androidx.test.filters.SmallTest;

import com.android.internal.colorextraction.ColorExtractor;
@@ -142,6 +141,7 @@ import com.android.wm.shell.sysui.ShellCommandHandler;
import com.android.wm.shell.sysui.ShellController;
import com.android.wm.shell.sysui.ShellInit;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -152,13 +152,13 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;

@FlakyTest
@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper(setAsMainLooper = true)
@@ -411,6 +411,15 @@ public class BubblesTest extends SysuiTestCase {
                .addCallback(mKeyguardStateControllerCallbackCaptor.capture());
    }

    @After
    public void tearDown() {
        ArrayList<Bubble> bubbles = new ArrayList<>(mBubbleData.getBubbles());
        for (int i = 0; i < bubbles.size(); i++) {
            mBubbleController.removeBubble(bubbles.get(i).getKey(),
                    Bubbles.DISMISS_NO_LONGER_BUBBLE);
        }
    }

    @Test
    public void dreamingHidesBubbles() throws RemoteException {
        mBubbleController.updateBubble(mBubbleEntry);