Merge "BubbleData [1/n]: remove unused parameter" into qt-dev
This commit is contained in:
@@ -325,12 +325,11 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
|
|||||||
* Adds or updates a bubble associated with the provided notification entry.
|
* Adds or updates a bubble associated with the provided notification entry.
|
||||||
*
|
*
|
||||||
* @param notif the notification associated with this bubble.
|
* @param notif the notification associated with this bubble.
|
||||||
* @param updatePosition whether this update should promote the bubble to the top of the stack.
|
|
||||||
*/
|
*/
|
||||||
public void updateBubble(NotificationEntry notif, boolean updatePosition) {
|
void updateBubble(NotificationEntry notif) {
|
||||||
if (mStackView != null && mBubbleData.getBubble(notif.key) != null) {
|
if (mStackView != null && mBubbleData.getBubble(notif.key) != null) {
|
||||||
// It's an update
|
// It's an update
|
||||||
mStackView.updateBubble(notif, updatePosition);
|
mStackView.updateBubble(notif);
|
||||||
} else {
|
} else {
|
||||||
if (mStackView == null) {
|
if (mStackView == null) {
|
||||||
mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer);
|
mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer);
|
||||||
@@ -403,7 +402,7 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (entry.isBubble() && mNotificationInterruptionStateProvider.shouldBubbleUp(entry)) {
|
if (entry.isBubble() && mNotificationInterruptionStateProvider.shouldBubbleUp(entry)) {
|
||||||
updateBubble(entry, true /* updatePosition */);
|
updateBubble(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,7 +415,7 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
|
|||||||
&& alertAgain(entry, entry.notification.getNotification())) {
|
&& alertAgain(entry, entry.notification.getNotification())) {
|
||||||
entry.setShowInShadeWhenBubble(true);
|
entry.setShowInShadeWhenBubble(true);
|
||||||
entry.setBubbleDismissed(false); // updates come back as bubbles even if dismissed
|
entry.setBubbleDismissed(false); // updates come back as bubbles even if dismissed
|
||||||
updateBubble(entry, true /* updatePosition */);
|
updateBubble(entry);
|
||||||
mStackView.updateDotVisibility(entry.key);
|
mStackView.updateDotVisibility(entry.key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -595,15 +595,13 @@ public class BubbleStackView extends FrameLayout {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a bubble in the stack.
|
* Updates a bubble in the stack.
|
||||||
*
|
* @param entry the entry to update in the stack.
|
||||||
* @param entry the entry to update in the stack.
|
|
||||||
* @param updatePosition whether this bubble should be moved to top of the stack.
|
|
||||||
*/
|
*/
|
||||||
public void updateBubble(NotificationEntry entry, boolean updatePosition) {
|
public void updateBubble(NotificationEntry entry) {
|
||||||
Bubble b = mBubbleData.getBubble(entry.key);
|
Bubble b = mBubbleData.getBubble(entry.key);
|
||||||
mBubbleData.updateBubble(entry.key, entry);
|
mBubbleData.updateBubble(entry.key, entry);
|
||||||
|
|
||||||
if (updatePosition && !mIsExpanded) {
|
if (!mIsExpanded) {
|
||||||
// If alerting it gets promoted to top of the stack.
|
// If alerting it gets promoted to top of the stack.
|
||||||
if (mBubbleContainer.indexOfChild(b.iconView) != 0) {
|
if (mBubbleContainer.indexOfChild(b.iconView) != 0) {
|
||||||
mBubbleContainer.moveViewTo(b.iconView, 0);
|
mBubbleContainer.moveViewTo(b.iconView, 0);
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public class BubbleControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddBubble() {
|
public void testAddBubble() {
|
||||||
mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow.getEntry());
|
||||||
assertTrue(mBubbleController.hasBubbles());
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
|
|
||||||
verify(mBubbleStateChangeListener).onHasBubblesChanged(true);
|
verify(mBubbleStateChangeListener).onHasBubblesChanged(true);
|
||||||
@@ -169,13 +169,13 @@ public class BubbleControllerTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testHasBubbles() {
|
public void testHasBubbles() {
|
||||||
assertFalse(mBubbleController.hasBubbles());
|
assertFalse(mBubbleController.hasBubbles());
|
||||||
mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow.getEntry());
|
||||||
assertTrue(mBubbleController.hasBubbles());
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRemoveBubble() {
|
public void testRemoveBubble() {
|
||||||
mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow.getEntry());
|
||||||
assertTrue(mBubbleController.hasBubbles());
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
|
|
||||||
verify(mBubbleStateChangeListener).onHasBubblesChanged(true);
|
verify(mBubbleStateChangeListener).onHasBubblesChanged(true);
|
||||||
@@ -189,8 +189,8 @@ public class BubbleControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDismissStack() {
|
public void testDismissStack() {
|
||||||
mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow.getEntry());
|
||||||
mBubbleController.updateBubble(mRow2.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow2.getEntry());
|
||||||
assertTrue(mBubbleController.hasBubbles());
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
|
|
||||||
mBubbleController.dismissStack(BubbleController.DISMISS_USER_GESTURE);
|
mBubbleController.dismissStack(BubbleController.DISMISS_USER_GESTURE);
|
||||||
@@ -206,7 +206,7 @@ public class BubbleControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// Mark it as a bubble and add it explicitly
|
// Mark it as a bubble and add it explicitly
|
||||||
mEntryListener.onPendingEntryAdded(mRow.getEntry());
|
mEntryListener.onPendingEntryAdded(mRow.getEntry());
|
||||||
mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow.getEntry());
|
||||||
|
|
||||||
// We should have bubbles & their notifs should show in the shade
|
// We should have bubbles & their notifs should show in the shade
|
||||||
assertTrue(mBubbleController.hasBubbles());
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
@@ -235,8 +235,8 @@ public class BubbleControllerTest extends SysuiTestCase {
|
|||||||
// Mark it as a bubble and add it explicitly
|
// Mark it as a bubble and add it explicitly
|
||||||
mEntryListener.onPendingEntryAdded(mRow.getEntry());
|
mEntryListener.onPendingEntryAdded(mRow.getEntry());
|
||||||
mEntryListener.onPendingEntryAdded(mRow2.getEntry());
|
mEntryListener.onPendingEntryAdded(mRow2.getEntry());
|
||||||
mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow.getEntry());
|
||||||
mBubbleController.updateBubble(mRow2.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow2.getEntry());
|
||||||
|
|
||||||
// We should have bubbles & their notifs should show in the shade
|
// We should have bubbles & their notifs should show in the shade
|
||||||
assertTrue(mBubbleController.hasBubbles());
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
@@ -272,7 +272,7 @@ public class BubbleControllerTest extends SysuiTestCase {
|
|||||||
public void testExpansionRemovesShowInShade() {
|
public void testExpansionRemovesShowInShade() {
|
||||||
// Mark it as a bubble and add it explicitly
|
// Mark it as a bubble and add it explicitly
|
||||||
mEntryListener.onPendingEntryAdded(mRow.getEntry());
|
mEntryListener.onPendingEntryAdded(mRow.getEntry());
|
||||||
mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow.getEntry());
|
||||||
|
|
||||||
// We should have bubbles & their notifs should show in the shade
|
// We should have bubbles & their notifs should show in the shade
|
||||||
assertTrue(mBubbleController.hasBubbles());
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
@@ -293,8 +293,8 @@ public class BubbleControllerTest extends SysuiTestCase {
|
|||||||
// Mark it as a bubble and add it explicitly
|
// Mark it as a bubble and add it explicitly
|
||||||
mEntryListener.onPendingEntryAdded(mRow.getEntry());
|
mEntryListener.onPendingEntryAdded(mRow.getEntry());
|
||||||
mEntryListener.onPendingEntryAdded(mRow2.getEntry());
|
mEntryListener.onPendingEntryAdded(mRow2.getEntry());
|
||||||
mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow.getEntry());
|
||||||
mBubbleController.updateBubble(mRow2.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow2.getEntry());
|
||||||
verify(mBubbleStateChangeListener).onHasBubblesChanged(true);
|
verify(mBubbleStateChangeListener).onHasBubblesChanged(true);
|
||||||
|
|
||||||
// Expand
|
// Expand
|
||||||
@@ -333,7 +333,7 @@ public class BubbleControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// Add the auto expand bubble
|
// Add the auto expand bubble
|
||||||
mEntryListener.onPendingEntryAdded(mAutoExpandRow.getEntry());
|
mEntryListener.onPendingEntryAdded(mAutoExpandRow.getEntry());
|
||||||
mBubbleController.updateBubble(mAutoExpandRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mAutoExpandRow.getEntry());
|
||||||
|
|
||||||
// Expansion shouldn't change
|
// Expansion shouldn't change
|
||||||
verify(mBubbleExpandListener, never()).onBubbleExpandChanged(false /* expanded */,
|
verify(mBubbleExpandListener, never()).onBubbleExpandChanged(false /* expanded */,
|
||||||
@@ -371,7 +371,7 @@ public class BubbleControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// Add the auto expand bubble
|
// Add the auto expand bubble
|
||||||
mEntryListener.onPendingEntryAdded(mAutoExpandRow.getEntry());
|
mEntryListener.onPendingEntryAdded(mAutoExpandRow.getEntry());
|
||||||
mBubbleController.updateBubble(mAutoExpandRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mAutoExpandRow.getEntry());
|
||||||
|
|
||||||
// Expansion should change
|
// Expansion should change
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true /* expanded */,
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true /* expanded */,
|
||||||
@@ -387,7 +387,7 @@ public class BubbleControllerTest extends SysuiTestCase {
|
|||||||
public void testSuppressNotif_FailsNotForeground() {
|
public void testSuppressNotif_FailsNotForeground() {
|
||||||
// Add the suppress notif bubble
|
// Add the suppress notif bubble
|
||||||
mEntryListener.onPendingEntryAdded(mSuppressNotifRow.getEntry());
|
mEntryListener.onPendingEntryAdded(mSuppressNotifRow.getEntry());
|
||||||
mBubbleController.updateBubble(mSuppressNotifRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mSuppressNotifRow.getEntry());
|
||||||
|
|
||||||
// Should show in shade because we weren't forground
|
// Should show in shade because we weren't forground
|
||||||
assertTrue(mSuppressNotifRow.getEntry().showInShadeWhenBubble());
|
assertTrue(mSuppressNotifRow.getEntry().showInShadeWhenBubble());
|
||||||
@@ -423,7 +423,7 @@ public class BubbleControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// Add the suppress notif bubble
|
// Add the suppress notif bubble
|
||||||
mEntryListener.onPendingEntryAdded(mSuppressNotifRow.getEntry());
|
mEntryListener.onPendingEntryAdded(mSuppressNotifRow.getEntry());
|
||||||
mBubbleController.updateBubble(mSuppressNotifRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mSuppressNotifRow.getEntry());
|
||||||
|
|
||||||
// Should NOT show in shade because we were foreground
|
// Should NOT show in shade because we were foreground
|
||||||
assertFalse(mSuppressNotifRow.getEntry().showInShadeWhenBubble());
|
assertFalse(mSuppressNotifRow.getEntry().showInShadeWhenBubble());
|
||||||
@@ -438,7 +438,7 @@ public class BubbleControllerTest extends SysuiTestCase {
|
|||||||
final String key = mRow.getEntry().key;
|
final String key = mRow.getEntry().key;
|
||||||
|
|
||||||
mEntryListener.onPendingEntryAdded(mRow.getEntry());
|
mEntryListener.onPendingEntryAdded(mRow.getEntry());
|
||||||
mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow.getEntry());
|
||||||
|
|
||||||
// Simulate notification cancellation.
|
// Simulate notification cancellation.
|
||||||
mEntryListener.onEntryRemoved(mRow.getEntry(), null /* notificationVisibility (unused) */,
|
mEntryListener.onEntryRemoved(mRow.getEntry(), null /* notificationVisibility (unused) */,
|
||||||
@@ -464,22 +464,22 @@ public class BubbleControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteIntent_removeBubble_aged() throws PendingIntent.CanceledException {
|
public void testDeleteIntent_removeBubble_aged() throws PendingIntent.CanceledException {
|
||||||
mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow.getEntry());
|
||||||
mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_AGED);
|
mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_AGED);
|
||||||
verify(mDeleteIntent, never()).send();
|
verify(mDeleteIntent, never()).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteIntent_removeBubble_user() throws PendingIntent.CanceledException {
|
public void testDeleteIntent_removeBubble_user() throws PendingIntent.CanceledException {
|
||||||
mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow.getEntry());
|
||||||
mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_USER_GESTURE);
|
mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_USER_GESTURE);
|
||||||
verify(mDeleteIntent, times(1)).send();
|
verify(mDeleteIntent, times(1)).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteIntent_dismissStack() throws PendingIntent.CanceledException {
|
public void testDeleteIntent_dismissStack() throws PendingIntent.CanceledException {
|
||||||
mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow.getEntry());
|
||||||
mBubbleController.updateBubble(mRow2.getEntry(), true /* updatePosition */);
|
mBubbleController.updateBubble(mRow2.getEntry());
|
||||||
mBubbleController.dismissStack(BubbleController.DISMISS_USER_GESTURE);
|
mBubbleController.dismissStack(BubbleController.DISMISS_USER_GESTURE);
|
||||||
verify(mDeleteIntent, times(2)).send();
|
verify(mDeleteIntent, times(2)).send();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user