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

Commit a894b2e2 authored by Steve Elliott's avatar Steve Elliott
Browse files

Remove dead code from icon container

Flag: EXEMPT no functional changes
Test: make
Change-Id: I5a20074d8ebb697a7432b578f28210e3b5d2c342
parent e5e7a9b0
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -42,15 +42,14 @@ import org.mockito.Mockito.`when` as whenever
@RunWithLooper
class NotificationIconContainerTest : SysuiTestCase() {

    @get:Rule
    val setFlagsRule = SetFlagsRule()
    @get:Rule val setFlagsRule = SetFlagsRule()
    private val iconContainer = NotificationIconContainer(context, /* attrs= */ null)

    @Test
    fun calculateWidthFor_zeroIcons_widthIsZero() {
        assertEquals(
            /* expected= */ iconContainer.calculateWidthFor(/* numIcons= */ 0f),
            /* actual= */ 0f
            /* actual= */ 0f,
        )
    }

@@ -62,7 +61,7 @@ class NotificationIconContainerTest : SysuiTestCase() {

        assertEquals(
            /* expected= */ iconContainer.calculateWidthFor(/* numIcons= */ 1f),
            /* actual= */ 30f
            /* actual= */ 30f,
        )
    }

@@ -74,7 +73,7 @@ class NotificationIconContainerTest : SysuiTestCase() {

        assertEquals(
            /* expected= */ iconContainer.calculateWidthFor(/* numIcons= */ 4f),
            /* actual= */ 60f
            /* actual= */ 60f,
        )
    }

@@ -207,7 +206,6 @@ class NotificationIconContainerTest : SysuiTestCase() {
        assertTrue(iconContainer.areIconsOverflowing())
    }


    @Test
    @DisableFlags(Flags.FLAG_PHYSICAL_NOTIFICATION_MOVEMENT)
    fun calculateIconXTranslations_givenWidthNotEnoughForFourIcons_atCorrectXWithOverflowDotNonPhysical() {
@@ -240,9 +238,8 @@ class NotificationIconContainerTest : SysuiTestCase() {
        val forceOverflow =
            iconContainer.shouldForceOverflow(
                /* i= */ 10,
                /* speedBumpIndex= */ 11,
                /* iconAppearAmount= */ 0.1f,
                /* maxVisibleIcons= */ 5
                /* maxVisibleIcons= */ 5,
            )
        assertTrue(forceOverflow)
    }
@@ -252,9 +249,8 @@ class NotificationIconContainerTest : SysuiTestCase() {
        val forceOverflow =
            iconContainer.shouldForceOverflow(
                /* i= */ 0,
                /* speedBumpIndex= */ 11,
                /* iconAppearAmount= */ 0f,
                /* maxVisibleIcons= */ 5
                /* maxVisibleIcons= */ 5,
            )
        assertFalse(forceOverflow)
    }
+3 −19
Original line number Diff line number Diff line
@@ -132,17 +132,6 @@ public class NotificationIconContainer extends ViewGroup {
        }
    }.setDuration(CONTENT_FADE_DURATION);

    // TODO(b/278765923): Replace these with domain-agnostic state
    /* Maximum number of icons on AOD when also showing overflow dot. */
    private int mMaxIconsOnAod;
    /* Maximum number of icons in short shelf on lockscreen when also showing overflow dot. */
    private int mMaxIconsOnLockscreen;
    /* Maximum number of icons in the status bar when also showing overflow dot. */
    private int mMaxStaticIcons;
    private boolean mDozing;
    private boolean mOnLockScreen;
    private int mSpeedBumpIndex = -1;

    private int mMaxIcons = Integer.MAX_VALUE;
    private boolean mOverrideIconColor;
    private boolean mUseInverseOverrideIconColor;
@@ -184,10 +173,6 @@ public class NotificationIconContainer extends ViewGroup {
    }

    private void initResources() {
        mMaxIconsOnAod = getResources().getInteger(R.integer.max_notif_icons_on_aod);
        mMaxIconsOnLockscreen = getResources().getInteger(R.integer.max_notif_icons_on_lockscreen);
        mMaxStaticIcons = getResources().getInteger(R.integer.max_notif_static_icons);

        mDotPadding = getResources().getDimensionPixelSize(R.dimen.overflow_icon_dot_padding);
        int staticDotRadius = getResources().getDimensionPixelSize(R.dimen.overflow_dot_radius);
        mStaticDotDiameter = 2 * staticDotRadius;
@@ -463,8 +448,7 @@ public class NotificationIconContainer extends ViewGroup {
    }

    @VisibleForTesting
    boolean shouldForceOverflow(int i, int speedBumpIndex, float iconAppearAmount,
            int maxVisibleIcons) {
    boolean shouldForceOverflow(int i, float iconAppearAmount, int maxVisibleIcons) {
        return i >= maxVisibleIcons && iconAppearAmount > 0.0f;
    }

@@ -512,8 +496,8 @@ public class NotificationIconContainer extends ViewGroup {
                    ? StatusBarIconView.STATE_HIDDEN
                    : StatusBarIconView.STATE_ICON;

            final boolean forceOverflow = shouldForceOverflow(i, mSpeedBumpIndex,
                    iconState.iconAppearAmount, maxVisibleIcons);
            final boolean forceOverflow =
                    shouldForceOverflow(i, iconState.iconAppearAmount, maxVisibleIcons);
            final boolean isOverflowing = forceOverflow || isOverflowing(
                    /* isLastChild= */ i == childCount - 1, translationX, layoutRight, mIconSize);