Make sure to remove child views when recreating notification menu row
Test: added NotificationMenuRowTest.testRecreateMenu() + runtest systemui Bug: 36855649 Change-Id: I4045dc292eb2b5a817ae8d2e78cbce50d4d22b41
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user