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

Commit 0df26108 authored by Mady Mellor's avatar Mady Mellor
Browse files

Make sure to remove child views when recreating notification menu row

Test: added NotificationMenuRowTest.testRecreateMenu() + runtest systemui
Bug: 36855649
Change-Id: I4045dc292eb2b5a817ae8d2e78cbce50d4d22b41
parent 76d77937
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -120,6 +120,9 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
    @Override
    public void createMenu(ViewGroup parent) {
        mParent = (ExpandableNotificationRow) parent;
        if (mMenuContainer != null) {
            mMenuContainer.removeAllViews();
        }
        mMenuContainer = new FrameLayout(mContext);
        for (int i = 0; i < mMenuItems.size(); i++) {
            addMenuView(mMenuItems.get(i), mMenuContainer);
+7 −0
Original line number Diff line number Diff line
@@ -44,4 +44,11 @@ public class NotificationMenuRowTest extends LeakCheckedTest {
        ViewUtils.detachView(row.getMenuView());
        TestableLooper.get(this).processAllMessages();
    }

    @Test
    public void testRecreateMenu() {
        NotificationMenuRowPlugin row = new NotificationMenuRow(mContext);
        row.createMenu(null);
        row.createMenu(null);
    }
}