Merge "Merge "Show selected bubble first, after stack expands" into rvc-dev am: 594cbe8241 am: 78c0ae9687" into rvc-d1-dev-plus-aosp

This commit is contained in:
Automerger Merge Worker
2020-04-03 17:17:46 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 14 deletions

View File

@@ -549,6 +549,7 @@ public class BubbleData {
Log.e(TAG, "Attempt to expand stack without selected bubble!");
return;
}
mSelectedBubble.markUpdatedAt(mTimeSource.currentTimeMillis());
mSelectedBubble.markAsAccessedAt(mTimeSource.currentTimeMillis());
mStateChange.orderChanged |= repackAll();
} else if (!mBubbles.isEmpty()) {
@@ -662,7 +663,7 @@ public class BubbleData {
/**
* This applies a full sort and group pass to all existing bubbles. The bubbles are grouped
* by groupId. Each group is then sorted by the max(lastUpdated) time of it's bubbles. Bubbles
* by groupId. Each group is then sorted by the max(lastUpdated) time of its bubbles. Bubbles
* within each group are then sorted by lastUpdated descending.
*
* @return true if the position of any bubbles changed as a result

View File

@@ -599,13 +599,13 @@ public class BubbleDataTest extends SysuiTestCase {
sendUpdatedEntryAtTime(mEntryA1, 1000);
sendUpdatedEntryAtTime(mEntryA2, 2000);
sendUpdatedEntryAtTime(mEntryB1, 3000); // [B1, A2, A1]
changeExpandedStateAtTime(true, 4000L);
changeExpandedStateAtTime(true, 4000L); // B1 marked updated at 4000L
mBubbleData.setListener(mListener);
// Test
sendUpdatedEntryAtTime(mEntryC1, 4000);
verifyUpdateReceived();
assertOrderChangedTo(mBubbleC1, mBubbleB1, mBubbleA2, mBubbleA1);
assertOrderChangedTo(mBubbleB1, mBubbleC1, mBubbleA2, mBubbleA1);
}
/**
@@ -789,8 +789,7 @@ public class BubbleDataTest extends SysuiTestCase {
* When the stack transitions to the collapsed state, the selected bubble is brought to the top.
* Bubbles within the same group should move up with it.
* <p>
* When the stack transitions back to the expanded state, the previous ordering is restored, as
* long as no changes have been made (adds, removes or updates) while in the collapsed state.
* When the stack transitions back to the expanded state, this new order is kept as is.
*/
@Test
public void test_expansionChanges() {
@@ -813,20 +812,12 @@ public class BubbleDataTest extends SysuiTestCase {
// stack is expanded. When next collapsed, sorting will be applied and saved, just prior
// to moving the selected bubble to the top (first).
//
// In this case, the expected re-expand state will be: [B1, B2, A2*, A1]
//
// That state is restored as long as no changes occur (add/remove/update) while in
// the collapsed state.
// In this case, the expected re-expand state will be: [A2, A1, B1, B2]
//
// collapse -> selected bubble (A2) moves first.
changeExpandedStateAtTime(false, 8000L);
verifyUpdateReceived();
assertOrderChangedTo(mBubbleA2, mBubbleA1, mBubbleB1, mBubbleB2);
// expand -> "original" order/grouping restored
changeExpandedStateAtTime(true, 10000L);
verifyUpdateReceived();
assertOrderChangedTo(mBubbleB1, mBubbleB2, mBubbleA2, mBubbleA1);
}
/**