Encapsulate NotifEntry.key and .notification
NotificationEntry.key -> getKey()
NotificationEntry.notification -> getSbn()
.key -> mKey
.notification -> mSbn
Test: atest
Change-Id: Idcc56af5d941d600b2958afb9ed898fd7ab361cc
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 9568a18..0231b56 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -262,7 +262,7 @@
// More notifications could be added causing summary to no longer
// be suppressed -- in this case need to remove the key.
final String groupKey = group.summary != null
- ? group.summary.notification.getGroupKey()
+ ? group.summary.getSbn().getGroupKey()
: null;
if (!suppressed && groupKey != null
&& mBubbleData.isSummarySuppressed(groupKey)) {
@@ -346,7 +346,7 @@
return;
}
for (NotificationEntry e : notificationData.getNotificationsForCurrentUser()) {
- if (savedBubbleKeys.contains(e.key)
+ if (savedBubbleKeys.contains(e.getKey())
&& mNotificationInterruptionStateProvider.shouldBubbleUp(e)
&& canLaunchInActivityView(mContext, e)) {
updateBubble(e, /* suppressFlyout= */ true);
@@ -445,7 +445,7 @@
boolean isBubbleAndSuppressed = mBubbleData.hasBubbleWithKey(key)
&& !mBubbleData.getBubbleWithKey(key).showInShadeWhenBubble();
NotificationEntry entry = mNotificationEntryManager.getNotificationData().get(key);
- String groupKey = entry != null ? entry.notification.getGroupKey() : null;
+ String groupKey = entry != null ? entry.getSbn().getGroupKey() : null;
boolean isSuppressedSummary = mBubbleData.isSummarySuppressed(groupKey);
boolean isSummary = key.equals(mBubbleData.getSummaryKey(groupKey));
return (isSummary && isSuppressedSummary) || isBubbleAndSuppressed;
@@ -528,14 +528,14 @@
@Override
public boolean onNotificationRemoveRequested(String key, int reason) {
NotificationEntry entry = mNotificationEntryManager.getNotificationData().get(key);
- String groupKey = entry != null ? entry.notification.getGroupKey() : null;
+ String groupKey = entry != null ? entry.getSbn().getGroupKey() : null;
ArrayList<Bubble> bubbleChildren = mBubbleData.getBubblesInGroup(groupKey);
boolean inBubbleData = mBubbleData.hasBubbleWithKey(key);
boolean isSuppressedSummary = (mBubbleData.isSummarySuppressed(groupKey)
&& mBubbleData.getSummaryKey(groupKey).equals(key));
boolean isSummary = entry != null
- && entry.notification.getNotification().isGroupSummary();
+ && entry.getSbn().getNotification().isGroupSummary();
boolean isSummaryOfBubbles = (isSuppressedSummary || isSummary)
&& bubbleChildren != null && !bubbleChildren.isEmpty();
@@ -566,7 +566,7 @@
bubble.setShowInShadeWhenBubble(false);
bubble.setShowBubbleDot(false);
if (mStackView != null) {
- mStackView.updateDotVisibility(entry.key);
+ mStackView.updateDotVisibility(entry.getKey());
}
mNotificationEntryManager.updateNotifications(
"BubbleController.onNotificationRemoveRequested");
@@ -582,7 +582,7 @@
private boolean handleSummaryRemovalInterception(NotificationEntry summary,
boolean userRemovedNotif) {
- String groupKey = summary.notification.getGroupKey();
+ String groupKey = summary.getSbn().getGroupKey();
ArrayList<Bubble> bubbleChildren = mBubbleData.getBubblesInGroup(groupKey);
if (userRemovedNotif) {
@@ -603,11 +603,11 @@
// If the summary was auto-generated we don't need to keep that notification around
// because apps can't cancel it; so we only intercept & suppress real summaries.
- boolean isAutogroupSummary = (summary.notification.getNotification().flags
+ boolean isAutogroupSummary = (summary.getSbn().getNotification().flags
& FLAG_AUTOGROUP_SUMMARY) != 0;
if (!isAutogroupSummary) {
- mBubbleData.addSummaryToSuppress(summary.notification.getGroupKey(),
- summary.key);
+ mBubbleData.addSummaryToSuppress(summary.getSbn().getGroupKey(),
+ summary.getKey());
// Tell shade to update for the suppression
mNotificationEntryManager.updateNotifications(
"BubbleController.handleSummaryRemovalInterception");
@@ -641,11 +641,11 @@
public void onPreEntryUpdated(NotificationEntry entry) {
boolean shouldBubble = mNotificationInterruptionStateProvider.shouldBubbleUp(entry)
&& canLaunchInActivityView(mContext, entry);
- if (!shouldBubble && mBubbleData.hasBubbleWithKey(entry.key)) {
+ if (!shouldBubble && mBubbleData.hasBubbleWithKey(entry.getKey())) {
// It was previously a bubble but no longer a bubble -- lets remove it
- removeBubble(entry.key, DISMISS_NO_LONGER_BUBBLE);
+ removeBubble(entry.getKey(), DISMISS_NO_LONGER_BUBBLE);
} else if (shouldBubble) {
- Bubble b = mBubbleData.getBubbleWithKey(entry.key);
+ Bubble b = mBubbleData.getBubbleWithKey(entry.getKey());
updateBubble(entry);
}
}
@@ -695,10 +695,10 @@
&& !bubble.showInShadeWhenBubble()) {
// The bubble is gone & the notification is gone, time to actually remove it
mNotificationEntryManager.performRemoveNotification(
- bubble.getEntry().notification, UNDEFINED_DISMISS_REASON);
+ bubble.getEntry().getSbn(), UNDEFINED_DISMISS_REASON);
} else {
// Update the flag for SysUI
- bubble.getEntry().notification.getNotification().flags &= ~FLAG_BUBBLE;
+ bubble.getEntry().getSbn().getNotification().flags &= ~FLAG_BUBBLE;
// Make sure NoMan knows it's not a bubble anymore so anyone querying it
// will get right result back
@@ -712,7 +712,7 @@
// Check if removed bubble has an associated suppressed group summary that needs
// to be removed now.
- final String groupKey = bubble.getEntry().notification.getGroupKey();
+ final String groupKey = bubble.getEntry().getSbn().getGroupKey();
if (mBubbleData.isSummarySuppressed(groupKey)
&& mBubbleData.getBubblesInGroup(groupKey).isEmpty()) {
// Time to actually remove the summary.
@@ -721,20 +721,21 @@
NotificationEntry entry =
mNotificationEntryManager.getNotificationData().get(notifKey);
mNotificationEntryManager.performRemoveNotification(
- entry.notification, UNDEFINED_DISMISS_REASON);
+ entry.getSbn(), UNDEFINED_DISMISS_REASON);
}
// Check if summary should be removed from NoManGroup
NotificationEntry summary = mNotificationGroupManager.getLogicalGroupSummary(
- bubble.getEntry().notification);
+ bubble.getEntry().getSbn());
if (summary != null) {
ArrayList<NotificationEntry> summaryChildren =
- mNotificationGroupManager.getLogicalChildren(summary.notification);
- boolean isSummaryThisNotif = summary.key.equals(bubble.getEntry().key);
+ mNotificationGroupManager.getLogicalChildren(summary.getSbn());
+ boolean isSummaryThisNotif = summary.getKey().equals(
+ bubble.getEntry().getKey());
if (!isSummaryThisNotif
&& (summaryChildren == null || summaryChildren.isEmpty())) {
mNotificationEntryManager.performRemoveNotification(
- summary.notification, UNDEFINED_DISMISS_REASON);
+ summary.getSbn(), UNDEFINED_DISMISS_REASON);
}
}
}