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

Commit 1f32e86b authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Clean up NotificationChildrenContainer

Removed some dead code, fixed some minor IDE warnings and removed a
method with a "TODO - do something" that did nothing for 9 years :)

Flag: EXEMPT minor cleanup
Test: builds
Bug: NA
Change-Id: I6da03a50fb1f3d3b6f5a8d7c01981f6aea3eb1ae
parent 429284a6
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -1202,15 +1202,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
    }

    /**
     * Prepares expansion changed.
     */
    public void prepareExpansionChanged() {
        if (mIsSummaryWithChildren) {
            mChildrenContainer.prepareExpansionChanged();
        }
    }

    /**
     * Starts child animations.
     */
@@ -1525,7 +1516,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        // Let's update our childrencontainer. This is intentionally not guarded with
        // mIsSummaryWithChildren since we might have had children but not anymore.
        if (mChildrenContainer != null) {
            mChildrenContainer.reInflateViews(mExpandClickListener, mEntry.getSbn());
            mChildrenContainer.reInflateViews(mExpandClickListener);
        }
        if (mGuts != null) {
            NotificationGuts oldGuts = mGuts;
+7 −45
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ public class NotificationChildrenContainer extends ViewGroup
    static final int NUMBER_OF_CHILDREN_WHEN_SYSTEM_EXPANDED = 5;
    public static final int NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED = 8;
    private static final AnimationProperties ALPHA_FADE_IN = new AnimationProperties() {
        private AnimationFilter mAnimationFilter = new AnimationFilter().animateAlpha();
        private final AnimationFilter mAnimationFilter = new AnimationFilter().animateAlpha();

        @Override
        public AnimationFilter getAnimationFilter() {
@@ -140,7 +140,7 @@ public class NotificationChildrenContainer extends ViewGroup
    private float mHeaderVisibleAmount = 1.0f;
    private int mUntruncatedChildCount;
    private boolean mContainingNotificationIsFaded = false;
    private RoundableState mRoundableState;
    private final RoundableState mRoundableState;
    private int mMinSingleLineHeight;

    private NotificationChildrenContainerLogger mLogger;
@@ -448,7 +448,7 @@ public class NotificationChildrenContainer extends ViewGroup
        }
        mGroupHeaderWrapper.setExpanded(mChildrenExpanded);
        mGroupHeaderWrapper.onContentUpdated(mContainingNotification);
        recreateLowPriorityHeader(builder, isConversation);
        recreateLowPriorityHeader(builder);
        updateHeaderVisibility(false /* animate */);
        updateChildrenAppearance();
        Trace.endSection();
@@ -561,7 +561,7 @@ public class NotificationChildrenContainer extends ViewGroup
     * @param builder a builder to reuse. Otherwise the builder will be recovered.
     */
    @VisibleForTesting
    void recreateLowPriorityHeader(Notification.Builder builder, boolean isConversation) {
    void recreateLowPriorityHeader(Notification.Builder builder) {
        AsyncGroupHeaderViewInflation.assertInLegacyMode();
        RemoteViews header;
        StatusBarNotification notification = mContainingNotification.getEntry().getSbn();
@@ -909,34 +909,6 @@ public class NotificationChildrenContainer extends ViewGroup
        return viewState;
    }

    /**
     * When moving into the bottom stack, the bottom visible child in an expanded group adjusts its
     * height, children in the group after this are gone.
     *
     * @param child        the child who's height to adjust.
     * @param parentHeight the height of the parent.
     * @param childState   the state to update.
     * @param yPosition    the yPosition of the view.
     * @return true if children after this one should be hidden.
     */
    private boolean updateChildStateForExpandedGroup(
            ExpandableNotificationRow child,
            int parentHeight,
            ExpandableViewState childState,
            int yPosition) {
        final int top = yPosition + child.getClipTopAmount();
        final int intrinsicHeight = child.getIntrinsicHeight();
        final int bottom = top + intrinsicHeight;
        int newHeight = intrinsicHeight;
        if (bottom >= parentHeight) {
            // Child is either clipped or gone
            newHeight = Math.max((parentHeight - top), 0);
        }
        childState.hidden = newHeight == 0;
        childState.height = newHeight;
        return childState.height != intrinsicHeight && !childState.hidden;
    }

    @VisibleForTesting
    int getMaxAllowedVisibleChildren() {
        return getMaxAllowedVisibleChildren(false /* likeCollapsed */);
@@ -1040,7 +1012,7 @@ public class NotificationChildrenContainer extends ViewGroup
    }

    @Override
    protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
    protected boolean drawChild(@NonNull Canvas canvas, View child, long drawingTime) {
        boolean isCanvasChanged = false;

        Path clipPath = mChildClipPath;
@@ -1092,16 +1064,6 @@ public class NotificationChildrenContainer extends ViewGroup
        }
    }


    /**
     * This is called when the children expansion has changed and positions the children properly
     * for an appear animation.
     */
    public void prepareExpansionChanged() {
        // TODO: do something that makes sense, like placing the invisible views correctly
        return;
    }

    /**
     * Animate to a given state.
     */
@@ -1508,7 +1470,7 @@ public class NotificationChildrenContainer extends ViewGroup
        return mIsMinimized && !mContainingNotification.isExpanded();
    }

    public void reInflateViews(OnClickListener listener, StatusBarNotification notification) {
    public void reInflateViews(OnClickListener listener) {
        if (!AsyncGroupHeaderViewInflation.isEnabled()) {
            // When Async header inflation is enabled, we do not reinflate headers because they are
            // inflated from the background thread
@@ -1597,7 +1559,7 @@ public class NotificationChildrenContainer extends ViewGroup
        mIsMinimized = isMinimized;
        if (mContainingNotification != null) { /* we're not yet set up yet otherwise */
            if (!AsyncGroupHeaderViewInflation.isEnabled()) {
                recreateLowPriorityHeader(null /* existingBuilder */, mIsConversation);
                recreateLowPriorityHeader(null /* existingBuilder */);
            }
            updateHeaderVisibility(false /* animate */);
        }
+0 −4
Original line number Diff line number Diff line
@@ -468,10 +468,6 @@ public class StackStateAnimator {
                if (isFullySwipedOut) {
                    changingView.removeFromTransientContainer();
                }
            } else if (event.animationType == NotificationStackScrollLayout
                    .AnimationEvent.ANIMATION_TYPE_GROUP_EXPANSION_CHANGED) {
                ExpandableNotificationRow row = (ExpandableNotificationRow) event.mChangingView;
                row.prepareExpansionChanged();
            } else if (event.animationType == ANIMATION_TYPE_HEADS_UP_CYCLING_IN) {
                mHeadsUpAppearChildren.add(changingView);

+1 −1
Original line number Diff line number Diff line
@@ -370,7 +370,7 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {

        row.onDensityOrFontScaleChanged();

        verify(mockContainer).reInflateViews(any(), any());
        verify(mockContainer).reInflateViews(any());
    }

    @Test