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

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

Recompose bundle header when config changes

Flag: com.android.systemui.notification_bundle_ui
Fixes: 424357475
Fixes: 424419409
Fixes: 424359006
Fixes: 424420425
Test: manual - text size + theme changes
Change-Id: I4ea4c5be3f58116aa4b80a9e39308c7c6ce56dda
parent 6b368988
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testGetMaxAllowedVisibleChildren_bundle_likeCollapsed() {
        View headerView = new ComposeView(mContext);
        ComposeView headerView = new ComposeView(mContext);
        mChildrenContainer.setBundleHeaderView(headerView);
        mChildrenContainer.setBundleHeaderViewModel(mock(BundleHeaderViewModel.class));
        Assert.assertEquals(mChildrenContainer.getMaxAllowedVisibleChildren(true),
@@ -132,7 +132,7 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testGetMaxAllowedVisibleChildren_bundle_expandedChildren() {
        View headerView = new ComposeView(mContext);
        ComposeView headerView = new ComposeView(mContext);
        mChildrenContainer.setBundleHeaderView(headerView);
        mChildrenContainer.setBundleHeaderViewModel(mock(BundleHeaderViewModel.class));
        mChildrenContainer.setChildrenExpanded(true);
@@ -143,7 +143,7 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testGetMaxAllowedVisibleChildren_bundle_userLocked() {
        View headerView = new ComposeView(mContext);
        ComposeView headerView = new ComposeView(mContext);
        mChildrenContainer.setBundleHeaderView(headerView);
        mChildrenContainer.setBundleHeaderViewModel(mock(BundleHeaderViewModel.class));
        mGroup.setUserLocked(true);
@@ -317,7 +317,7 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
        View currentView = mChildrenContainer.getChildAt(mChildrenContainer.getChildCount() - 1);
        Assert.assertFalse(currentView instanceof ComposeView);

        View headerView = new ComposeView(mContext);
        ComposeView headerView = new ComposeView(mContext);
        mChildrenContainer.setBundleHeaderView(headerView);
        BundleHeaderViewModel viewModel = mKosmos.getBundleHeaderViewModel();
        mChildrenContainer.setBundleHeaderViewModel(viewModel);
+5 −1
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.compose.ui.platform.ComposeView;
import androidx.dynamicanimation.animation.FloatPropertyCompat;
import androidx.dynamicanimation.animation.SpringAnimation;

@@ -1727,6 +1728,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        if (mBigPictureIconManager != null) {
            mBigPictureIconManager.updateMaxImageSizes();
        }
        if (mChildrenContainer != null) {
            mChildrenContainer.recomposeBundleHeader();
        }
    }

    public void onUiModeChanged() {
@@ -1909,7 +1913,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        mRedactionType = redactionType;
    }

    public void setBundleHeaderView(@NonNull View view) {
    public void setBundleHeaderView(@NonNull ComposeView view) {
        if (NotificationBundleUi.isUnexpectedlyInLegacyMode()) return;
        NotificationChildrenContainer childrenContainer = getChildrenContainerNonNull();
        childrenContainer.setBundleHeaderView(view);
+11 −2
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.compose.ui.platform.ComposeView;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.widget.NotificationExpandButton;
@@ -130,7 +131,7 @@ public class NotificationChildrenContainer extends ViewGroup
     * This view is only set when this NCC is a bundle. If this view is set, all other header
     * view variants have to be null.
     */
    private View mBundleHeaderView;
    private ComposeView mBundleHeaderView;
    @Nullable private BundleHeaderViewModel mBundleHeaderViewModel;

    private NotificationHeaderView mGroupHeader;
@@ -224,6 +225,13 @@ public class NotificationChildrenContainer extends ViewGroup
                R.dimen.conversation_single_line_face_pile_size);
    }

    public void recomposeBundleHeader() {
        if (mBundleHeaderView != null) {
            mBundleHeaderView.disposeComposition();
            mBundleHeaderView.createComposition();
        }
    }

    @NonNull
    @Override
    public RoundableState getRoundableState() {
@@ -511,7 +519,7 @@ public class NotificationChildrenContainer extends ViewGroup
        mMinimizedGroupHeader = null;
        mMinimizedGroupHeaderWrapper = null;
    }
    public void setBundleHeaderView(@NonNull View view) {
    public void setBundleHeaderView(@NonNull ComposeView view) {
        if (NotificationBundleUi.isUnexpectedlyInLegacyMode()) return;
        initBundleDimens();
        mBundleHeaderView = view;
@@ -1642,6 +1650,7 @@ public class NotificationChildrenContainer extends ViewGroup
            addView(divider, index);
            mDividers.set(i, divider);
        }
        recomposeBundleHeader();
    }

    public void setUserLocked(boolean userLocked) {