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/ForegroundServiceLifetimeExtender.java b/packages/SystemUI/src/com/android/systemui/ForegroundServiceLifetimeExtender.java
index 5c561e5..362014f 100644
--- a/packages/SystemUI/src/com/android/systemui/ForegroundServiceLifetimeExtender.java
+++ b/packages/SystemUI/src/com/android/systemui/ForegroundServiceLifetimeExtender.java
@@ -50,13 +50,13 @@
@Override
public boolean shouldExtendLifetime(@NonNull NotificationEntry entry) {
- if ((entry.notification.getNotification().flags
+ if ((entry.getSbn().getNotification().flags
& Notification.FLAG_FOREGROUND_SERVICE) == 0) {
return false;
}
long currentTime = System.currentTimeMillis();
- return currentTime - entry.notification.getPostTime() < MIN_FGS_TIME_MS;
+ return currentTime - entry.getSbn().getPostTime() < MIN_FGS_TIME_MS;
}
@Override
@@ -79,12 +79,12 @@
if (mManagedEntries.contains(entry)) {
mManagedEntries.remove(entry);
if (mNotificationSafeToRemoveCallback != null) {
- mNotificationSafeToRemoveCallback.onSafeToRemove(entry.key);
+ mNotificationSafeToRemoveCallback.onSafeToRemove(entry.getKey());
}
}
};
long delayAmt = MIN_FGS_TIME_MS
- - (System.currentTimeMillis() - entry.notification.getPostTime());
+ - (System.currentTimeMillis() - entry.getSbn().getPostTime());
mHandler.postDelayed(r, delayAmt);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java b/packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java
index f9d8771..4a3b6df 100644
--- a/packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java
+++ b/packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java
@@ -50,12 +50,12 @@
notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
@Override
public void onPendingEntryAdded(NotificationEntry entry) {
- addNotification(entry.notification, entry.getImportance());
+ addNotification(entry.getSbn(), entry.getImportance());
}
@Override
public void onPostEntryUpdated(NotificationEntry entry) {
- updateNotification(entry.notification, entry.getImportance());
+ updateNotification(entry.getSbn(), entry.getImportance());
}
@Override
@@ -63,7 +63,7 @@
NotificationEntry entry,
NotificationVisibility visibility,
boolean removedByUser) {
- removeNotification(entry.notification);
+ removeNotification(entry.getSbn());
}
});
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java b/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java
index c3cee35..7600b2f 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java
@@ -83,23 +83,23 @@
private boolean mSuppressFlyout;
public static String groupId(NotificationEntry entry) {
- UserHandle user = entry.notification.getUser();
- return user.getIdentifier() + "|" + entry.notification.getPackageName();
+ UserHandle user = entry.getSbn().getUser();
+ return user.getIdentifier() + "|" + entry.getSbn().getPackageName();
}
/** Used in tests when no UI is required. */
@VisibleForTesting(visibility = PRIVATE)
Bubble(Context context, NotificationEntry e) {
mEntry = e;
- mKey = e.key;
- mLastUpdated = e.notification.getPostTime();
+ mKey = e.getKey();
+ mLastUpdated = e.getSbn().getPostTime();
mGroupId = groupId(e);
PackageManager pm = context.getPackageManager();
ApplicationInfo info;
try {
info = pm.getApplicationInfo(
- mEntry.notification.getPackageName(),
+ mEntry.getSbn().getPackageName(),
PackageManager.MATCH_UNINSTALLED_PACKAGES
| PackageManager.MATCH_DISABLED_COMPONENTS
| PackageManager.MATCH_DIRECT_BOOT_UNAWARE
@@ -107,10 +107,10 @@
if (info != null) {
mAppName = String.valueOf(pm.getApplicationLabel(info));
}
- Drawable appIcon = pm.getApplicationIcon(mEntry.notification.getPackageName());
- mUserBadgedAppIcon = pm.getUserBadgedIcon(appIcon, mEntry.notification.getUser());
+ Drawable appIcon = pm.getApplicationIcon(mEntry.getSbn().getPackageName());
+ mUserBadgedAppIcon = pm.getUserBadgedIcon(appIcon, mEntry.getSbn().getUser());
} catch (PackageManager.NameNotFoundException unused) {
- mAppName = mEntry.notification.getPackageName();
+ mAppName = mEntry.getSbn().getPackageName();
}
}
@@ -127,7 +127,7 @@
}
public String getPackageName() {
- return mEntry.notification.getPackageName();
+ return mEntry.getSbn().getPackageName();
}
public String getAppName() {
@@ -190,7 +190,7 @@
void updateEntry(NotificationEntry entry) {
mEntry = entry;
- mLastUpdated = entry.notification.getPostTime();
+ mLastUpdated = entry.getSbn().getPostTime();
if (mInflated) {
mIconView.update(this);
mExpandedView.update(this);
@@ -287,7 +287,7 @@
* is an ongoing bubble.
*/
boolean isOngoing() {
- int flags = mEntry.notification.getNotification().flags;
+ int flags = mEntry.getSbn().getNotification().flags;
return (flags & Notification.FLAG_FOREGROUND_SERVICE) != 0;
}
@@ -296,8 +296,8 @@
boolean useRes = data.getDesiredHeightResId() != 0;
if (useRes) {
return getDimenForPackageUser(context, data.getDesiredHeightResId(),
- mEntry.notification.getPackageName(),
- mEntry.notification.getUser().getIdentifier());
+ mEntry.getSbn().getPackageName(),
+ mEntry.getSbn().getUser().getIdentifier());
} else {
return data.getDesiredHeight()
* context.getResources().getDisplayMetrics().density;
@@ -316,7 +316,7 @@
@Nullable
PendingIntent getBubbleIntent(Context context) {
- Notification notif = mEntry.notification.getNotification();
+ Notification notif = mEntry.getSbn().getNotification();
Notification.BubbleMetadata data = notif.getBubbleMetadata();
if (BubbleController.canLaunchInActivityView(context, mEntry) && data != null) {
return data.getIntent();
@@ -327,7 +327,7 @@
Intent getSettingsIntent() {
final Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_BUBBLE_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, getPackageName());
- intent.putExtra(Settings.EXTRA_APP_UID, mEntry.notification.getUid());
+ intent.putExtra(Settings.EXTRA_APP_UID, mEntry.getSbn().getUid());
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
@@ -339,7 +339,7 @@
* notification, based on its type. Returns null if there should not be an update message.
*/
CharSequence getUpdateMessage(Context context) {
- final Notification underlyingNotif = mEntry.notification.getNotification();
+ final Notification underlyingNotif = mEntry.getSbn().getNotification();
final Class<? extends Notification.Style> style = underlyingNotif.getNotificationStyle();
try {
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);
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
index d43e030..2f7f47b6 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
@@ -183,7 +183,7 @@
if (DEBUG_BUBBLE_DATA) {
Log.d(TAG, "notificationEntryUpdated: " + entry);
}
- Bubble bubble = getBubbleWithKey(entry.key);
+ Bubble bubble = getBubbleWithKey(entry.getKey());
suppressFlyout = !entry.isVisuallyInterruptive || suppressFlyout;
if (bubble == null) {
@@ -217,7 +217,7 @@
if (DEBUG_BUBBLE_DATA) {
Log.d(TAG, "notificationEntryRemoved: entry=" + entry + " reason=" + reason);
}
- doRemove(entry.key, reason);
+ doRemove(entry.getKey(), reason);
dispatchPendingChanges();
}
@@ -290,7 +290,7 @@
return bubbleChildren;
}
for (Bubble b : mBubbles) {
- if (groupKey.equals(b.getEntry().notification.getGroupKey())) {
+ if (groupKey.equals(b.getEntry().getSbn().getGroupKey())) {
bubbleChildren.add(b);
}
}
@@ -633,7 +633,8 @@
try {
deleteIntent.send();
} catch (PendingIntent.CanceledException e) {
- Log.w(TAG, "Failed to send delete intent for bubble with key: " + entry.key);
+ Log.w(TAG, "Failed to send delete intent for bubble with key: "
+ + entry.getKey());
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index 6f953d5..1d9f6b2 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -501,7 +501,7 @@
if (id == R.id.settings_button) {
Intent intent = mBubble.getSettingsIntent();
mStackView.collapseStack(() -> {
- mContext.startActivityAsUser(intent, mBubble.getEntry().notification.getUser());
+ mContext.startActivityAsUser(intent, mBubble.getEntry().getSbn().getUser());
logBubbleClickEvent(mBubble,
StatsLog.BUBBLE_UICHANGED__ACTION__HEADER_GO_TO_SETTINGS);
});
@@ -609,7 +609,7 @@
* @param action the user interaction enum.
*/
private void logBubbleClickEvent(Bubble bubble, int action) {
- StatusBarNotification notification = bubble.getEntry().notification;
+ StatusBarNotification notification = bubble.getEntry().getSbn();
StatsLog.write(StatsLog.BUBBLE_UI_CHANGED,
notification.getPackageName(),
notification.getNotification().getChannelId(),
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index 340dced..e5af389 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -629,7 +629,7 @@
}
Bubble topBubble = mBubbleData.getBubbles().get(0);
String appName = topBubble.getAppName();
- Notification notification = topBubble.getEntry().notification.getNotification();
+ Notification notification = topBubble.getEntry().getSbn().getNotification();
CharSequence titleCharSeq = notification.extras.getCharSequence(Notification.EXTRA_TITLE);
String titleStr = getResources().getString(R.string.stream_notification);
if (titleCharSeq != null) {
@@ -1681,7 +1681,7 @@
*/
private void logBubbleEvent(@Nullable Bubble bubble, int action) {
if (bubble == null || bubble.getEntry() == null
- || bubble.getEntry().notification == null) {
+ || bubble.getEntry().getSbn() == null) {
StatsLog.write(StatsLog.BUBBLE_UI_CHANGED,
null /* package name */,
null /* notification channel */,
@@ -1695,7 +1695,7 @@
false /* on-going bubble */,
false /* isAppForeground (unused) */);
} else {
- StatusBarNotification notification = bubble.getEntry().notification;
+ StatusBarNotification notification = bubble.getEntry().getSbn();
StatsLog.write(StatsLog.BUBBLE_UI_CHANGED,
notification.getPackageName(),
notification.getNotification().getChannelId(),
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java
index 4512aa8..780c314 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java
@@ -230,7 +230,7 @@
}
// Update icon.
Notification.BubbleMetadata metadata = mBubble.getEntry().getBubbleMetadata();
- Notification n = mBubble.getEntry().notification.getNotification();
+ Notification n = mBubble.getEntry().getSbn().getNotification();
Icon ic = metadata.getIcon();
boolean needsTint = ic.getType() != Icon.TYPE_ADAPTIVE_BITMAP;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java
index 33bcefb..e24a362 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java
@@ -65,7 +65,7 @@
Log.v(TAG, "showNotification");
}
addAlertEntry(entry);
- updateNotification(entry.key, true /* alert */);
+ updateNotification(entry.getKey(), true /* alert */);
entry.setInterruption();
}
@@ -182,7 +182,7 @@
protected final void addAlertEntry(@NonNull NotificationEntry entry) {
AlertEntry alertEntry = createAlertEntry();
alertEntry.setEntry(entry);
- mAlertEntries.put(entry.key, alertEntry);
+ mAlertEntries.put(entry.getKey(), alertEntry);
onAlertEntryAdded(alertEntry);
entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
}
@@ -251,7 +251,7 @@
@Override
public boolean shouldExtendLifetime(NotificationEntry entry) {
- return !canRemoveImmediately(entry.key);
+ return !canRemoveImmediately(entry.getKey());
}
@Override
@@ -260,7 +260,7 @@
mExtendedLifetimeAlertEntries.add(entry);
// We need to make sure that entries are stopping to alert eventually, let's remove
// this as soon as possible.
- AlertEntry alertEntry = mAlertEntries.get(entry.key);
+ AlertEntry alertEntry = mAlertEntries.get(entry.getKey());
alertEntry.removeAsSoonAsPossible();
} else {
mExtendedLifetimeAlertEntries.remove(entry);
@@ -276,7 +276,7 @@
@Nullable protected Runnable mRemoveAlertRunnable;
public void setEntry(@NonNull final NotificationEntry entry) {
- setEntry(entry, () -> removeAlertEntry(entry.key));
+ setEntry(entry, () -> removeAlertEntry(entry.getKey()));
}
public void setEntry(@NonNull final NotificationEntry entry,
@@ -332,7 +332,7 @@
public int compareTo(@NonNull AlertEntry alertEntry) {
return (mPostTime < alertEntry.mPostTime)
? 1 : ((mPostTime == alertEntry.mPostTime)
- ? mEntry.key.compareTo(alertEntry.mEntry.key) : -1);
+ ? mEntry.getKey().compareTo(alertEntry.mEntry.getKey()) : -1);
}
public void reset() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java
index 6ffea79..7adf7af 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java
@@ -323,7 +323,7 @@
exceedsPriorityThreshold = entry.getBucket() != BUCKET_SILENT;
} else {
exceedsPriorityThreshold =
- !getEntryManager().getNotificationData().isAmbient(entry.key);
+ !getEntryManager().getNotificationData().isAmbient(entry.getKey());
}
return mShowLockscreenNotifications && exceedsPriorityThreshold;
}
@@ -445,15 +445,15 @@
/** @return true if the entry needs redaction when on the lockscreen. */
public boolean needsRedaction(NotificationEntry ent) {
- int userId = ent.notification.getUserId();
+ int userId = ent.getSbn().getUserId();
boolean currentUserWantsRedaction = !userAllowsPrivateNotificationsInPublic(mCurrentUserId);
boolean notiUserWantsRedaction = !userAllowsPrivateNotificationsInPublic(userId);
boolean redactedLockscreen = currentUserWantsRedaction || notiUserWantsRedaction;
boolean notificationRequestsRedaction =
- ent.notification.getNotification().visibility == Notification.VISIBILITY_PRIVATE;
- boolean userForcesRedaction = packageHasVisibilityOverride(ent.notification.getKey());
+ ent.getSbn().getNotification().visibility == Notification.VISIBILITY_PRIVATE;
+ boolean userForcesRedaction = packageHasVisibilityOverride(ent.getSbn().getKey());
return userForcesRedaction || notificationRequestsRedaction && redactedLockscreen;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
index 3616b54..0988e34 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
@@ -204,7 +204,7 @@
NotificationEntry entry,
NotificationVisibility visibility,
boolean removedByUser) {
- onNotificationRemoved(entry.key);
+ onNotificationRemoved(entry.getKey());
}
});
@@ -284,7 +284,7 @@
if (entry.isMediaNotification()) {
final MediaSession.Token token =
- entry.notification.getNotification().extras.getParcelable(
+ entry.getSbn().getNotification().extras.getParcelable(
Notification.EXTRA_MEDIA_SESSION);
if (token != null) {
MediaController aController = new MediaController(mContext, token);
@@ -292,7 +292,7 @@
getMediaControllerPlaybackState(aController)) {
if (DEBUG_MEDIA) {
Log.v(TAG, "DEBUG_MEDIA: found mediastyle controller matching "
- + entry.notification.getKey());
+ + entry.getSbn().getKey());
}
mediaNotification = entry;
controller = aController;
@@ -321,10 +321,10 @@
for (int i = 0; i < N; i++) {
final NotificationEntry entry = activeNotifications.get(i);
- if (entry.notification.getPackageName().equals(pkg)) {
+ if (entry.getSbn().getPackageName().equals(pkg)) {
if (DEBUG_MEDIA) {
Log.v(TAG, "DEBUG_MEDIA: found controller matching "
- + entry.notification.getKey());
+ + entry.getSbn().getKey());
}
controller = aController;
mediaNotification = entry;
@@ -351,8 +351,8 @@
}
if (mediaNotification != null
- && !mediaNotification.notification.getKey().equals(mMediaNotificationKey)) {
- mMediaNotificationKey = mediaNotification.notification.getKey();
+ && !mediaNotification.getSbn().getKey().equals(mMediaNotificationKey)) {
+ mMediaNotificationKey = mediaNotification.getSbn().getKey();
if (DEBUG_MEDIA) {
Log.v(TAG, "DEBUG_MEDIA: Found new media notification: key="
+ mMediaNotificationKey);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java
index c9050d4..23968d5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java
@@ -293,7 +293,7 @@
mSmartReplyController.stopSending(entry);
if (removedByUser && entry != null) {
- onPerformRemoveNotification(entry, entry.key);
+ onPerformRemoveNotification(entry, entry.getKey());
}
}
});
@@ -307,8 +307,8 @@
@Override
public void onRemoteInputSent(NotificationEntry entry) {
if (FORCE_REMOTE_INPUT_HISTORY
- && isNotificationKeptForRemoteInputHistory(entry.key)) {
- mNotificationLifetimeFinishedCallback.onSafeToRemove(entry.key);
+ && isNotificationKeptForRemoteInputHistory(entry.getKey())) {
+ mNotificationLifetimeFinishedCallback.onSafeToRemove(entry.getKey());
} else if (mEntriesKeptForRemoteInputActive.contains(entry)) {
// We're currently holding onto this notification, but from the apps point of
// view it is already canceled, so we'll need to cancel it on the apps behalf
@@ -316,18 +316,18 @@
// bit.
mMainHandler.postDelayed(() -> {
if (mEntriesKeptForRemoteInputActive.remove(entry)) {
- mNotificationLifetimeFinishedCallback.onSafeToRemove(entry.key);
+ mNotificationLifetimeFinishedCallback.onSafeToRemove(entry.getKey());
}
}, REMOTE_INPUT_KEPT_ENTRY_AUTO_CANCEL_DELAY);
}
try {
- mBarService.onNotificationDirectReplied(entry.notification.getKey());
+ mBarService.onNotificationDirectReplied(entry.getSbn().getKey());
if (entry.editedSuggestionInfo != null) {
boolean modifiedBeforeSending =
!TextUtils.equals(entry.remoteInputText,
entry.editedSuggestionInfo.originalText);
mBarService.onNotificationSmartReplySent(
- entry.notification.getKey(),
+ entry.getSbn().getKey(),
entry.editedSuggestionInfo.index,
entry.editedSuggestionInfo.originalText,
NotificationLogger
@@ -487,7 +487,7 @@
NotificationEntry entry = mEntriesKeptForRemoteInputActive.valueAt(i);
mRemoteInputController.removeRemoteInput(entry, null);
if (mNotificationLifetimeFinishedCallback != null) {
- mNotificationLifetimeFinishedCallback.onSafeToRemove(entry.key);
+ mNotificationLifetimeFinishedCallback.onSafeToRemove(entry.getKey());
}
}
mEntriesKeptForRemoteInputActive.clear();
@@ -501,14 +501,15 @@
if (!FORCE_REMOTE_INPUT_HISTORY) {
return false;
}
- return (mRemoteInputController.isSpinning(entry.key) || entry.hasJustSentRemoteInput());
+ return (mRemoteInputController.isSpinning(entry.getKey())
+ || entry.hasJustSentRemoteInput());
}
public boolean shouldKeepForSmartReplyHistory(NotificationEntry entry) {
if (!FORCE_REMOTE_INPUT_HISTORY) {
return false;
}
- return mSmartReplyController.isSendingSmartReply(entry.key);
+ return mSmartReplyController.isSendingSmartReply(entry.getKey());
}
public void checkRemoteInputOutside(MotionEvent event) {
@@ -529,7 +530,7 @@
@VisibleForTesting
StatusBarNotification rebuildNotificationWithRemoteInput(NotificationEntry entry,
CharSequence remoteInputText, boolean showSpinner) {
- StatusBarNotification sbn = entry.notification;
+ StatusBarNotification sbn = entry.getSbn();
Notification.Builder b = Notification.Builder
.recoverBuilder(mContext, sbn.getNotification().clone());
@@ -637,12 +638,12 @@
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Keeping notification around after sending remote input "
- + entry.key);
+ + entry.getKey());
}
- mKeysKeptForRemoteInputHistory.add(entry.key);
+ mKeysKeptForRemoteInputHistory.add(entry.getKey());
} else {
- mKeysKeptForRemoteInputHistory.remove(entry.key);
+ mKeysKeptForRemoteInputHistory.remove(entry.getKey());
}
}
}
@@ -675,12 +676,12 @@
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Keeping notification around after sending smart reply "
- + entry.key);
+ + entry.getKey());
}
- mKeysKeptForRemoteInputHistory.add(entry.key);
+ mKeysKeptForRemoteInputHistory.add(entry.getKey());
} else {
- mKeysKeptForRemoteInputHistory.remove(entry.key);
+ mKeysKeptForRemoteInputHistory.remove(entry.getKey());
mSmartReplyController.stopSending(entry);
}
}
@@ -701,7 +702,7 @@
if (shouldExtend) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Keeping notification around while remote input active "
- + entry.key);
+ + entry.getKey());
}
mEntriesKeptForRemoteInputActive.add(entry);
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationUiAdjustment.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationUiAdjustment.java
index 266fe8d..564d8bc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationUiAdjustment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationUiAdjustment.java
@@ -54,7 +54,7 @@
public static NotificationUiAdjustment extractFromNotificationEntry(
NotificationEntry entry) {
return new NotificationUiAdjustment(
- entry.key, entry.getSmartActions(), entry.getSmartReplies());
+ entry.getKey(), entry.getSmartActions(), entry.getSmartReplies());
}
public static boolean needReinflate(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java
index 50d9bae..c2bb5b7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java
@@ -147,13 +147,13 @@
for (int i = 0; i < N; i++) {
NotificationEntry ent = activeNotifications.get(i);
if (ent.isRowDismissed() || ent.isRowRemoved()
- || mBubbleController.isBubbleNotificationSuppressedFromShade(ent.key)) {
+ || mBubbleController.isBubbleNotificationSuppressedFromShade(ent.getKey())) {
// we don't want to update removed notifications because they could
// temporarily become children if they were isolated before.
continue;
}
- int userId = ent.notification.getUserId();
+ int userId = ent.getSbn().getUserId();
// Display public version of the notification if we need to redact.
// TODO: This area uses a lot of calls into NotificationLockscreenUserManager.
@@ -174,8 +174,8 @@
currentUserId);
ent.setSensitive(sensitive, deviceSensitive);
ent.getRow().setNeedsRedaction(needsRedaction);
- if (mGroupManager.isChildInGroupWithSummary(ent.notification)) {
- NotificationEntry summary = mGroupManager.getGroupSummary(ent.notification);
+ if (mGroupManager.isChildInGroupWithSummary(ent.getSbn())) {
+ NotificationEntry summary = mGroupManager.getGroupSummary(ent.getSbn());
List<ExpandableNotificationRow> orderedChildren =
mTmpChildOrderMap.get(summary.getRow());
if (orderedChildren == null) {
@@ -382,7 +382,7 @@
ExpandableNotificationRow row = stack.pop();
NotificationEntry entry = row.getEntry();
boolean isChildNotification =
- mGroupManager.isChildInGroupWithSummary(entry.notification);
+ mGroupManager.isChildInGroupWithSummary(entry.getSbn());
row.setOnKeyguard(onKeyguard);
@@ -394,15 +394,15 @@
&& !row.isLowPriority()));
}
- int userId = entry.notification.getUserId();
+ int userId = entry.getSbn().getUserId();
boolean suppressedSummary = mGroupManager.isSummaryOfSuppressedGroup(
- entry.notification) && !entry.isRowRemoved();
+ entry.getSbn()) && !entry.isRowRemoved();
boolean showOnKeyguard = mLockscreenUserManager.shouldShowOnKeyguard(entry);
if (!showOnKeyguard) {
// min priority notifications should show if their summary is showing
- if (mGroupManager.isChildInGroupWithSummary(entry.notification)) {
+ if (mGroupManager.isChildInGroupWithSummary(entry.getSbn())) {
NotificationEntry summary = mGroupManager.getLogicalGroupSummary(
- entry.notification);
+ entry.getSbn());
if (summary != null && mLockscreenUserManager.shouldShowOnKeyguard(summary)) {
showOnKeyguard = true;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SmartReplyController.java b/packages/SystemUI/src/com/android/systemui/statusbar/SmartReplyController.java
index 736b9eb..7bdb21d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SmartReplyController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SmartReplyController.java
@@ -58,9 +58,9 @@
public void smartReplySent(NotificationEntry entry, int replyIndex, CharSequence reply,
int notificationLocation, boolean modifiedBeforeSending) {
mCallback.onSmartReplySent(entry, reply);
- mSendingKeys.add(entry.key);
+ mSendingKeys.add(entry.getKey());
try {
- mBarService.onNotificationSmartReplySent(entry.notification.getKey(), replyIndex, reply,
+ mBarService.onNotificationSmartReplySent(entry.getSbn().getKey(), replyIndex, reply,
notificationLocation, modifiedBeforeSending);
} catch (RemoteException e) {
// Nothing to do, system going down
@@ -74,14 +74,14 @@
NotificationEntry entry, int actionIndex, Notification.Action action,
boolean generatedByAssistant) {
final int count = mEntryManager.getNotificationData().getActiveNotifications().size();
- final int rank = mEntryManager.getNotificationData().getRank(entry.key);
+ final int rank = mEntryManager.getNotificationData().getRank(entry.getKey());
NotificationVisibility.NotificationLocation location =
NotificationLogger.getNotificationLocation(entry);
final NotificationVisibility nv = NotificationVisibility.obtain(
- entry.key, rank, count, true, location);
+ entry.getKey(), rank, count, true, location);
try {
mBarService.onNotificationActionClick(
- entry.key, actionIndex, action, nv, generatedByAssistant);
+ entry.getKey(), actionIndex, action, nv, generatedByAssistant);
} catch (RemoteException e) {
// Nothing to do, system going down
}
@@ -101,7 +101,7 @@
public void smartSuggestionsAdded(final NotificationEntry entry, int replyCount,
int actionCount, boolean generatedByAssistant, boolean editBeforeSending) {
try {
- mBarService.onNotificationSmartSuggestionsAdded(entry.notification.getKey(), replyCount,
+ mBarService.onNotificationSmartSuggestionsAdded(entry.getSbn().getKey(), replyCount,
actionCount, generatedByAssistant, editBeforeSending);
} catch (RemoteException e) {
// Nothing to do, system going down
@@ -110,7 +110,7 @@
public void stopSending(final NotificationEntry entry) {
if (entry != null) {
- mSendingKeys.remove(entry.notification.getKey());
+ mSendingKeys.remove(entry.getSbn().getKey());
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java
index d71d407..005f01d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java
@@ -80,7 +80,7 @@
NotificationEntry entry,
NotificationVisibility visibility,
boolean removedByUser) {
- stopAlerting(entry.key);
+ stopAlerting(entry.getKey());
}
});
}
@@ -104,7 +104,7 @@
mHeadsUpManager.showNotification(entry);
if (!mShadeController.get().isDozing()) {
// Mark as seen immediately
- setNotificationShown(entry.notification);
+ setNotificationShown(entry.getSbn());
}
} else {
entry.freeContentViewWhenSafe(FLAG_CONTENT_VIEW_HEADS_UP);
@@ -113,16 +113,16 @@
}
private void updateAlertState(NotificationEntry entry) {
- boolean alertAgain = alertAgain(entry, entry.notification.getNotification());
+ boolean alertAgain = alertAgain(entry, entry.getSbn().getNotification());
boolean shouldAlert;
shouldAlert = mNotificationInterruptionStateProvider.shouldHeadsUp(entry);
- final boolean wasAlerting = mHeadsUpManager.isAlerting(entry.key);
+ final boolean wasAlerting = mHeadsUpManager.isAlerting(entry.getKey());
if (wasAlerting) {
if (shouldAlert) {
- mHeadsUpManager.updateNotification(entry.key, alertAgain);
- } else if (!mHeadsUpManager.isEntryAutoHeadsUpped(entry.key)) {
+ mHeadsUpManager.updateNotification(entry.getKey(), alertAgain);
+ } else if (!mHeadsUpManager.isEntryAutoHeadsUpped(entry.getKey())) {
// We don't want this to be interrupting anymore, let's remove it
- mHeadsUpManager.removeNotification(entry.key, false /* removeImmediately */);
+ mHeadsUpManager.removeNotification(entry.getKey(), false /* removeImmediately */);
}
} else if (shouldAlert && alertAgain) {
// This notification was updated to be alerting, show it!
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
index 936ac49..f565868 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
@@ -110,7 +110,7 @@
pw.println("null");
} else {
for (NotificationEntry entry : mPendingNotifications.values()) {
- pw.println(entry.notification);
+ pw.println(entry.getSbn());
}
}
pw.println(" Lifetime-extended notifications:");
@@ -119,7 +119,7 @@
} else {
for (Map.Entry<NotificationEntry, NotificationLifetimeExtender> entry
: mRetainedNotifications.entrySet()) {
- pw.println(" " + entry.getKey().notification + " retained by "
+ pw.println(" " + entry.getKey().getSbn() + " retained by "
+ entry.getValue().getClass().getName());
}
}
@@ -242,11 +242,11 @@
@Override
public void onAsyncInflationFinished(NotificationEntry entry,
@InflationFlag int inflatedFlags) {
- mPendingNotifications.remove(entry.key);
+ mPendingNotifications.remove(entry.getKey());
// If there was an async task started after the removal, we don't want to add it back to
// the list, otherwise we might get leaks.
if (!entry.isRowRemoved()) {
- boolean isNew = mNotificationData.get(entry.key) == null;
+ boolean isNew = mNotificationData.get(entry.getKey()) == null;
if (isNew) {
for (NotificationEntryListener listener : mNotificationEntryListeners) {
listener.onEntryInflated(entry, inflatedFlags);
@@ -372,7 +372,7 @@
private void handleGroupSummaryRemoved(String key) {
NotificationEntry entry = mNotificationData.get(key);
if (entry != null && entry.rowExists() && entry.isSummaryWithChildren()) {
- if (entry.notification.getOverrideGroupKey() != null && !entry.isRowDismissed()) {
+ if (entry.getSbn().getOverrideGroupKey() != null && !entry.isRowDismissed()) {
// We don't want to remove children for autobundled notifications as they are not
// always cancelled. We only remove them if they were dismissed by the user.
return;
@@ -383,7 +383,7 @@
}
for (int i = 0; i < childEntries.size(); i++) {
NotificationEntry childEntry = childEntries.get(i);
- boolean isForeground = (entry.notification.getNotification().flags
+ boolean isForeground = (entry.getSbn().getNotification().flags
& Notification.FLAG_FOREGROUND_SERVICE) != 0;
boolean keepForReply =
getRemoteInputManager().shouldKeepForRemoteInputHistory(childEntry)
@@ -507,8 +507,8 @@
for (NotificationEntry entry : entries) {
NotificationUiAdjustment adjustment =
NotificationUiAdjustment.extractFromNotificationEntry(entry);
- oldAdjustments.put(entry.key, adjustment);
- oldImportances.put(entry.key, entry.getImportance());
+ oldAdjustments.put(entry.getKey(), adjustment);
+ oldImportances.put(entry.getKey(), entry.getImportance());
}
// Populate notification entries from the new rankings.
@@ -519,8 +519,8 @@
for (NotificationEntry entry : entries) {
requireBinder().onNotificationRankingUpdated(
entry,
- oldImportances.get(entry.key),
- oldAdjustments.get(entry.key),
+ oldImportances.get(entry.getKey()),
+ oldAdjustments.get(entry.getKey()),
NotificationUiAdjustment.extractFromNotificationEntry(entry));
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java
index 5a0b88c..b116409 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java
@@ -85,7 +85,7 @@
* @return true if the provided notification should NOT be shown right now.
*/
public boolean shouldFilterOut(NotificationEntry entry) {
- final StatusBarNotification sbn = entry.notification;
+ final StatusBarNotification sbn = entry.getSbn();
if (!(getEnvironment().isDeviceProvisioned()
|| showNotificationEvenIfUnprovisioned(sbn))) {
return true;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInterruptionStateProvider.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInterruptionStateProvider.java
index eadec6a..7d09932 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInterruptionStateProvider.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInterruptionStateProvider.java
@@ -164,7 +164,7 @@
* @return true if the entry should bubble up, false otherwise
*/
public boolean shouldBubbleUp(NotificationEntry entry) {
- final StatusBarNotification sbn = entry.notification;
+ final StatusBarNotification sbn = entry.getSbn();
if (!canAlertCommon(entry)) {
return false;
@@ -216,7 +216,7 @@
}
private boolean shouldHeadsUpWhenAwake(NotificationEntry entry) {
- StatusBarNotification sbn = entry.notification;
+ StatusBarNotification sbn = entry.getSbn();
if (!mUseHeadsUp) {
if (DEBUG_HEADS_UP) {
@@ -289,7 +289,7 @@
* @return true if the entry should ambient pulse, false otherwise
*/
private boolean shouldHeadsUpWhenDozing(NotificationEntry entry) {
- StatusBarNotification sbn = entry.notification;
+ StatusBarNotification sbn = entry.getSbn();
if (!mAmbientDisplayConfiguration.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) {
if (DEBUG_HEADS_UP) {
@@ -336,7 +336,7 @@
*/
@VisibleForTesting
public boolean canAlertCommon(NotificationEntry entry) {
- StatusBarNotification sbn = entry.notification;
+ StatusBarNotification sbn = entry.getSbn();
if (mNotificationFilter.shouldFilterOut(entry)) {
if (DEBUG || DEBUG_HEADS_UP) {
@@ -363,7 +363,7 @@
*/
@VisibleForTesting
public boolean canAlertAwakeCommon(NotificationEntry entry) {
- StatusBarNotification sbn = entry.notification;
+ StatusBarNotification sbn = entry.getSbn();
if (mPresenter.isDeviceInVrMode()) {
if (DEBUG_HEADS_UP) {
@@ -423,7 +423,7 @@
* @return {@code true} if we should launch the full screen intent
*/
public boolean shouldLaunchFullScreenIntentWhenAdded(NotificationEntry entry) {
- return entry.notification.getNotification().fullScreenIntent != null
+ return entry.getSbn().getNotification().fullScreenIntent != null
&& (!shouldHeadsUp(entry)
|| mStatusBarStateController.getState() == StatusBarState.KEYGUARD);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationListController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationListController.java
index 970cbf9..533dfb6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationListController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationListController.java
@@ -73,7 +73,7 @@
@Override
public void onBeforeNotificationAdded(NotificationEntry entry) {
- tagForeground(entry.notification);
+ tagForeground(entry.getSbn());
}
};
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java
index b8881ef..b551352 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java
@@ -199,7 +199,7 @@
// need to keep its lifetime extended.
cancelLifetimeExtension(entry);
- entry.setNotification(sbn);
+ entry.setSbn(sbn);
applyRanking(rankingMap);
dispatchOnEntryUpdated(entry);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java
index 505d46b..623ccca 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java
@@ -93,10 +93,10 @@
new Comparator<NotificationEntry>() {
@Override
public int compare(NotificationEntry a, NotificationEntry b) {
- final StatusBarNotification na = a.notification;
- final StatusBarNotification nb = b.notification;
- int aRank = getRank(a.key);
- int bRank = getRank(b.key);
+ final StatusBarNotification na = a.getSbn();
+ final StatusBarNotification nb = b.getSbn();
+ int aRank = getRank(a.getKey());
+ int bRank = getRank(b.getKey());
boolean aMedia = isImportantMedia(a);
boolean bMedia = isImportantMedia(b);
@@ -164,7 +164,7 @@
final int len = mEntries.size();
for (int i = 0; i < len; i++) {
NotificationEntry entry = mEntries.valueAt(i);
- final StatusBarNotification sbn = entry.notification;
+ final StatusBarNotification sbn = entry.getSbn();
if (!getEnvironment().isNotificationForCurrentProfiles(sbn)) {
continue;
}
@@ -180,7 +180,7 @@
public void add(NotificationEntry entry) {
synchronized (mEntries) {
- mEntries.put(entry.notification.getKey(), entry);
+ mEntries.put(entry.getSbn().getKey(), entry);
}
mGroupManager.onEntryAdded(entry);
@@ -205,8 +205,8 @@
StatusBarNotification notification,
String reason) {
updateRanking(ranking, reason);
- final StatusBarNotification oldNotification = entry.notification;
- entry.setNotification(notification);
+ final StatusBarNotification oldNotification = entry.getSbn();
+ entry.setSbn(notification);
mGroupManager.onEntryUpdated(entry, oldNotification);
}
@@ -222,9 +222,9 @@
final int len = mEntries.size();
for (int i = 0; i < len; i++) {
NotificationEntry entry = mEntries.valueAt(i);
- if (uid == entry.notification.getUid()
- && pkg.equals(entry.notification.getPackageName())
- && key.equals(entry.key)) {
+ if (uid == entry.getSbn().getUid()
+ && pkg.equals(entry.getSbn().getPackageName())
+ && key.equals(entry.getKey())) {
if (showIcon) {
entry.mActiveAppOps.add(appOp);
} else {
@@ -251,7 +251,7 @@
final ArrayList<NotificationEntry> logicalChildren =
mGroupManager.getLogicalChildren(statusBarNotification);
for (NotificationEntry child : logicalChildren) {
- if (isHighPriority(child.notification)) {
+ if (isHighPriority(child.getSbn())) {
return true;
}
}
@@ -339,7 +339,7 @@
private boolean isImportantMedia(NotificationEntry e) {
int importance = e.getRanking().getImportance();
- boolean media = e.key.equals(getMediaManager().getMediaNotificationKey())
+ boolean media = e.getKey().equals(getMediaManager().getMediaNotificationKey())
&& importance > NotificationManager.IMPORTANCE_MIN;
return media;
@@ -348,7 +348,7 @@
private boolean isSystemMax(NotificationEntry e) {
int importance = e.getRanking().getImportance();
boolean sys = importance >= NotificationManager.IMPORTANCE_HIGH
- && isSystemNotification(e.notification);
+ && isSystemNotification(e.getSbn());
return sys;
}
@@ -369,18 +369,18 @@
for (int i = 0; i < len; i++) {
NotificationEntry entry = mEntries.valueAt(i);
Ranking newRanking = new Ranking();
- if (!getRanking(entry.key, newRanking)) {
+ if (!getRanking(entry.getKey(), newRanking)) {
continue;
}
entry.setRanking(newRanking);
- final StatusBarNotification oldSbn = entry.notification.cloneLight();
+ final StatusBarNotification oldSbn = entry.getSbn().cloneLight();
final String overrideGroupKey = newRanking.getOverrideGroupKey();
if (!Objects.equals(oldSbn.getOverrideGroupKey(), overrideGroupKey)) {
- entry.notification.setOverrideGroupKey(overrideGroupKey);
+ entry.getSbn().setOverrideGroupKey(overrideGroupKey);
mGroupManager.onEntryUpdated(entry, oldSbn);
}
- entry.setIsHighPriority(isHighPriority(entry.notification));
+ entry.setIsHighPriority(isHighPriority(entry.getSbn()));
}
}
}
@@ -481,10 +481,10 @@
}
private void dumpEntry(PrintWriter pw, String indent, int i, NotificationEntry e) {
- getRanking(e.key, mTmpRanking);
+ getRanking(e.getKey(), mTmpRanking);
pw.print(indent);
- pw.println(" [" + i + "] key=" + e.key + " icon=" + e.icon);
- StatusBarNotification n = e.notification;
+ pw.println(" [" + i + "] key=" + e.getKey() + " icon=" + e.icon);
+ StatusBarNotification n = e.getSbn();
pw.print(indent);
pw.println(" pkg=" + n.getPackageName() + " id=" + n.getId() + " importance="
+ mTmpRanking.getImportance());
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
index 076c2af..e004ca7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
@@ -30,6 +30,7 @@
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_STATUS_BAR;
+import static com.android.internal.util.Preconditions.checkNotNull;
import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManager.BUCKET_ALERTING;
import android.annotation.NonNull;
@@ -90,8 +91,8 @@
private static final long NOT_LAUNCHED_YET = -LAUNCH_COOLDOWN;
private static final int COLOR_INVALID = 1;
- public final String key;
- public StatusBarNotification notification;
+ private final String mKey;
+ private StatusBarNotification mSbn;
private Ranking mRanking;
@@ -175,14 +176,18 @@
public NotificationEntry(
@NonNull StatusBarNotification sbn,
@NonNull Ranking ranking) {
- this.key = sbn.getKey();
- setNotification(sbn);
+ checkNotNull(sbn);
+ checkNotNull(sbn.getKey());
+ checkNotNull(ranking);
+
+ mKey = sbn.getKey();
+ setSbn(sbn);
setRanking(ranking);
}
/** The key for this notification. Guaranteed to be immutable and unique */
public String getKey() {
- return key;
+ return mKey;
}
/**
@@ -190,19 +195,23 @@
* being the Ranking). This object is swapped out whenever a notification is updated.
*/
public StatusBarNotification getSbn() {
- return notification;
+ return mSbn;
}
/**
* Should only be called by NotificationEntryManager and friends.
* TODO: Make this package-private
*/
- public void setNotification(StatusBarNotification sbn) {
- if (sbn.getKey() != null && key != null && !sbn.getKey().equals(key)) {
+ public void setSbn(@NonNull StatusBarNotification sbn) {
+ checkNotNull(sbn);
+ checkNotNull(sbn.getKey());
+
+ if (!sbn.getKey().equals(mKey)) {
throw new IllegalArgumentException("New key " + sbn.getKey()
- + " doesn't match existing key " + key);
+ + " doesn't match existing key " + mKey);
}
- notification = sbn;
+
+ mSbn = sbn;
updatePeopleList();
}
@@ -220,9 +229,12 @@
* TODO: Make this package-private
*/
public void setRanking(@NonNull Ranking ranking) {
- if (!ranking.getKey().equals(key)) {
+ checkNotNull(ranking);
+ checkNotNull(ranking.getKey());
+
+ if (!ranking.getKey().equals(mKey)) {
throw new IllegalArgumentException("New key " + ranking.getKey()
- + " doesn't match existing key " + key);
+ + " doesn't match existing key " + mKey);
}
mRanking = ranking;
isVisuallyInterruptive = ranking.visuallyInterruptive();
@@ -292,13 +304,13 @@
}
public boolean isBubble() {
- return (notification.getNotification().flags & FLAG_BUBBLE) != 0;
+ return (mSbn.getNotification().flags & FLAG_BUBBLE) != 0;
}
private void updatePeopleList() {
mAssociatedPeople.clear();
- Bundle extras = notification.getNotification().extras;
+ Bundle extras = mSbn.getNotification().extras;
if (extras == null) {
return;
}
@@ -310,7 +322,7 @@
}
if (Notification.MessagingStyle.class.equals(
- notification.getNotification().getNotificationStyle())) {
+ mSbn.getNotification().getNotificationStyle())) {
final Parcelable[] messages = extras.getParcelableArray(EXTRA_MESSAGES);
if (!ArrayUtils.isEmpty(messages)) {
for (Notification.MessagingStyle.Message message :
@@ -330,7 +342,7 @@
* Returns the data needed for a bubble for this notification, if it exists.
*/
public Notification.BubbleMetadata getBubbleMetadata() {
- return notification.getNotification().getBubbleMetadata();
+ return mSbn.getNotification().getBubbleMetadata();
}
/**
@@ -452,7 +464,7 @@
});
// Construct the centered icon
- if (notification.getNotification().isMediaNotification()) {
+ if (mSbn.getNotification().isMediaNotification()) {
centeredIcon = new StatusBarIconView(context,
sbn.getPackageName() + "/0x" + Integer.toHexString(sbn.getId()), sbn);
centeredIcon.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@@ -492,8 +504,8 @@
// Update the icon
Notification n = sbn.getNotification();
final StatusBarIcon ic = new StatusBarIcon(
- notification.getUser(),
- notification.getPackageName(),
+ mSbn.getUser(),
+ mSbn.getPackageName(),
n.getSmallIcon(),
n.iconLevel,
n.number,
@@ -517,7 +529,7 @@
public int getContrastedColor(Context context, boolean isLowPriority,
int backgroundColor) {
int rawColor = isLowPriority ? Notification.COLOR_DEFAULT :
- notification.getNotification().color;
+ mSbn.getNotification().color;
if (mCachedContrastColorIsFor == rawColor && mCachedContrastColor != COLOR_INVALID) {
return mCachedContrastColor;
}
@@ -583,7 +595,7 @@
if (!hasSentReply) {
return false;
}
- Bundle extras = notification.getNotification().extras;
+ Bundle extras = mSbn.getNotification().extras;
CharSequence[] replyTexts = extras.getCharSequenceArray(
Notification.EXTRA_REMOTE_INPUT_HISTORY);
if (!ArrayUtils.isEmpty(replyTexts)) {
@@ -785,7 +797,7 @@
* @see #canViewBeDismissed()
*/
public boolean isClearable() {
- if (notification == null || !notification.isClearable()) {
+ if (!mSbn.isClearable()) {
return false;
}
@@ -808,15 +820,15 @@
@VisibleForTesting
boolean isExemptFromDndVisualSuppression() {
- if (isNotificationBlockedByPolicy(notification.getNotification())) {
+ if (isNotificationBlockedByPolicy(mSbn.getNotification())) {
return false;
}
- if ((notification.getNotification().flags
+ if ((mSbn.getNotification().flags
& Notification.FLAG_FOREGROUND_SERVICE) != 0) {
return true;
}
- if (notification.getNotification().isMediaNotification()) {
+ if (mSbn.getNotification().isMediaNotification()) {
return true;
}
if (mIsSystemNotification != null && mIsSystemNotification) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRowBinderImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRowBinderImpl.java
index e5571b6..5dbb9c5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRowBinderImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRowBinderImpl.java
@@ -135,9 +135,9 @@
throws InflationException {
ViewGroup parent = mListContainer.getViewParentForNotification(entry);
PackageManager pmUser = StatusBar.getPackageManagerForUser(mContext,
- entry.notification.getUser().getIdentifier());
+ entry.getSbn().getUser().getIdentifier());
- final StatusBarNotification sbn = entry.notification;
+ final StatusBarNotification sbn = entry.getSbn();
if (entry.rowExists()) {
entry.updateIcons(mContext, sbn);
entry.reset();
@@ -156,7 +156,7 @@
private void bindRow(NotificationEntry entry, PackageManager pmUser,
StatusBarNotification sbn, ExpandableNotificationRow row,
Runnable onDismissRunnable) {
- row.setExpansionLogger(mExpansionLogger, entry.notification.getKey());
+ row.setExpansionLogger(mExpansionLogger, entry.getSbn().getKey());
row.setBypassController(mKeyguardBypassController);
row.setStatusBarStateController(mStatusBarStateController);
row.setGroupManager(mGroupManager);
@@ -213,8 +213,8 @@
entry.reset();
PackageManager pmUser = StatusBar.getPackageManagerForUser(
mContext,
- entry.notification.getUser().getIdentifier());
- updateNotification(entry, pmUser, entry.notification, entry.getRow());
+ entry.getSbn().getUser().getIdentifier());
+ updateNotification(entry, pmUser, entry.getSbn(), entry.getRow());
} else {
// Once the RowInflaterTask is done, it will pick up the updated entry, so
// no-op here.
@@ -248,7 +248,7 @@
// TODO: should updates to the entry be happening somewhere else?
entry.setIconTag(R.id.icon_is_pre_L, entry.targetSdk < Build.VERSION_CODES.LOLLIPOP);
- entry.autoRedacted = entry.notification.getNotification().publicVersion == null;
+ entry.autoRedacted = entry.getSbn().getNotification().publicVersion == null;
entry.setRow(row);
row.setOnActivatedListener(mPresenter);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java
index 81275fd..b7f408e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java
@@ -126,7 +126,7 @@
int N = activeNotifications.size();
for (int i = 0; i < N; i++) {
NotificationEntry entry = activeNotifications.get(i);
- String key = entry.notification.getKey();
+ String key = entry.getSbn().getKey();
boolean isVisible = mListContainer.isInVisibleLocation(entry);
NotificationVisibility visObj = NotificationVisibility.obtain(key, i, N, isVisible,
getNotificationLocation(entry));
@@ -214,14 +214,14 @@
NotificationVisibility visibility,
boolean removedByUser) {
if (removedByUser && visibility != null) {
- logNotificationClear(entry.key, entry.notification, visibility);
+ logNotificationClear(entry.getKey(), entry.getSbn(), visibility);
}
- mExpansionStateLogger.onEntryRemoved(entry.key);
+ mExpansionStateLogger.onEntryRemoved(entry.getKey());
}
@Override
public void onEntryReinflated(NotificationEntry entry) {
- mExpansionStateLogger.onEntryReinflated(entry.key);
+ mExpansionStateLogger.onEntryReinflated(entry.getKey());
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
index 924a347..536db67 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
@@ -442,7 +442,7 @@
*/
public void setEntry(@NonNull NotificationEntry entry) {
mEntry = entry;
- mStatusBarNotification = entry.notification;
+ mStatusBarNotification = entry.getSbn();
cacheIsSystemNotification();
}
@@ -1203,7 +1203,7 @@
// Let's update our childrencontainer. This is intentionally not guarded with
// mIsSummaryWithChildren since we might have had children but not anymore.
if (mChildrenContainer != null) {
- mChildrenContainer.reInflateViews(mExpandClickListener, mEntry.notification);
+ mChildrenContainer.reInflateViews(mExpandClickListener, mEntry.getSbn());
}
if (mGuts != null) {
NotificationGuts oldGuts = mGuts;
@@ -2303,7 +2303,7 @@
private void updateRippleAllowed() {
boolean allowed = isOnKeyguard()
- || mEntry.notification.getNotification().contentIntent == null;
+ || mEntry.getSbn().getNotification().contentIntent == null;
setRippleAllowed(allowed);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
index a612a17..a91a119 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
@@ -230,7 +230,7 @@
}
// Only inflate the ones that are set.
reInflateFlags &= mInflationFlags;
- StatusBarNotification sbn = mRow.getEntry().notification;
+ StatusBarNotification sbn = mRow.getEntry().getSbn();
// To check if the notification has inline image and preload inline image if necessary.
mRow.getImageResolver().preloadImages(sbn.getNotification());
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
index f30a8b1..b12c76c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
@@ -1097,7 +1097,7 @@
}
public void onNotificationUpdated(NotificationEntry entry) {
- mStatusBarNotification = entry.notification;
+ mStatusBarNotification = entry.getSbn();
mOnContentViewInactiveListeners.clear();
mBeforeN = entry.targetSdk < Build.VERSION_CODES.N;
updateAllSingleLineViews();
@@ -1179,7 +1179,7 @@
: mHeadsUpInflatedSmartReplies.getSmartRepliesAndActions();
if (DEBUG) {
Log.d(TAG, String.format("Adding suggestions for %s, %d actions, and %d replies.",
- entry.notification.getKey(),
+ entry.getSbn().getKey(),
mCurrentSmartRepliesAndActions.smartActions == null ? 0 :
mCurrentSmartRepliesAndActions.smartActions.actions.size(),
mCurrentSmartRepliesAndActions.smartReplies == null ? 0 :
@@ -1253,7 +1253,7 @@
}
}
if (hasRemoteInput) {
- int color = entry.notification.getNotification().color;
+ int color = entry.getSbn().getNotification().color;
if (color == Notification.COLOR_DEFAULT) {
color = mContext.getColor(R.color.default_remote_input_background);
}
@@ -1267,7 +1267,7 @@
if (existingPendingIntent != null || existing.isActive()) {
// The current action could be gone, or the pending intent no longer valid.
// If we find a matching action in the new notification, focus, otherwise close.
- Notification.Action[] actions = entry.notification.getNotification().actions;
+ Notification.Action[] actions = entry.getSbn().getNotification().actions;
if (existingPendingIntent != null) {
existing.setPendingIntent(existingPendingIntent);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
index 2b7deec..1de2cbb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
@@ -494,15 +494,17 @@
@Override
public void setShouldManageLifetime(NotificationEntry entry, boolean shouldExtend) {
if (shouldExtend) {
- mKeyToRemoveOnGutsClosed = entry.key;
+ mKeyToRemoveOnGutsClosed = entry.getKey();
if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "Keeping notification because it's showing guts. " + entry.key);
+ Log.d(TAG, "Keeping notification because it's showing guts. " + entry.getKey());
}
} else {
- if (mKeyToRemoveOnGutsClosed != null && mKeyToRemoveOnGutsClosed.equals(entry.key)) {
+ if (mKeyToRemoveOnGutsClosed != null
+ && mKeyToRemoveOnGutsClosed.equals(entry.getKey())) {
mKeyToRemoveOnGutsClosed = null;
if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "Notification that was kept for guts was updated. " + entry.key);
+ Log.d(TAG, "Notification that was kept for guts was updated. "
+ + entry.getKey());
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
index 1116106..5d5c09e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
@@ -175,7 +175,7 @@
mActions = mView.findViewById(com.android.internal.R.id.media_actions);
mIsViewVisible = mView.isShown();
- final MediaSession.Token token = mRow.getEntry().notification.getNotification().extras
+ final MediaSession.Token token = mRow.getEntry().getSbn().getNotification().extras
.getParcelable(Notification.EXTRA_MEDIA_SESSION);
boolean showCompactSeekbar = mMediaManager.getShowCompactMediaSeekbar();
@@ -404,7 +404,7 @@
* @return new LogMaker
*/
private LogMaker newLog(int event) {
- String packageName = mRow.getEntry().notification.getPackageName();
+ String packageName = mRow.getEntry().getSbn().getPackageName();
return new LogMaker(MetricsEvent.MEDIA_NOTIFICATION_SEEKBAR)
.setType(event)
@@ -416,7 +416,7 @@
* @return new LogMaker
*/
private LogMaker newLog(int event, int subtype) {
- String packageName = mRow.getEntry().notification.getPackageName();
+ String packageName = mRow.getEntry().getSbn().getPackageName();
return new LogMaker(MetricsEvent.MEDIA_NOTIFICATION_SEEKBAR)
.setType(event)
.setSubtype(subtype)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java
index 3950003..c2eff8a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java
@@ -63,7 +63,7 @@
return new NotificationMessagingTemplateViewWrapper(ctx, v, row);
}
Class<? extends Notification.Style> style =
- row.getEntry().notification.getNotification().getNotificationStyle();
+ row.getEntry().getSbn().getNotification().getNotificationStyle();
if (Notification.DecoratedCustomViewStyle.class.equals(style)) {
return new NotificationDecoratedCustomViewWrapper(ctx, v, row);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
index f3d068a..ecab188 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
@@ -22,7 +22,6 @@
import android.util.MathUtils;
import android.view.View;
-import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.StatusBarState;
@@ -410,7 +409,7 @@
if (!mPulsing || mHeadUpManager == null) {
return false;
}
- return mHeadUpManager.isAlerting(entry.key);
+ return mHeadUpManager.isAlerting(entry.getKey());
}
public boolean isPanelTracking() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java
index d0444ae..6ed4a57 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java
@@ -284,12 +284,12 @@
ActivatableNotificationView first = s.getFirstVisibleChild();
String fs = first == null ? "(null)"
: (first instanceof ExpandableNotificationRow)
- ? ((ExpandableNotificationRow) first).getEntry().key
+ ? ((ExpandableNotificationRow) first).getEntry().getKey()
: Integer.toHexString(System.identityHashCode(first));
ActivatableNotificationView last = s.getLastVisibleChild();
String ls = last == null ? "(null)"
: (last instanceof ExpandableNotificationRow)
- ? ((ExpandableNotificationRow) last).getEntry().key
+ ? ((ExpandableNotificationRow) last).getEntry().getKey()
: Integer.toHexString(System.identityHashCode(last));
android.util.Log.d(TAG, "updateSections: f=" + fs + " s=" + i);
android.util.Log.d(TAG, "updateSections: l=" + ls + " s=" + i);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 9817825..5a1a217 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -602,7 +602,7 @@
mEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
@Override
public void onPostEntryUpdated(NotificationEntry entry) {
- if (!entry.notification.isClearable()) {
+ if (!entry.getSbn().isClearable()) {
// The user may have performed a dismiss action on the notification, since it's
// not clearable we should snap it back.
snapViewIfNeeded(entry);
@@ -1627,7 +1627,7 @@
if (!mIsExpanded && row.isHeadsUp() && row.isPinned()
&& mHeadsUpManager.getTopEntry().getRow() != row
&& mGroupManager.getGroupSummary(
- mHeadsUpManager.getTopEntry().notification)
+ mHeadsUpManager.getTopEntry().getSbn())
!= entry) {
continue;
}
@@ -5525,12 +5525,12 @@
// TODO: This is a listener method; we shouldn't be calling it. Can we just
// call performRemoveNotification as below?
mEntryManager.removeNotification(
- rowToRemove.getEntry().key,
+ rowToRemove.getEntry().getKey(),
null /* ranking */,
NotificationListenerService.REASON_CANCEL_ALL);
} else {
mEntryManager.performRemoveNotification(
- rowToRemove.getEntry().notification,
+ rowToRemove.getEntry().getSbn(),
NotificationListenerService.REASON_CANCEL_ALL);
}
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
index c6d051d..4e06c84 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
@@ -197,9 +197,9 @@
mReleaseOnExpandFinish = false;
} else {
for (NotificationEntry entry : mEntriesToRemoveAfterExpand) {
- if (isAlerting(entry.key)) {
+ if (isAlerting(entry.getKey())) {
// Maybe the heads-up was removed already
- removeAlertEntry(entry.key);
+ removeAlertEntry(entry.getKey());
}
}
}
@@ -291,7 +291,7 @@
*/
public void setRemoteInputActive(
@NonNull NotificationEntry entry, boolean remoteInputActive) {
- HeadsUpEntryPhone headsUpEntry = getHeadsUpEntryPhone(entry.key);
+ HeadsUpEntryPhone headsUpEntry = getHeadsUpEntryPhone(entry.getKey());
if (headsUpEntry != null && headsUpEntry.remoteInputActive != remoteInputActive) {
headsUpEntry.remoteInputActive = remoteInputActive;
if (remoteInputActive) {
@@ -307,7 +307,7 @@
* area if it's pinned until it's hidden again.
*/
public void setMenuShown(@NonNull NotificationEntry entry, boolean menuShown) {
- HeadsUpEntry headsUpEntry = getHeadsUpEntry(entry.key);
+ HeadsUpEntry headsUpEntry = getHeadsUpEntry(entry.getKey());
if (headsUpEntry instanceof HeadsUpEntryPhone && entry.isRowPinned()) {
((HeadsUpEntryPhone) headsUpEntry).setMenuShownPinned(menuShown);
}
@@ -375,7 +375,7 @@
} else {
if (topEntry.isChildInGroup()) {
final NotificationEntry groupSummary =
- mGroupManager.getGroupSummary(topEntry.notification);
+ mGroupManager.getGroupSummary(topEntry.getSbn());
if (groupSummary != null) {
topEntry = groupSummary;
}
@@ -429,9 +429,9 @@
public void onReorderingAllowed() {
mAnimationStateHandler.setHeadsUpGoingAwayAnimationsAllowed(false);
for (NotificationEntry entry : mEntriesToRemoveWhenReorderingAllowed) {
- if (isAlerting(entry.key)) {
+ if (isAlerting(entry.getKey())) {
// Maybe the heads-up was removed already
- removeAlertEntry(entry.key);
+ removeAlertEntry(entry.getKey());
}
}
mEntriesToRemoveWhenReorderingAllowed.clear();
@@ -448,7 +448,7 @@
@Override
protected void onAlertEntryRemoved(AlertEntry alertEntry) {
- mKeysToRemoveWhenLeavingKeyguard.remove(alertEntry.mEntry.key);
+ mKeysToRemoveWhenLeavingKeyguard.remove(alertEntry.mEntry.getKey());
super.onAlertEntryRemoved(alertEntry);
mEntryPool.release((HeadsUpEntryPhone) alertEntry);
}
@@ -533,9 +533,9 @@
} else if (mTrackingHeadsUp) {
mEntriesToRemoveAfterExpand.add(entry);
} else if (mIsAutoHeadsUp && mStatusBarState == StatusBarState.KEYGUARD) {
- mKeysToRemoveWhenLeavingKeyguard.add(entry.key);
+ mKeysToRemoveWhenLeavingKeyguard.add(entry.getKey());
} else {
- removeAlertEntry(entry.key);
+ removeAlertEntry(entry.getKey());
}
};
@@ -553,7 +553,7 @@
if (mEntriesToRemoveWhenReorderingAllowed.contains(mEntry)) {
mEntriesToRemoveWhenReorderingAllowed.remove(mEntry);
}
- mKeysToRemoveWhenLeavingKeyguard.remove(mEntry.key);
+ mKeysToRemoveWhenLeavingKeyguard.remove(mEntry.getKey());
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelper.java
index 4d69f77e..2798285 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelper.java
@@ -105,7 +105,7 @@
* @return true if the entry was transferred to and should inflate + alert
*/
public boolean isAlertTransferPending(@NonNull NotificationEntry entry) {
- PendingAlertInfo alertInfo = mPendingAlerts.get(entry.key);
+ PendingAlertInfo alertInfo = mPendingAlerts.get(entry.getKey());
return alertInfo != null && alertInfo.isStillValid();
}
@@ -141,7 +141,7 @@
@Override
public void onGroupSuppressionChanged(NotificationGroup group, boolean suppressed) {
if (suppressed) {
- if (mHeadsUpManager.isAlerting(group.summary.key)) {
+ if (mHeadsUpManager.isAlerting(group.summary.getKey())) {
handleSuppressedSummaryAlerted(group.summary, mHeadsUpManager);
}
} else {
@@ -151,11 +151,11 @@
return;
}
GroupAlertEntry groupAlertEntry = mGroupAlertEntries.get(mGroupManager.getGroupKey(
- group.summary.notification));
+ group.summary.getSbn()));
// Group is no longer suppressed. We should check if we need to transfer the alert
// back to the summary now that it's no longer suppressed.
if (groupAlertEntry.mAlertSummaryOnNextAddition) {
- if (!mHeadsUpManager.isAlerting(group.summary.key)) {
+ if (!mHeadsUpManager.isAlerting(group.summary.getKey())) {
alertNotificationWhenPossible(group.summary, mHeadsUpManager);
}
groupAlertEntry.mAlertSummaryOnNextAddition = false;
@@ -173,7 +173,7 @@
private void onAlertStateChanged(NotificationEntry entry, boolean isAlerting,
AlertingNotificationManager alertManager) {
- if (isAlerting && mGroupManager.isSummaryOfSuppressedGroup(entry.notification)) {
+ if (isAlerting && mGroupManager.isSummaryOfSuppressedGroup(entry.getSbn())) {
handleSuppressedSummaryAlerted(entry, alertManager);
}
}
@@ -184,7 +184,7 @@
// see as early as we can if we need to abort a transfer.
@Override
public void onPendingEntryAdded(NotificationEntry entry) {
- String groupKey = mGroupManager.getGroupKey(entry.notification);
+ String groupKey = mGroupManager.getGroupKey(entry.getSbn());
GroupAlertEntry groupAlertEntry = mGroupAlertEntries.get(groupKey);
if (groupAlertEntry != null) {
checkShouldTransferBack(groupAlertEntry);
@@ -195,7 +195,7 @@
// then show the alert.
@Override
public void onEntryReinflated(NotificationEntry entry) {
- PendingAlertInfo alertInfo = mPendingAlerts.remove(entry.key);
+ PendingAlertInfo alertInfo = mPendingAlerts.remove(entry.getKey());
if (alertInfo != null) {
if (alertInfo.isStillValid()) {
alertNotificationWhenPossible(entry, mHeadsUpManager);
@@ -214,7 +214,7 @@
// Removes any alerts pending on this entry. Note that this will not stop any inflation
// tasks started by a transfer, so this should only be used as clean-up for when
// inflation is stopped and the pending alert no longer needs to happen.
- mPendingAlerts.remove(entry.key);
+ mPendingAlerts.remove(entry.getKey());
}
};
@@ -267,10 +267,10 @@
*/
private boolean isPendingNotificationInGroup(@NonNull NotificationEntry entry,
@NonNull NotificationGroup group) {
- String groupKey = mGroupManager.getGroupKey(group.summary.notification);
- return mGroupManager.isGroupChild(entry.notification)
- && Objects.equals(mGroupManager.getGroupKey(entry.notification), groupKey)
- && !group.children.containsKey(entry.key);
+ String groupKey = mGroupManager.getGroupKey(group.summary.getSbn());
+ return mGroupManager.isGroupChild(entry.getSbn())
+ && Objects.equals(mGroupManager.getGroupKey(entry.getSbn()), groupKey)
+ && !group.children.containsKey(entry.getKey());
}
/**
@@ -284,10 +284,10 @@
*/
private void handleSuppressedSummaryAlerted(@NonNull NotificationEntry summary,
@NonNull AlertingNotificationManager alertManager) {
- StatusBarNotification sbn = summary.notification;
+ StatusBarNotification sbn = summary.getSbn();
GroupAlertEntry groupAlertEntry =
mGroupAlertEntries.get(mGroupManager.getGroupKey(sbn));
- if (!mGroupManager.isSummaryOfSuppressedGroup(summary.notification)
+ if (!mGroupManager.isSummaryOfSuppressedGroup(summary.getSbn())
|| !alertManager.isAlerting(sbn.getKey())
|| groupAlertEntry == null) {
return;
@@ -298,7 +298,8 @@
return;
}
- NotificationEntry child = mGroupManager.getLogicalChildren(summary.notification).iterator().next();
+ NotificationEntry child =
+ mGroupManager.getLogicalChildren(summary.getSbn()).iterator().next();
if (child != null) {
if (child.getRow().keepInParent()
|| child.isRowRemoved()
@@ -306,7 +307,7 @@
// The notification is actually already removed. No need to alert it.
return;
}
- if (!alertManager.isAlerting(child.key) && onlySummaryAlerts(summary)) {
+ if (!alertManager.isAlerting(child.getKey()) && onlySummaryAlerts(summary)) {
groupAlertEntry.mLastAlertTransferTime = SystemClock.elapsedRealtime();
}
transferAlertState(summary, child, alertManager);
@@ -324,7 +325,7 @@
*/
private void transferAlertState(@NonNull NotificationEntry fromEntry, @NonNull NotificationEntry toEntry,
@NonNull AlertingNotificationManager alertManager) {
- alertManager.removeNotification(fromEntry.key, true /* releaseImmediately */);
+ alertManager.removeNotification(fromEntry.getKey(), true /* releaseImmediately */);
alertNotificationWhenPossible(toEntry, alertManager);
}
@@ -347,7 +348,8 @@
if (!onlySummaryAlerts(summary)) {
return;
}
- ArrayList<NotificationEntry> children = mGroupManager.getLogicalChildren(summary.notification);
+ ArrayList<NotificationEntry> children = mGroupManager.getLogicalChildren(
+ summary.getSbn());
int numChildren = children.size();
int numPendingChildren = getPendingChildrenNotAlerting(groupAlertEntry.mGroup);
numChildren += numPendingChildren;
@@ -357,17 +359,18 @@
boolean releasedChild = false;
for (int i = 0; i < children.size(); i++) {
NotificationEntry entry = children.get(i);
- if (onlySummaryAlerts(entry) && mHeadsUpManager.isAlerting(entry.key)) {
+ if (onlySummaryAlerts(entry) && mHeadsUpManager.isAlerting(entry.getKey())) {
releasedChild = true;
- mHeadsUpManager.removeNotification(entry.key, true /* releaseImmediately */);
+ mHeadsUpManager.removeNotification(
+ entry.getKey(), true /* releaseImmediately */);
}
- if (mPendingAlerts.containsKey(entry.key)) {
+ if (mPendingAlerts.containsKey(entry.getKey())) {
// This is the child that would've been removed if it was inflated.
releasedChild = true;
- mPendingAlerts.get(entry.key).mAbortOnInflation = true;
+ mPendingAlerts.get(entry.getKey()).mAbortOnInflation = true;
}
}
- if (releasedChild && !mHeadsUpManager.isAlerting(summary.key)) {
+ if (releasedChild && !mHeadsUpManager.isAlerting(summary.getKey())) {
boolean notifyImmediately = (numChildren - numPendingChildren) > 1;
if (notifyImmediately) {
alertNotificationWhenPossible(summary, mHeadsUpManager);
@@ -391,20 +394,20 @@
@NonNull AlertingNotificationManager alertManager) {
@InflationFlag int contentFlag = alertManager.getContentFlag();
if (!entry.getRow().isInflationFlagSet(contentFlag)) {
- mPendingAlerts.put(entry.key, new PendingAlertInfo(entry));
+ mPendingAlerts.put(entry.getKey(), new PendingAlertInfo(entry));
entry.getRow().updateInflationFlag(contentFlag, true /* shouldInflate */);
entry.getRow().inflateViews();
return;
}
- if (alertManager.isAlerting(entry.key)) {
- alertManager.updateNotification(entry.key, true /* alert */);
+ if (alertManager.isAlerting(entry.getKey())) {
+ alertManager.updateNotification(entry.getKey(), true /* alert */);
} else {
alertManager.showNotification(entry);
}
}
private boolean onlySummaryAlerts(NotificationEntry entry) {
- return entry.notification.getNotification().getGroupAlertBehavior()
+ return entry.getSbn().getNotification().getGroupAlertBehavior()
== Notification.GROUP_ALERT_SUMMARY;
}
@@ -431,7 +434,7 @@
boolean mAbortOnInflation;
PendingAlertInfo(NotificationEntry entry) {
- mOriginalNotification = entry.notification;
+ mOriginalNotification = entry.getSbn();
mEntry = entry;
}
@@ -445,11 +448,11 @@
// Notification is aborted due to the transfer being explicitly cancelled
return false;
}
- if (mEntry.notification.getGroupKey() != mOriginalNotification.getGroupKey()) {
+ if (mEntry.getSbn().getGroupKey() != mOriginalNotification.getGroupKey()) {
// Groups have changed
return false;
}
- if (mEntry.notification.getNotification().isGroupSummary()
+ if (mEntry.getSbn().getNotification().isGroupSummary()
!= mOriginalNotification.getNotification().isGroupSummary()) {
// Notification has changed from group summary to not or vice versa
return false;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java
index adaea93..e11fc1b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java
@@ -103,8 +103,8 @@
}
public void onEntryRemoved(NotificationEntry removed) {
- onEntryRemovedInternal(removed, removed.notification);
- mIsolatedEntries.remove(removed.key);
+ onEntryRemovedInternal(removed, removed.getSbn());
+ mIsolatedEntries.remove(removed.getKey());
}
/**
@@ -126,7 +126,7 @@
return;
}
if (isGroupChild(sbn)) {
- group.children.remove(removed.key);
+ group.children.remove(removed.getKey());
} else {
group.summary = null;
}
@@ -145,7 +145,7 @@
if (added.isRowRemoved()) {
added.setDebugThrowable(new Throwable());
}
- final StatusBarNotification sbn = added.notification;
+ final StatusBarNotification sbn = added.getSbn();
boolean isGroupChild = isGroupChild(sbn);
String groupKey = getGroupKey(sbn);
NotificationGroup group = mGroupMap.get(groupKey);
@@ -157,17 +157,17 @@
}
}
if (isGroupChild) {
- NotificationEntry existing = group.children.get(added.key);
+ NotificationEntry existing = group.children.get(added.getKey());
if (existing != null && existing != added) {
Throwable existingThrowable = existing.getDebugThrowable();
- Log.wtf(TAG, "Inconsistent entries found with the same key " + added.key
+ Log.wtf(TAG, "Inconsistent entries found with the same key " + added.getKey()
+ "existing removed: " + existing.isRowRemoved()
+ (existingThrowable != null
? Log.getStackTraceString(existingThrowable) + "\n": "")
+ " added removed" + added.isRowRemoved()
, new Throwable());
}
- group.children.put(added.key, added);
+ group.children.put(added.getKey(), added);
updateSuppression(group);
} else {
group.summary = added;
@@ -210,7 +210,7 @@
group.suppressed = group.summary != null && !group.expanded
&& (childCount == 1
|| (childCount == 0
- && group.summary.notification.getNotification().isGroupSummary()
+ && group.summary.getSbn().getNotification().isGroupSummary()
&& (hasIsolatedChildren(group) || hasBubbles)));
if (prevSuppressed != group.suppressed) {
for (OnGroupChangeListener listener : mListeners) {
@@ -223,7 +223,7 @@
}
private boolean hasIsolatedChildren(NotificationGroup group) {
- return getNumberOfIsolatedChildren(group.summary.notification.getGroupKey()) != 0;
+ return getNumberOfIsolatedChildren(group.summary.getSbn().getGroupKey()) != 0;
}
private int getNumberOfIsolatedChildren(String groupKey) {
@@ -248,18 +248,18 @@
public void onEntryUpdated(NotificationEntry entry,
StatusBarNotification oldNotification) {
String oldKey = oldNotification.getGroupKey();
- String newKey = entry.notification.getGroupKey();
+ String newKey = entry.getSbn().getGroupKey();
boolean groupKeysChanged = !oldKey.equals(newKey);
boolean wasGroupChild = isGroupChild(oldNotification);
- boolean isGroupChild = isGroupChild(entry.notification);
+ boolean isGroupChild = isGroupChild(entry.getSbn());
mIsUpdatingUnchangedGroup = !groupKeysChanged && wasGroupChild == isGroupChild;
if (mGroupMap.get(getGroupKey(oldNotification)) != null) {
onEntryRemovedInternal(entry, oldNotification);
}
onEntryAdded(entry);
mIsUpdatingUnchangedGroup = false;
- if (isIsolated(entry.notification)) {
- mIsolatedEntries.put(entry.key, entry.notification);
+ if (isIsolated(entry.getSbn())) {
+ mIsolatedEntries.put(entry.getKey(), entry.getSbn());
if (groupKeysChanged) {
updateSuppression(mGroupMap.get(oldKey));
updateSuppression(mGroupMap.get(newKey));
@@ -284,7 +284,7 @@
}
NotificationEntry logicalGroupSummary = getLogicalGroupSummary(sbn);
return logicalGroupSummary != null
- && !logicalGroupSummary.notification.equals(sbn);
+ && !logicalGroupSummary.getSbn().equals(sbn);
}
private int getTotalNumberOfChildren(StatusBarNotification sbn) {
@@ -351,7 +351,7 @@
if (group == null || group.summary == null) {
return false;
}
- return !group.children.isEmpty() && Objects.equals(group.summary.notification, sbn);
+ return !group.children.isEmpty() && Objects.equals(group.summary.getSbn(), sbn);
}
/**
@@ -404,7 +404,7 @@
* will update the suppression of that group.
*/
public void updateSuppression(NotificationEntry entry) {
- NotificationGroup group = mGroupMap.get(getGroupKey(entry.notification));
+ NotificationGroup group = mGroupMap.get(getGroupKey(entry.getSbn()));
if (group != null) {
updateSuppression(group);
}
@@ -489,12 +489,12 @@
*/
private boolean shouldIsolate(NotificationEntry entry) {
- StatusBarNotification sbn = entry.notification;
+ StatusBarNotification sbn = entry.getSbn();
NotificationGroup notificationGroup = mGroupMap.get(sbn.getGroupKey());
if (!sbn.isGroup() || sbn.getNotification().isGroupSummary()) {
return false;
}
- if (mHeadsUpManager != null && !mHeadsUpManager.isAlerting(entry.key)) {
+ if (mHeadsUpManager != null && !mHeadsUpManager.isAlerting(entry.getKey())) {
return false;
}
return (sbn.getNotification().fullScreenIntent != null
@@ -509,10 +509,10 @@
* @param entry the notification to isolate
*/
private void isolateNotification(NotificationEntry entry) {
- StatusBarNotification sbn = entry.notification;
+ StatusBarNotification sbn = entry.getSbn();
// We will be isolated now, so lets update the groups
- onEntryRemovedInternal(entry, entry.notification);
+ onEntryRemovedInternal(entry, entry.getSbn());
mIsolatedEntries.put(sbn.getKey(), sbn);
@@ -521,7 +521,7 @@
// even before the groupManager knows about the notification at all.
// When the notification gets added afterwards it is already isolated and therefore
// it doesn't lead to an update.
- updateSuppression(mGroupMap.get(entry.notification.getGroupKey()));
+ updateSuppression(mGroupMap.get(entry.getSbn().getGroupKey()));
for (OnGroupChangeListener listener : mListeners) {
listener.onGroupsChanged();
}
@@ -533,10 +533,10 @@
* @param entry the notification to un-isolate
*/
private void stopIsolatingNotification(NotificationEntry entry) {
- StatusBarNotification sbn = entry.notification;
+ StatusBarNotification sbn = entry.getSbn();
if (mIsolatedEntries.containsKey(sbn.getKey())) {
// not isolated anymore, we need to update the groups
- onEntryRemovedInternal(entry, entry.notification);
+ onEntryRemovedInternal(entry, entry.getSbn());
mIsolatedEntries.remove(sbn.getKey());
onEntryAdded(entry);
for (OnGroupChangeListener listener : mListeners) {
@@ -584,13 +584,13 @@
@Override
public String toString() {
String result = " summary:\n "
- + (summary != null ? summary.notification : "null")
+ + (summary != null ? summary.getSbn() : "null")
+ (summary != null && summary.getDebugThrowable() != null
? Log.getStackTraceString(summary.getDebugThrowable())
: "");
result += "\n children size: " + children.size();
for (NotificationEntry child : children.values()) {
- result += "\n " + child.notification
+ result += "\n " + child.getSbn()
+ (child.getDebugThrowable() != null
? Log.getStackTraceString(child.getDebugThrowable())
: "");
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
index 1a37520..1e10b6f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
@@ -247,10 +247,10 @@
if (hideCenteredIcon && isCenteredNotificationIcon && !entry.isRowHeadsUp()) {
return false;
}
- if (mEntryManager.getNotificationData().isAmbient(entry.key) && !showAmbient) {
+ if (mEntryManager.getNotificationData().isAmbient(entry.getKey()) && !showAmbient) {
return false;
}
- if (hideCurrentMedia && entry.key.equals(mMediaManager.getMediaNotificationKey())) {
+ if (hideCurrentMedia && entry.getKey().equals(mMediaManager.getMediaNotificationKey())) {
return false;
}
if (!entry.isTopLevelChild()) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 8e70d082..550c950 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -1895,7 +1895,7 @@
public void maybeEscalateHeadsUp() {
mHeadsUpManager.getAllEntries().forEach(entry -> {
- final StatusBarNotification sbn = entry.notification;
+ final StatusBarNotification sbn = entry.getSbn();
final Notification notification = sbn.getNotification();
if (notification.fullScreenIntent != null) {
if (DEBUG) {
@@ -3696,9 +3696,7 @@
// Indicate that the group expansion is changing at this time -- this way the group
// and children backgrounds / divider animations will look correct.
entry.setGroupExpansionChanging(true);
- if (entry.notification != null) {
- userId = entry.notification.getUserId();
- }
+ userId = entry.getSbn().getUserId();
}
boolean fullShadeNeedsBouncer = !mLockscreenUserManager.
userAllowsPrivateNotificationsInPublic(mLockscreenUserManager.getCurrentUserId())
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
index dfec195..64a45e1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
@@ -245,7 +245,7 @@
StatusBarNotification parentToCancel = null;
if (shouldAutoCancel(sbn) && mGroupManager.isOnlyChildInGroup(sbn)) {
StatusBarNotification summarySbn =
- mGroupManager.getLogicalGroupSummary(sbn).notification;
+ mGroupManager.getLogicalGroupSummary(sbn).getSbn();
if (shouldAutoCancel(summarySbn)) {
parentToCancel = summarySbn;
}
@@ -310,7 +310,7 @@
if (!TextUtils.isEmpty(entry.remoteInputText)) {
remoteInputText = entry.remoteInputText;
}
- if (!TextUtils.isEmpty(remoteInputText) && !controller.isSpinning(entry.key)) {
+ if (!TextUtils.isEmpty(remoteInputText) && !controller.isSpinning(entry.getKey())) {
fillInIntent = new Intent().putExtra(Notification.EXTRA_REMOTE_INPUT_DRAFT,
remoteInputText.toString());
}
@@ -409,11 +409,11 @@
if (mNotificationInterruptionStateProvider.shouldLaunchFullScreenIntentWhenAdded(entry)) {
if (shouldSuppressFullScreenIntent(entry)) {
if (DEBUG) {
- Log.d(TAG, "No Fullscreen intent: suppressed by DND: " + entry.key);
+ Log.d(TAG, "No Fullscreen intent: suppressed by DND: " + entry.getKey());
}
} else if (entry.getImportance() < NotificationManager.IMPORTANCE_HIGH) {
if (DEBUG) {
- Log.d(TAG, "No Fullscreen intent: not important enough: " + entry.key);
+ Log.d(TAG, "No Fullscreen intent: not important enough: " + entry.getKey());
}
} else {
// Stop screensaver if the notification has a fullscreen intent.
@@ -432,8 +432,8 @@
}
try {
EventLog.writeEvent(EventLogTags.SYSUI_FULLSCREEN_NOTIFICATION,
- entry.key);
- entry.notification.getNotification().fullScreenIntent.send();
+ entry.getKey());
+ entry.getSbn().getNotification().fullScreenIntent.send();
entry.notifyFullScreenIntentLaunched();
mMetricsLogger.count("note_fullscreen", 1);
} catch (PendingIntent.CanceledException e) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
index f4a26ba..b01a8d4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
@@ -201,7 +201,7 @@
NotificationVisibility visibility,
boolean removedByUser) {
StatusBarNotificationPresenter.this.onNotificationRemoved(
- entry.key, entry.notification);
+ entry.getKey(), entry.getSbn());
if (removedByUser) {
maybeEndAmbientPulse();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java
index b84dc47..6828c32 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java
@@ -117,7 +117,7 @@
}
protected boolean hasFullScreenIntent(@NonNull NotificationEntry entry) {
- return entry.notification.getNotification().fullScreenIntent != null;
+ return entry.getSbn().getNotification().fullScreenIntent != null;
}
protected void setEntryPinned(
@@ -206,7 +206,7 @@
public void snooze() {
for (String key : mAlertEntries.keySet()) {
AlertEntry entry = getHeadsUpEntry(key);
- String packageName = entry.mEntry.notification.getPackageName();
+ String packageName = entry.mEntry.getSbn().getPackageName();
mSnoozedPackages.put(snoozeKey(packageName, mUser),
mClock.currentTimeMillis() + mSnoozeLengthMs);
}
@@ -328,8 +328,8 @@
* one should be ranked higher and 0 if they are equal.
*/
public int compare(@NonNull NotificationEntry a, @NonNull NotificationEntry b) {
- AlertEntry aEntry = getHeadsUpEntry(a.key);
- AlertEntry bEntry = getHeadsUpEntry(b.key);
+ AlertEntry aEntry = getHeadsUpEntry(a.getKey());
+ AlertEntry bEntry = getHeadsUpEntry(b.getKey());
if (aEntry == null || bEntry == null) {
return aEntry == null ? 1 : -1;
}
@@ -341,7 +341,7 @@
* until it's collapsed again.
*/
public void setExpanded(@NonNull NotificationEntry entry, boolean expanded) {
- HeadsUpEntry headsUpEntry = getHeadsUpEntry(entry.key);
+ HeadsUpEntry headsUpEntry = getHeadsUpEntry(entry.getKey());
if (headsUpEntry != null && entry.isRowPinned()) {
headsUpEntry.setExpanded(expanded);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/InflatedSmartReplies.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/InflatedSmartReplies.java
index be27741..c6ae669 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/InflatedSmartReplies.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/InflatedSmartReplies.java
@@ -144,13 +144,13 @@
return false;
}
// If we are showing the spinner we don't want to add the buttons.
- boolean showingSpinner = entry.notification.getNotification()
+ boolean showingSpinner = entry.getSbn().getNotification()
.extras.getBoolean(Notification.EXTRA_SHOW_REMOTE_INPUT_SPINNER, false);
if (showingSpinner) {
return false;
}
// If we are keeping the notification around while sending we don't want to add the buttons.
- boolean hideSmartReplies = entry.notification.getNotification()
+ boolean hideSmartReplies = entry.getSbn().getNotification()
.extras.getBoolean(Notification.EXTRA_HIDE_SMART_REPLIES, false);
if (hideSmartReplies) {
return false;
@@ -168,7 +168,7 @@
public static SmartRepliesAndActions chooseSmartRepliesAndActions(
SmartReplyConstants smartReplyConstants,
final NotificationEntry entry) {
- Notification notification = entry.notification.getNotification();
+ Notification notification = entry.getSbn().getNotification();
Pair<RemoteInput, Notification.Action> remoteInputActionPair =
notification.findRemoteInputActionPair(false /* freeform */);
Pair<RemoteInput, Notification.Action> freeformRemoteInputActionPair =
@@ -177,7 +177,7 @@
if (!smartReplyConstants.isEnabled()) {
if (DEBUG) {
Log.d(TAG, "Smart suggestions not enabled, not adding suggestions for "
- + entry.notification.getKey());
+ + entry.getSbn().getKey());
}
return new SmartRepliesAndActions(null, null);
}
@@ -271,7 +271,7 @@
* through the remote input.
*/
public static boolean hasFreeformRemoteInput(NotificationEntry entry) {
- Notification notification = entry.notification.getNotification();
+ Notification notification = entry.getSbn().getNotification();
return null != notification.findRemoteInputActionPair(true /* freeform */);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
index cca9479..7b4a7d2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
@@ -175,7 +175,7 @@
results.put(contentType, data);
try {
mStatusBarManagerService.grantInlineReplyUriPermission(
- mEntry.notification.getKey(), data);
+ mEntry.getSbn().getKey(), data);
} catch (Exception e) {
Log.e(TAG, "Failed to grant URI permissions:" + e.getMessage(), e);
}
@@ -191,7 +191,7 @@
mProgressBar.setVisibility(VISIBLE);
mEntry.remoteInputText = mEditText.getText();
mEntry.lastRemoteInputSent = SystemClock.elapsedRealtime();
- mController.addSpinning(mEntry.key, mToken);
+ mController.addSpinning(mEntry.getKey(), mToken);
mController.removeRemoteInput(mEntry, mToken);
mEditText.mShowImeOnInputConnection = false;
mController.remoteInputSent(mEntry);
@@ -203,17 +203,17 @@
// but that's an edge case, and also because we can't always know which package will receive
// an intent, so we just reset for the publisher.
getContext().getSystemService(ShortcutManager.class).onApplicationActive(
- mEntry.notification.getPackageName(),
- mEntry.notification.getUser().getIdentifier());
+ mEntry.getSbn().getPackageName(),
+ mEntry.getSbn().getUser().getIdentifier());
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_REMOTE_INPUT_SEND,
- mEntry.notification.getPackageName());
+ mEntry.getSbn().getPackageName());
try {
mPendingIntent.send(mContext, 0, intent);
} catch (PendingIntent.CanceledException e) {
Log.i(TAG, "Unable to send remote input result", e);
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_REMOTE_INPUT_FAIL,
- mEntry.notification.getPackageName());
+ mEntry.getSbn().getPackageName());
}
}
@@ -228,7 +228,7 @@
LayoutInflater.from(context).inflate(R.layout.remote_input, root, false);
v.mController = controller;
v.mEntry = entry;
- UserHandle user = computeTextOperationUser(entry.notification.getUser());
+ UserHandle user = computeTextOperationUser(entry.getSbn().getUser());
v.mEditText.mUser = user;
v.mEditText.setTextOperationUser(user);
v.setTag(VIEW_TAG);
@@ -284,7 +284,7 @@
mRemoteInputQuickSettingsDisabler.setRemoteInputActive(false);
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_REMOTE_INPUT_CLOSE,
- mEntry.notification.getPackageName());
+ mEntry.getSbn().getPackageName());
}
@Override
@@ -304,7 +304,7 @@
return;
}
mController.removeRemoteInput(mEntry, mToken);
- mController.removeSpinning(mEntry.key, mToken);
+ mController.removeSpinning(mEntry.getKey(), mToken);
}
public void setPendingIntent(PendingIntent pendingIntent) {
@@ -349,7 +349,7 @@
public void focus() {
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_REMOTE_INPUT_OPEN,
- mEntry.notification.getPackageName());
+ mEntry.getSbn().getPackageName());
setVisibility(VISIBLE);
if (mWrapper != null) {
@@ -388,7 +388,7 @@
mEditText.setEnabled(true);
mSendButton.setVisibility(VISIBLE);
mProgressBar.setVisibility(INVISIBLE);
- mController.removeSpinning(mEntry.key, mToken);
+ mController.removeSpinning(mEntry.getKey(), mToken);
updateSendButton();
onDefocus(false /* animate */);
@@ -540,7 +540,7 @@
}
public boolean isSending() {
- return getVisibility() == VISIBLE && mController.isSpinning(mEntry.key, mToken);
+ return getVisibility() == VISIBLE && mController.isSpinning(mEntry.getKey(), mToken);
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
index b5f660a..65bb28f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
@@ -350,7 +350,7 @@
() -> {
smartReplyController.smartActionClicked(
entry, actionIndex, action, smartActions.fromAssistant);
- headsUpManager.removeNotification(entry.key, true);
+ headsUpManager.removeNotification(entry.getKey(), true);
}, entry.getRow());
if (useDelayedOnClickListener) {
onClickListener = new DelayedOnClickListener(onClickListener,