Merge "DO NOT MERGE Fix issue with bubble stack & bubble data expanded bit being out of sync" into sc-v2-dev

This commit is contained in:
Mady Mellor
2022-02-08 22:12:41 +00:00
committed by Android (Google) Code Review
3 changed files with 34 additions and 1 deletions

View File

@@ -1724,6 +1724,7 @@ public class BubbleStackView extends FrameLayout
/** /**
* Changes the expanded state of the stack. * Changes the expanded state of the stack.
* Don't call this directly, call mBubbleData#setExpanded.
* *
* @param shouldExpand whether the bubble stack should appear expanded * @param shouldExpand whether the bubble stack should appear expanded
*/ */
@@ -1770,7 +1771,7 @@ public class BubbleStackView extends FrameLayout
} else if (mManageEduView != null && mManageEduView.getVisibility() == VISIBLE) { } else if (mManageEduView != null && mManageEduView.getVisibility() == VISIBLE) {
mManageEduView.hide(); mManageEduView.hide();
} else { } else {
setExpanded(false); mBubbleData.setExpanded(false);
} }
} }
} }

View File

@@ -1275,6 +1275,22 @@ public class BubblesTest extends SysuiTestCase {
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */); assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
} }
@Test
public void testStackViewOnBackPressed_updatesBubbleDataExpandState() {
mBubbleController.updateBubble(mBubbleEntry);
// Expand the stack
mBubbleData.setExpanded(true);
assertStackExpanded();
// Hit back
BubbleStackView stackView = mBubbleController.getStackView();
stackView.onBackPressed();
// Make sure we're collapsed
assertStackCollapsed();
}
/** Creates a bubble using the userId and package. */ /** Creates a bubble using the userId and package. */
private Bubble createBubble(int userId, String pkg) { private Bubble createBubble(int userId, String pkg) {
final UserHandle userHandle = new UserHandle(userId); final UserHandle userHandle = new UserHandle(userId);

View File

@@ -1091,6 +1091,22 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */); assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
} }
@Test
public void testStackViewOnBackPressed_updatesBubbleDataExpandState() {
mBubbleController.updateBubble(mBubbleEntry);
// Expand the stack
mBubbleData.setExpanded(true);
assertStackExpanded();
// Hit back
BubbleStackView stackView = mBubbleController.getStackView();
stackView.onBackPressed();
// Make sure we're collapsed
assertStackCollapsed();
}
/** /**
* Sets the bubble metadata flags for this entry. These flags are normally set by * Sets the bubble metadata flags for this entry. These flags are normally set by
* NotificationManagerService when the notification is sent, however, these tests do not * NotificationManagerService when the notification is sent, however, these tests do not