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

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

Fix intrinsicHeight calc for bundles + children

Flag: com.android.systemui.notification_bundle_ui
Fixes: 434591469
Test: manual - expand bundles, verify not truncated
Change-Id: Ice1c1d515d9088196544da71d9dc7d1b7734c8ec
parent 74d43653
Loading
Loading
Loading
Loading
+28 −15
Original line number Diff line number Diff line
@@ -3310,19 +3310,32 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    public int getIntrinsicHeight() {
        if (isUserLocked()) {
            return getActualHeight();
        } else if (mGuts != null && mGuts.isExposed()) {
        }
        if (mGuts != null && mGuts.isExposed()) {
            return mGuts.getIntrinsicHeight();
        } else if (isBundle() && !isGroupExpanded()) {
            return getCollapsedHeight();
        } else if (isBundle() && isGroupExpanded()) {
        }
        if (NotificationBundleUi.isEnabled()) {
            if (mSensitive && mHideSensitiveForIntrinsicHeight) {
                return getMinHeight();
            }
            if (mIsSummaryWithChildren) {
                return mChildrenContainer.getIntrinsicHeight();
        } else if ((isChildInGroup() && !isGroupExpanded())) {
            }
            if (isChildInGroup() && !isGroupExpanded()) {
                return mPrivateLayout.getMinHeight();
            }
        } else {
            if (isChildInGroup() && !isGroupExpanded()) {
                return mPrivateLayout.getMinHeight();
        } else if (mSensitive && mHideSensitiveForIntrinsicHeight) {
            }
            if (mSensitive && mHideSensitiveForIntrinsicHeight) {
                return getMinHeight();
        } else if (mIsSummaryWithChildren) {
            }
            if (mIsSummaryWithChildren) {
                return mChildrenContainer.getIntrinsicHeight();
        } else if (canShowHeadsUp() && isHeadsUpState()) {
            }
        }
        if (canShowHeadsUp() && isHeadsUpState()) {
            if (isPinned() || mHeadsupDisappearRunning) {
                return getPinnedHeadsUpHeight(true /* atLeastMinHeight */);
            } else if (isExpanded()) {
@@ -3330,11 +3343,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            } else {
                return Math.max(getCollapsedHeight(), getHeadsUpHeight());
            }
        } else if (isExpanded()) {
        }
        if (isExpanded()) {
            return getMaxExpandHeight();
        } else {
            return getCollapsedHeight();
        }
        return getCollapsedHeight();
    }

    /**
+34 −0
Original line number Diff line number Diff line
@@ -326,6 +326,40 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
                .isEqualTo(group.getChildrenContainer().getIntrinsicHeight());
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testGroupWithinGroupIntrinsicHeightCalculationWhenGroupCollapsed() {
        // GIVEN a group within a group
        final ExpandableNotificationRow bundle = mKosmos.createRowBundle(
                BundleSpec.Companion.getNEWS());
        final PipelineEntry bundleEntry =
                ((BundleEntryAdapter) bundle.getEntryAdapter()).getEntry();

        Notification groupNotif = new Notification.Builder(mContext, "channel")
                .setSmallIcon(R.drawable.ic_menu)
                .setGroupSummary(true)
                .setGroup("group2")
                .build();
        NotificationEntry groupEntry = new NotificationEntryBuilder()
                .setNotification(groupNotif)
                .setParent(bundleEntry)
                .build();

        ExpandableNotificationRow group = mKosmos.createRow(groupEntry);
        ExpandableNotificationRow child = mKosmos.createRow();
        bundle.addChildNotification(group, 0);
        group.addChildNotification(child, 0);

        // WHEN group is collapsed
        group.expandNotification();
        mKosmos.getGroupExpansionManager().setGroupExpanded(group.getEntryAdapter(), false);

        // THEN group is collapsed and has correct intrinsic height
        assertThat(group.isGroupExpanded()).isEqualTo(false);
        assertThat(group.getIntrinsicHeight())
                .isEqualTo(group.getChildrenContainer().getIntrinsicHeight());
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testGroupsInsideBundles_clickableWhenExpanded() throws Exception {