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,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java
index 3472573..0068113 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java
@@ -172,8 +172,8 @@
 
         // Return non-null notification data from the NEM
         when(mNotificationEntryManager.getNotificationData()).thenReturn(mNotificationData);
-        when(mNotificationData.get(mRow.getEntry().key)).thenReturn(mRow.getEntry());
-        when(mNotificationData.getChannel(mRow.getEntry().key)).thenReturn(
+        when(mNotificationData.get(mRow.getEntry().getKey())).thenReturn(mRow.getEntry());
+        when(mNotificationData.getChannel(mRow.getEntry().getKey())).thenReturn(
                 mRow.getEntry().getChannel());
 
         mZenModeConfig.suppressedVisualEffects = 0;
@@ -228,14 +228,15 @@
     @Test
     public void testRemoveBubble() {
         mBubbleController.updateBubble(mRow.getEntry());
-        assertNotNull(mBubbleData.getBubbleWithKey(mRow.getEntry().key));
+        assertNotNull(mBubbleData.getBubbleWithKey(mRow.getEntry().getKey()));
         assertTrue(mBubbleController.hasBubbles());
         verify(mNotificationEntryManager).updateNotifications(any());
         verify(mBubbleStateChangeListener).onHasBubblesChanged(true);
 
-        mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_USER_GESTURE);
+        mBubbleController.removeBubble(
+                mRow.getEntry().getKey(), BubbleController.DISMISS_USER_GESTURE);
         assertFalse(mStatusBarWindowController.getBubblesShowing());
-        assertNull(mBubbleData.getBubbleWithKey(mRow.getEntry().key));
+        assertNull(mBubbleData.getBubbleWithKey(mRow.getEntry().getKey()));
         verify(mNotificationEntryManager, times(2)).updateNotifications(anyString());
         verify(mBubbleStateChangeListener).onHasBubblesChanged(false);
     }
@@ -246,18 +247,20 @@
         mBubbleController.updateBubble(mRow.getEntry());
 
         assertTrue(mBubbleController.hasBubbles());
-        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
 
         // Make it look like dismissed notif
-        mBubbleData.getBubbleWithKey(mRow.getEntry().key).setShowInShadeWhenBubble(false);
+        mBubbleData.getBubbleWithKey(mRow.getEntry().getKey()).setShowInShadeWhenBubble(false);
 
         // Now remove the bubble
-        mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_USER_GESTURE);
+        mBubbleController.removeBubble(
+                mRow.getEntry().getKey(), BubbleController.DISMISS_USER_GESTURE);
 
         // Since the notif is dismissed, once the bubble is removed, performRemoveNotification gets
         // called to really remove the notif
         verify(mNotificationEntryManager, times(1)).performRemoveNotification(
-                mRow.getEntry().notification, UNDEFINED_DISMISS_REASON);
+                mRow.getEntry().getSbn(), UNDEFINED_DISMISS_REASON);
         assertFalse(mBubbleController.hasBubbles());
     }
 
@@ -265,17 +268,17 @@
     public void testDismissStack() {
         mBubbleController.updateBubble(mRow.getEntry());
         verify(mNotificationEntryManager, times(1)).updateNotifications(any());
-        assertNotNull(mBubbleData.getBubbleWithKey(mRow.getEntry().key));
+        assertNotNull(mBubbleData.getBubbleWithKey(mRow.getEntry().getKey()));
         mBubbleController.updateBubble(mRow2.getEntry());
         verify(mNotificationEntryManager, times(2)).updateNotifications(any());
-        assertNotNull(mBubbleData.getBubbleWithKey(mRow2.getEntry().key));
+        assertNotNull(mBubbleData.getBubbleWithKey(mRow2.getEntry().getKey()));
         assertTrue(mBubbleController.hasBubbles());
 
         mBubbleController.dismissStack(BubbleController.DISMISS_USER_GESTURE);
         assertFalse(mStatusBarWindowController.getBubblesShowing());
         verify(mNotificationEntryManager, times(3)).updateNotifications(any());
-        assertNull(mBubbleData.getBubbleWithKey(mRow.getEntry().key));
-        assertNull(mBubbleData.getBubbleWithKey(mRow2.getEntry().key));
+        assertNull(mBubbleData.getBubbleWithKey(mRow.getEntry().getKey()));
+        assertNull(mBubbleData.getBubbleWithKey(mRow2.getEntry().getKey()));
     }
 
     @Test
@@ -288,22 +291,24 @@
 
         // We should have bubbles & their notifs should not be suppressed
         assertTrue(mBubbleController.hasBubbles());
-        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
         assertFalse(mStatusBarWindowController.getBubbleExpanded());
 
         // Expand the stack
         BubbleStackView stackView = mBubbleController.getStackView();
         mBubbleController.expandStack();
         assertTrue(mBubbleController.isStackExpanded());
-        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getEntry().key);
+        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getEntry().getKey());
         assertTrue(mStatusBarWindowController.getBubbleExpanded());
 
         // Make sure the notif is suppressed
-        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
 
         // Collapse
         mBubbleController.collapseStack();
-        verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getEntry().key);
+        verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getEntry().getKey());
         assertFalse(mBubbleController.isStackExpanded());
         assertFalse(mStatusBarWindowController.getBubbleExpanded());
     }
@@ -318,30 +323,33 @@
 
         // We should have bubbles & their notifs should not be suppressed
         assertTrue(mBubbleController.hasBubbles());
-        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
         assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(
-                mRow2.getEntry().key));
+                mRow.getEntry().getKey()));
+        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow2.getEntry().getKey()));
 
         // Expand
         BubbleStackView stackView = mBubbleController.getStackView();
         mBubbleController.expandStack();
         assertTrue(mBubbleController.isStackExpanded());
-        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow2.getEntry().key);
+        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow2.getEntry().getKey());
 
         // Last added is the one that is expanded
         assertEquals(mRow2.getEntry(), stackView.getExpandedBubbleView().getEntry());
-        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow2.getEntry().key));
+        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow2.getEntry().getKey()));
 
         // Switch which bubble is expanded
-        mBubbleController.selectBubble(mRow.getEntry().key);
-        stackView.setExpandedBubble(mRow.getEntry().key);
+        mBubbleController.selectBubble(mRow.getEntry().getKey());
+        stackView.setExpandedBubble(mRow.getEntry().getKey());
         assertEquals(mRow.getEntry(), stackView.getExpandedBubbleView().getEntry());
-        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
 
         // collapse for previous bubble
-        verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow2.getEntry().key);
+        verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow2.getEntry().getKey());
         // expand for selected bubble
-        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getEntry().key);
+        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getEntry().getKey());
 
         // Collapse
         mBubbleController.collapseStack();
@@ -356,18 +364,20 @@
 
         // We should have bubbles & their notifs should not be suppressed
         assertTrue(mBubbleController.hasBubbles());
-        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
-        assertTrue(mBubbleData.getBubbleWithKey(mRow.getEntry().key).showBubbleDot());
+        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
+        assertTrue(mBubbleData.getBubbleWithKey(mRow.getEntry().getKey()).showBubbleDot());
 
         // Expand
         mBubbleController.expandStack();
         assertTrue(mBubbleController.isStackExpanded());
-        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getEntry().key);
+        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getEntry().getKey());
 
         // Notif is suppressed after expansion
-        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
         // Notif shouldn't show dot after expansion
-        assertFalse(mBubbleData.getBubbleWithKey(mRow.getEntry().key).showBubbleDot());
+        assertFalse(mBubbleData.getBubbleWithKey(mRow.getEntry().getKey()).showBubbleDot());
     }
 
     @Test
@@ -378,28 +388,31 @@
 
         // We should have bubbles & their notifs should not be suppressed
         assertTrue(mBubbleController.hasBubbles());
-        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
-        assertTrue(mBubbleData.getBubbleWithKey(mRow.getEntry().key).showBubbleDot());
+        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
+        assertTrue(mBubbleData.getBubbleWithKey(mRow.getEntry().getKey()).showBubbleDot());
 
         // Expand
         BubbleStackView stackView = mBubbleController.getStackView();
         mBubbleController.expandStack();
         assertTrue(mBubbleController.isStackExpanded());
-        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getEntry().key);
+        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getEntry().getKey());
 
         // Notif is suppressed after expansion
-        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
         // Notif shouldn't show dot after expansion
-        assertFalse(mBubbleData.getBubbleWithKey(mRow.getEntry().key).showBubbleDot());
+        assertFalse(mBubbleData.getBubbleWithKey(mRow.getEntry().getKey()).showBubbleDot());
 
         // Send update
         mEntryListener.onPreEntryUpdated(mRow.getEntry());
 
         // Nothing should have changed
         // Notif is suppressed after expansion
-        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
         // Notif shouldn't show dot after expansion
-        assertFalse(mBubbleData.getBubbleWithKey(mRow.getEntry().key).showBubbleDot());
+        assertFalse(mBubbleData.getBubbleWithKey(mRow.getEntry().getKey()).showBubbleDot());
     }
 
     @Test
@@ -416,27 +429,28 @@
         mBubbleController.expandStack();
 
         assertTrue(mBubbleController.isStackExpanded());
-        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow2.getEntry().key);
+        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow2.getEntry().getKey());
 
         // Last added is the one that is expanded
         assertEquals(mRow2.getEntry(), stackView.getExpandedBubbleView().getEntry());
-        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow2.getEntry().key));
+        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow2.getEntry().getKey()));
 
         // Dismiss currently expanded
         mBubbleController.removeBubble(stackView.getExpandedBubbleView().getKey(),
                 BubbleController.DISMISS_USER_GESTURE);
-        verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow2.getEntry().key);
+        verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow2.getEntry().getKey());
 
         // Make sure first bubble is selected
         assertEquals(mRow.getEntry(), stackView.getExpandedBubbleView().getEntry());
-        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getEntry().key);
+        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getEntry().getKey());
 
         // Dismiss that one
         mBubbleController.removeBubble(stackView.getExpandedBubbleView().getKey(),
                 BubbleController.DISMISS_USER_GESTURE);
 
         // Make sure state changes and collapse happens
-        verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getEntry().key);
+        verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getEntry().getKey());
         verify(mBubbleStateChangeListener).onHasBubblesChanged(false);
         assertFalse(mBubbleController.hasBubbles());
     }
@@ -453,7 +467,7 @@
 
         // Expansion shouldn't change
         verify(mBubbleExpandListener, never()).onBubbleExpandChanged(false /* expanded */,
-                mRow.getEntry().key);
+                mRow.getEntry().getKey());
         assertFalse(mBubbleController.isStackExpanded());
 
         // # of bubbles should change
@@ -471,7 +485,7 @@
 
         // Expansion should change
         verify(mBubbleExpandListener).onBubbleExpandChanged(true /* expanded */,
-                mRow.getEntry().key);
+                mRow.getEntry().getKey());
         assertTrue(mBubbleController.isStackExpanded());
 
         // # of bubbles should change
@@ -488,7 +502,8 @@
         mBubbleController.updateBubble(mRow.getEntry());
 
         // Should not be suppressed because we weren't forground
-        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
         // # of bubbles should change
         verify(mBubbleStateChangeListener).onHasBubblesChanged(true /* hasBubbles */);
     }
@@ -503,7 +518,8 @@
         mBubbleController.updateBubble(mRow.getEntry());
 
         // Notif should be suppressed because we were foreground
-        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
 
         // # of bubbles should change
         verify(mBubbleStateChangeListener).onHasBubblesChanged(true /* hasBubbles */);
@@ -511,13 +527,14 @@
 
     @Test
     public void testExpandStackAndSelectBubble_removedFirst() {
-        final String key = mRow.getEntry().key;
+        final String key = mRow.getEntry().getKey();
 
         mEntryListener.onPendingEntryAdded(mRow.getEntry());
         mBubbleController.updateBubble(mRow.getEntry());
 
         // Simulate notification cancellation.
-        mRemoveInterceptor.onNotificationRemoveRequested(mRow.getEntry().key, REASON_APP_CANCEL);
+        mRemoveInterceptor.onNotificationRemoveRequested(
+                mRow.getEntry().getKey(), REASON_APP_CANCEL);
 
         mBubbleController.expandStackAndSelectBubble(key);
     }
@@ -525,8 +542,9 @@
     @Test
     public void testMarkNewNotificationAsShowInShade() {
         mEntryListener.onPendingEntryAdded(mRow.getEntry());
-        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
-        assertTrue(mBubbleData.getBubbleWithKey(mRow.getEntry().key).showBubbleDot());
+        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
+        assertTrue(mBubbleData.getBubbleWithKey(mRow.getEntry().getKey()).showBubbleDot());
     }
 
     @Test
@@ -541,14 +559,15 @@
     @Test
     public void testDeleteIntent_removeBubble_aged() throws PendingIntent.CanceledException {
         mBubbleController.updateBubble(mRow.getEntry());
-        mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_AGED);
+        mBubbleController.removeBubble(mRow.getEntry().getKey(), BubbleController.DISMISS_AGED);
         verify(mDeleteIntent, never()).send();
     }
 
     @Test
     public void testDeleteIntent_removeBubble_user() throws PendingIntent.CanceledException {
         mBubbleController.updateBubble(mRow.getEntry());
-        mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_USER_GESTURE);
+        mBubbleController.removeBubble(
+                mRow.getEntry().getKey(), BubbleController.DISMISS_USER_GESTURE);
         verify(mDeleteIntent, times(1)).send();
     }
 
@@ -566,7 +585,7 @@
         mBubbleController.updateBubble(mRow.getEntry());
         assertTrue(mBubbleController.hasBubbles());
 
-        mRow.getEntry().notification.getNotification().flags &= ~FLAG_BUBBLE;
+        mRow.getEntry().getSbn().getNotification().flags &= ~FLAG_BUBBLE;
         mEntryListener.onPreEntryUpdated(mRow.getEntry());
 
         assertFalse(mBubbleController.hasBubbles());
@@ -581,7 +600,7 @@
         assertTrue(mBubbleController.hasBubbles());
 
         boolean intercepted = mRemoveInterceptor.onNotificationRemoveRequested(
-                mRow.getEntry().key, REASON_APP_CANCEL);
+                mRow.getEntry().getKey(), REASON_APP_CANCEL);
 
         // Cancels always remove so no need to intercept
         assertFalse(intercepted);
@@ -594,15 +613,17 @@
         mBubbleController.updateBubble(mRow.getEntry());
 
         assertTrue(mBubbleController.hasBubbles());
-        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
 
         boolean intercepted = mRemoveInterceptor.onNotificationRemoveRequested(
-                mRow.getEntry().key, REASON_CANCEL_ALL);
+                mRow.getEntry().getKey(), REASON_CANCEL_ALL);
 
         // Intercept!
         assertTrue(intercepted);
         // Should update show in shade state
-        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
 
         verify(mNotificationEntryManager, never()).performRemoveNotification(
                 any(), anyInt());
@@ -615,15 +636,17 @@
         mBubbleController.updateBubble(mRow.getEntry());
 
         assertTrue(mBubbleController.hasBubbles());
-        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
 
         boolean intercepted = mRemoveInterceptor.onNotificationRemoveRequested(
-                mRow.getEntry().key, REASON_CANCEL);
+                mRow.getEntry().getKey(), REASON_CANCEL);
 
         // Intercept!
         assertTrue(intercepted);
         // Should update show in shade state
-        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
 
         verify(mNotificationEntryManager, never()).performRemoveNotification(
                 any(), anyInt());
@@ -636,15 +659,17 @@
         mBubbleController.updateBubble(mRow.getEntry());
 
         assertTrue(mBubbleController.hasBubbles());
-        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
+        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(
+                mRow.getEntry().getKey()));
 
         // Dismiss the bubble
-        mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_USER_GESTURE);
+        mBubbleController.removeBubble(
+                mRow.getEntry().getKey(), BubbleController.DISMISS_USER_GESTURE);
         assertFalse(mBubbleController.hasBubbles());
 
         // Dismiss the notification
         boolean intercepted = mRemoveInterceptor.onNotificationRemoveRequested(
-                mRow.getEntry().key, REASON_CANCEL);
+                mRow.getEntry().getKey(), REASON_CANCEL);
 
         // It's no longer a bubble so we shouldn't intercept
         assertFalse(intercepted);
@@ -694,7 +719,7 @@
      */
     private void setMetadataFlags(NotificationEntry entry, int flag, boolean enableFlag) {
         Notification.BubbleMetadata bubbleMetadata =
-                entry.notification.getNotification().getBubbleMetadata();
+                entry.getSbn().getNotification().getBubbleMetadata();
         int flags = bubbleMetadata.getFlags();
         if (enableFlag) {
             flags |= flag;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java
index 96ee079..67f65e6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java
@@ -842,14 +842,14 @@
     }
 
     private void setPostTime(NotificationEntry entry, long postTime) {
-        when(entry.notification.getPostTime()).thenReturn(postTime);
+        when(entry.getSbn().getPostTime()).thenReturn(postTime);
     }
 
     private void setOngoing(NotificationEntry entry, boolean ongoing) {
         if (ongoing) {
-            entry.notification.getNotification().flags |= Notification.FLAG_FOREGROUND_SERVICE;
+            entry.getSbn().getNotification().flags |= Notification.FLAG_FOREGROUND_SERVICE;
         } else {
-            entry.notification.getNotification().flags &= ~Notification.FLAG_FOREGROUND_SERVICE;
+            entry.getSbn().getNotification().flags &= ~Notification.FLAG_FOREGROUND_SERVICE;
         }
     }
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java
index cf5a12f..c6dd232 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java
@@ -141,9 +141,9 @@
     public void testShowNotification_addsEntry() {
         mAlertingNotificationManager.showNotification(mEntry);
 
-        assertTrue(mAlertingNotificationManager.isAlerting(mEntry.key));
+        assertTrue(mAlertingNotificationManager.isAlerting(mEntry.getKey()));
         assertTrue(mAlertingNotificationManager.hasNotifications());
-        assertEquals(mEntry, mAlertingNotificationManager.getEntry(mEntry.key));
+        assertEquals(mEntry, mAlertingNotificationManager.getEntry(mEntry.getKey()));
     }
 
     @Test
@@ -155,7 +155,7 @@
         TestableLooper.get(this).processMessages(1);
 
         assertFalse("Test timed out", mTimedOut);
-        assertFalse(mAlertingNotificationManager.isAlerting(mEntry.key));
+        assertFalse(mAlertingNotificationManager.isAlerting(mEntry.getKey()));
     }
 
     @Test
@@ -163,9 +163,10 @@
         mAlertingNotificationManager.showNotification(mEntry);
 
         // Try to remove but defer, since the notification has not been shown long enough.
-        mAlertingNotificationManager.removeNotification(mEntry.key, false /* releaseImmediately */);
+        mAlertingNotificationManager.removeNotification(
+                mEntry.getKey(), false /* releaseImmediately */);
 
-        assertTrue(mAlertingNotificationManager.isAlerting(mEntry.key));
+        assertTrue(mAlertingNotificationManager.isAlerting(mEntry.getKey()));
     }
 
     @Test
@@ -173,9 +174,10 @@
         mAlertingNotificationManager.showNotification(mEntry);
 
         // Remove forcibly with releaseImmediately = true.
-        mAlertingNotificationManager.removeNotification(mEntry.key, true /* releaseImmediately */);
+        mAlertingNotificationManager.removeNotification(
+                mEntry.getKey(), true /* releaseImmediately */);
 
-        assertFalse(mAlertingNotificationManager.isAlerting(mEntry.key));
+        assertFalse(mAlertingNotificationManager.isAlerting(mEntry.getKey()));
     }
 
     @Test
@@ -199,7 +201,7 @@
         mAlertingNotificationManager.showNotification(mEntry);
 
         // The entry has just been added so we should not remove immediately.
-        assertFalse(mAlertingNotificationManager.canRemoveImmediately(mEntry.key));
+        assertFalse(mAlertingNotificationManager.canRemoveImmediately(mEntry.getKey()));
     }
 
     @Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationEntryHelper.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationEntryHelper.java
index 5ad054b..2420e57 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationEntryHelper.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationEntryHelper.java
@@ -59,7 +59,7 @@
         @Override
         public StatusBarNotification build() {
             final StatusBarNotification sbn = super.build();
-            mTarget.setNotification(sbn);
+            mTarget.setSbn(sbn);
             return sbn;
         }
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java
index 6b996ab..2514c93 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java
@@ -112,7 +112,7 @@
     @Test
     public void testShouldExtendLifetime_isSpinning() {
         NotificationRemoteInputManager.FORCE_REMOTE_INPUT_HISTORY = true;
-        when(mController.isSpinning(mEntry.key)).thenReturn(true);
+        when(mController.isSpinning(mEntry.getKey())).thenReturn(true);
 
         assertTrue(mRemoteInputHistoryExtender.shouldExtendLifetime(mEntry));
     }
@@ -128,7 +128,7 @@
     @Test
     public void testShouldExtendLifetime_smartReplySending() {
         NotificationRemoteInputManager.FORCE_REMOTE_INPUT_HISTORY = true;
-        when(mSmartReplyController.isSendingSmartReply(mEntry.key)).thenReturn(true);
+        when(mSmartReplyController.isSendingSmartReply(mEntry.getKey())).thenReturn(true);
 
         assertTrue(mSmartReplyHistoryExtender.shouldExtendLifetime(mEntry));
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java
index 6efa57d..18649bf 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java
@@ -143,11 +143,11 @@
                 Lists.newArrayList(entry0, entry1, entry2));
 
         // Set up group manager to report that they should be bundled now.
-        when(mGroupManager.isChildInGroupWithSummary(entry0.notification)).thenReturn(false);
-        when(mGroupManager.isChildInGroupWithSummary(entry1.notification)).thenReturn(true);
-        when(mGroupManager.isChildInGroupWithSummary(entry2.notification)).thenReturn(true);
-        when(mGroupManager.getGroupSummary(entry1.notification)).thenReturn(entry0);
-        when(mGroupManager.getGroupSummary(entry2.notification)).thenReturn(entry0);
+        when(mGroupManager.isChildInGroupWithSummary(entry0.getSbn())).thenReturn(false);
+        when(mGroupManager.isChildInGroupWithSummary(entry1.getSbn())).thenReturn(true);
+        when(mGroupManager.isChildInGroupWithSummary(entry2.getSbn())).thenReturn(true);
+        when(mGroupManager.getGroupSummary(entry1.getSbn())).thenReturn(entry0);
+        when(mGroupManager.getGroupSummary(entry2.getSbn())).thenReturn(entry0);
 
         // Run updateNotifications - the view hierarchy should be reorganized.
         mViewHierarchyManager.updateNotificationViews();
@@ -172,9 +172,9 @@
                 Lists.newArrayList(entry0, entry1, entry2));
 
         // Set up group manager to report that they should not be bundled now.
-        when(mGroupManager.isChildInGroupWithSummary(entry0.notification)).thenReturn(false);
-        when(mGroupManager.isChildInGroupWithSummary(entry1.notification)).thenReturn(false);
-        when(mGroupManager.isChildInGroupWithSummary(entry2.notification)).thenReturn(false);
+        when(mGroupManager.isChildInGroupWithSummary(entry0.getSbn())).thenReturn(false);
+        when(mGroupManager.isChildInGroupWithSummary(entry1.getSbn())).thenReturn(false);
+        when(mGroupManager.isChildInGroupWithSummary(entry2.getSbn())).thenReturn(false);
 
         // Run updateNotifications - the view hierarchy should be reorganized.
         mViewHierarchyManager.updateNotificationViews();
@@ -201,9 +201,9 @@
                 Lists.newArrayList(entry0, entry1));
 
         // Set up group manager to report a suppressed summary now.
-        when(mGroupManager.isChildInGroupWithSummary(entry0.notification)).thenReturn(false);
-        when(mGroupManager.isChildInGroupWithSummary(entry1.notification)).thenReturn(false);
-        when(mGroupManager.isSummaryOfSuppressedGroup(entry0.notification)).thenReturn(true);
+        when(mGroupManager.isChildInGroupWithSummary(entry0.getSbn())).thenReturn(false);
+        when(mGroupManager.isChildInGroupWithSummary(entry1.getSbn())).thenReturn(false);
+        when(mGroupManager.isSummaryOfSuppressedGroup(entry0.getSbn())).thenReturn(true);
 
         // Run updateNotifications - the view hierarchy should be reorganized.
         mViewHierarchyManager.updateNotificationViews();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
index 0b91dfb..ebdf851 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
@@ -270,7 +270,8 @@
         notificationRowBinder.setNotificationClicker(mock(NotificationClicker.class));
         mEntryManager.setRowBinder(notificationRowBinder);
 
-        setUserSentiment(mEntry.key, NotificationListenerService.Ranking.USER_SENTIMENT_NEUTRAL);
+        setUserSentiment(
+                mEntry.getKey(), NotificationListenerService.Ranking.USER_SENTIMENT_NEUTRAL);
     }
 
     @Test
@@ -317,7 +318,8 @@
 
         mEntryManager.getNotificationData().add(mEntry);
 
-        setUserSentiment(mEntry.key, NotificationListenerService.Ranking.USER_SENTIMENT_NEGATIVE);
+        setUserSentiment(
+                mEntry.getKey(), NotificationListenerService.Ranking.USER_SENTIMENT_NEGATIVE);
 
         mEntryManager.updateNotification(mSbn, mRankingMap);
         TestableLooper.get(this).processMessages(1);
@@ -341,7 +343,7 @@
         TestableLooper.get(this).processAllMessages();
 
         NotificationData notifData = mock(NotificationData.class);
-        when(notifData.get(mEntry.key)).thenReturn(mEntry);
+        when(notifData.get(mEntry.getKey())).thenReturn(mEntry);
 
         mEntryManager.setNotificationData(notifData);
 
@@ -413,7 +415,7 @@
         mEntry.setRow(mRow);
         mEntry.setInflationTask(mAsyncInflationTask);
         mEntryManager.getNotificationData().add(mEntry);
-        setSmartActions(mEntry.key, new ArrayList<>(Arrays.asList(createAction())));
+        setSmartActions(mEntry.getKey(), new ArrayList<>(Arrays.asList(createAction())));
 
         mEntryManager.updateNotificationRanking(mRankingMap);
         verify(mRow).setEntry(eq(mEntry));
@@ -429,7 +431,7 @@
 
         mEntry.setRow(mRow);
         mEntryManager.getNotificationData().add(mEntry);
-        setSmartActions(mEntry.key, null);
+        setSmartActions(mEntry.getKey(), null);
 
         mEntryManager.updateNotificationRanking(mRankingMap);
         verify(mRow, never()).setEntry(eq(mEntry));
@@ -443,7 +445,7 @@
 
         mEntry.setRow(null);
         mEntryManager.getNotificationData().add(mEntry);
-        setSmartActions(mEntry.key, new ArrayList<>(Arrays.asList(createAction())));
+        setSmartActions(mEntry.getKey(), new ArrayList<>(Arrays.asList(createAction())));
 
         mEntryManager.updateNotificationRanking(mRankingMap);
         verify(mRow, never()).setEntry(eq(mEntry));
@@ -457,8 +459,8 @@
         when(mEnvironment.isNotificationForCurrentProfiles(any())).thenReturn(true);
 
         mEntry.setRow(null);
-        mEntryManager.mPendingNotifications.put(mEntry.key, mEntry);
-        setSmartActions(mEntry.key, new ArrayList<>(Arrays.asList(createAction())));
+        mEntryManager.mPendingNotifications.put(mEntry.getKey(), mEntry);
+        setSmartActions(mEntry.getKey(), new ArrayList<>(Arrays.asList(createAction())));
 
         mEntryManager.updateNotificationRanking(mRankingMap);
         verify(mRow, never()).setEntry(eq(mEntry));
@@ -478,7 +480,7 @@
         mEntryManager.addNotificationLifetimeExtender(extender);
 
         // WHEN the notification is removed
-        mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON);
+        mEntryManager.removeNotification(mEntry.getKey(), mRankingMap, UNDEFINED_DISMISS_REASON);
 
         // THEN the extender is asked to manage the lifetime
         verify(extender).setShouldManageLifetime(mEntry, true);
@@ -494,12 +496,12 @@
         mEntryManager.getNotificationData().add(mEntry);
         final FakeNotificationLifetimeExtender extender = new FakeNotificationLifetimeExtender();
         mEntryManager.addNotificationLifetimeExtender(extender);
-        mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON);
-        assertTrue(extender.isManaging(mEntry.key));
+        mEntryManager.removeNotification(mEntry.getKey(), mRankingMap, UNDEFINED_DISMISS_REASON);
+        assertTrue(extender.isManaging(mEntry.getKey()));
 
         // WHEN the extender finishes its extension
         extender.setExtendLifetimes(false);
-        extender.getCallback().onSafeToRemove(mEntry.key);
+        extender.getCallback().onSafeToRemove(mEntry.getKey());
 
         // THEN the notification is removed
         assertNull(mEntryManager.getNotificationData().get(mSbn.getKey()));
@@ -514,10 +516,10 @@
         NotificationLifetimeExtender extender = mock(NotificationLifetimeExtender.class);
         when(extender.shouldExtendLifetime(mEntry)).thenReturn(true);
         mEntryManager.addNotificationLifetimeExtender(extender);
-        mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON);
+        mEntryManager.removeNotification(mEntry.getKey(), mRankingMap, UNDEFINED_DISMISS_REASON);
 
         // WHEN the notification is updated
-        mEntryManager.updateNotification(mEntry.notification, mRankingMap);
+        mEntryManager.updateNotification(mEntry.getSbn(), mRankingMap);
 
         // THEN the lifetime extension is canceled
         verify(extender).setShouldManageLifetime(mEntry, false);
@@ -539,13 +541,13 @@
         mEntryManager.addNotificationLifetimeExtender(extender2);
 
         // GIVEN a notification was lifetime-extended and extender2 is managing it
-        mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON);
+        mEntryManager.removeNotification(mEntry.getKey(), mRankingMap, UNDEFINED_DISMISS_REASON);
         verify(extender1, never()).setShouldManageLifetime(mEntry, true);
         verify(extender2).setShouldManageLifetime(mEntry, true);
 
         // WHEN the extender1 changes its mind and wants to extend the lifetime of the notif
         when(extender1.shouldExtendLifetime(mEntry)).thenReturn(true);
-        mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON);
+        mEntryManager.removeNotification(mEntry.getKey(), mRankingMap, UNDEFINED_DISMISS_REASON);
 
         // THEN extender2 stops managing the notif and extender1 starts managing it
         verify(extender1).setShouldManageLifetime(mEntry, true);
@@ -569,14 +571,14 @@
         mEntryManager.getNotificationData().add(mEntry);
 
         // GIVEN interceptor that intercepts that entry
-        when(mRemoveInterceptor.onNotificationRemoveRequested(eq(mEntry.key), anyInt()))
+        when(mRemoveInterceptor.onNotificationRemoveRequested(eq(mEntry.getKey()), anyInt()))
                 .thenReturn(true);
 
         // WHEN the notification is removed
-        mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON);
+        mEntryManager.removeNotification(mEntry.getKey(), mRankingMap, UNDEFINED_DISMISS_REASON);
 
         // THEN the interceptor intercepts & the entry is not removed & no listeners are called
-        assertNotNull(mEntryManager.getNotificationData().get(mEntry.key));
+        assertNotNull(mEntryManager.getNotificationData().get(mEntry.getKey()));
         verify(mEntryListener, never()).onEntryRemoved(eq(mEntry),
                 any(NotificationVisibility.class), anyBoolean());
     }
@@ -588,14 +590,14 @@
         mEntryManager.getNotificationData().add(mEntry);
 
         // GIVEN interceptor that doesn't intercept
-        when(mRemoveInterceptor.onNotificationRemoveRequested(eq(mEntry.key), anyInt()))
+        when(mRemoveInterceptor.onNotificationRemoveRequested(eq(mEntry.getKey()), anyInt()))
                 .thenReturn(false);
 
         // WHEN the notification is removed
-        mEntryManager.removeNotification(mEntry.key, mRankingMap, UNDEFINED_DISMISS_REASON);
+        mEntryManager.removeNotification(mEntry.getKey(), mRankingMap, UNDEFINED_DISMISS_REASON);
 
         // THEN the interceptor intercepts & the entry is not removed & no listeners are called
-        assertNull(mEntryManager.getNotificationData().get(mEntry.key));
+        assertNull(mEntryManager.getNotificationData().get(mEntry.getKey()));
         verify(mEntryListener, atLeastOnce()).onEntryRemoved(eq(mEntry),
                 any(NotificationVisibility.class), anyBoolean());
     }
@@ -626,17 +628,17 @@
         public void setShouldManageLifetime(
                 @NonNull NotificationEntry entry,
                 boolean shouldManage) {
-            final boolean hasEntry = mManagedNotifs.contains(entry.key);
+            final boolean hasEntry = mManagedNotifs.contains(entry.getKey());
             if (shouldManage) {
                 if (hasEntry) {
-                    throw new RuntimeException("Already managing this entry: " + entry.key);
+                    throw new RuntimeException("Already managing this entry: " + entry.getKey());
                 }
-                mManagedNotifs.add(entry.key);
+                mManagedNotifs.add(entry.getKey());
             } else {
                 if (!hasEntry) {
-                    throw new RuntimeException("Not managing this entry: " + entry.key);
+                    throw new RuntimeException("Not managing this entry: " + entry.getKey());
                 }
-                mManagedNotifs.remove(entry.key);
+                mManagedNotifs.remove(entry.getKey());
             }
         }
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java
index 45e1721..d85f275 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java
@@ -142,7 +142,7 @@
     public void testSuppressSystemAlertNotification() {
         when(mFsc.isSystemAlertWarningNeeded(anyInt(), anyString())).thenReturn(false);
         when(mFsc.isSystemAlertNotification(any())).thenReturn(true);
-        StatusBarNotification sbn = mRow.getEntry().notification;
+        StatusBarNotification sbn = mRow.getEntry().getSbn();
         Bundle bundle = new Bundle();
         bundle.putStringArray(Notification.EXTRA_FOREGROUND_APPS, new String[]{"something"});
         sbn.getNotification().extras = bundle;
@@ -152,7 +152,7 @@
 
     @Test
     public void testDoNotSuppressSystemAlertNotification() {
-        StatusBarNotification sbn = mRow.getEntry().notification;
+        StatusBarNotification sbn = mRow.getEntry().getSbn();
         Bundle bundle = new Bundle();
         bundle.putStringArray(Notification.EXTRA_FOREGROUND_APPS, new String[]{"something"});
         sbn.getNotification().extras = bundle;
@@ -180,7 +180,7 @@
         // missing extra
         assertFalse(mNotificationFilter.shouldFilterOut(mRow.getEntry()));
 
-        StatusBarNotification sbn = mRow.getEntry().notification;
+        StatusBarNotification sbn = mRow.getEntry().getSbn();
         Bundle bundle = new Bundle();
         bundle.putStringArray(Notification.EXTRA_FOREGROUND_APPS, new String[]{});
         sbn.getNotification().extras = bundle;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java
index 170c661..9202c51 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java
@@ -109,7 +109,7 @@
         final NotificationEntry entry = buildEntry();
         mEntryListener.onEntryRemoved(
                 entry,
-                NotificationVisibility.obtain(entry.key, 0, 0, true),
+                NotificationVisibility.obtain(entry.getKey(), 0, 0, true),
                 false);
         verify(mListContainer).cleanUpViewStateForEntry(entry);
     }
@@ -126,13 +126,13 @@
         final NotificationEntry entry = buildEntry();
         mNotificationData.add(entry);
         when(mForegroundServiceController.getStandardLayoutKey(anyInt(), anyString()))
-                .thenReturn(entry.key);
+                .thenReturn(entry.getKey());
 
         // WHEN we are notified of a new app op
         mController.updateNotificationsForAppOp(
                 AppOpsManager.OP_CAMERA,
-                entry.notification.getUid(),
-                entry.notification.getPackageName(),
+                entry.getSbn().getUid(),
+                entry.getSbn().getPackageName(),
                 true);
 
         // THEN the app op is added to the entry
@@ -165,10 +165,10 @@
         expected.add(235);
         expected.add(1);
         when(mForegroundServiceController.getStandardLayoutKey(
-                entry.notification.getUserId(),
-                entry.notification.getPackageName())).thenReturn(entry.key);
-        when(mForegroundServiceController.getAppOps(entry.notification.getUserId(),
-                entry.notification.getPackageName())).thenReturn(expected);
+                entry.getSbn().getUserId(),
+                entry.getSbn().getPackageName())).thenReturn(entry.getKey());
+        when(mForegroundServiceController.getAppOps(entry.getSbn().getUserId(),
+                entry.getSbn().getPackageName())).thenReturn(expected);
 
         // WHEN the notification is added
         mEntryListener.onBeforeNotificationAdded(entry);
@@ -187,10 +187,10 @@
 
         mNotificationData.add(entry);
         when(mForegroundServiceController.getStandardLayoutKey(
-                entry.notification.getUserId(),
-                entry.notification.getPackageName())).thenReturn(entry.key);
-        when(mForegroundServiceController.getAppOps(entry.notification.getUserId(),
-                entry.notification.getPackageName())).thenReturn(null);
+                entry.getSbn().getUserId(),
+                entry.getSbn().getPackageName())).thenReturn(entry.getKey());
+        when(mForegroundServiceController.getAppOps(entry.getSbn().getUserId(),
+                entry.getSbn().getPackageName())).thenReturn(null);
 
         // WHEN the notification is added
         mEntryListener.onBeforeNotificationAdded(entry);
@@ -208,11 +208,11 @@
         ops.add(3);
         ops.add(235);
         ops.add(1);
-        when(mForegroundServiceController.getAppOps(entry.notification.getUserId(),
-                entry.notification.getPackageName())).thenReturn(ops);
+        when(mForegroundServiceController.getAppOps(entry.getSbn().getUserId(),
+                entry.getSbn().getPackageName())).thenReturn(ops);
         when(mForegroundServiceController.getStandardLayoutKey(
-                entry.notification.getUserId(),
-                entry.notification.getPackageName())).thenReturn("something else");
+                entry.getSbn().getUserId(),
+                entry.getSbn().getPackageName())).thenReturn("something else");
 
         // WHEN the notification is added
         mEntryListener.onBeforeNotificationAdded(entry);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java
index 20871cf..640984b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java
@@ -153,7 +153,7 @@
     public void testChannelSetWhenAdded() {
         Bundle override = new Bundle();
         override.putParcelable(OVERRIDE_CHANNEL, NOTIFICATION_CHANNEL);
-        mNotificationData.rankingOverrides.put(mRow.getEntry().key, override);
+        mNotificationData.rankingOverrides.put(mRow.getEntry().getKey(), override);
         mNotificationData.add(mRow.getEntry());
         assertEquals(NOTIFICATION_CHANNEL, mRow.getEntry().getChannel());
     }
@@ -175,17 +175,17 @@
 
         for (int op : expectedOps) {
             mNotificationData.updateAppOp(op, NotificationTestHelper.UID,
-                    NotificationTestHelper.PKG, mRow.getEntry().key, true);
+                    NotificationTestHelper.PKG, mRow.getEntry().getKey(), true);
             mNotificationData.updateAppOp(op, NotificationTestHelper.UID,
-                    NotificationTestHelper.PKG, row2.getEntry().key, true);
+                    NotificationTestHelper.PKG, row2.getEntry().getKey(), true);
         }
         for (int op : expectedOps) {
-            assertTrue(mRow.getEntry().key + " doesn't have op " + op,
-                    mNotificationData.get(mRow.getEntry().key).mActiveAppOps.contains(op));
-            assertTrue(row2.getEntry().key + " doesn't have op " + op,
-                    mNotificationData.get(row2.getEntry().key).mActiveAppOps.contains(op));
-            assertFalse(diffPkg.getEntry().key + " has op " + op,
-                    mNotificationData.get(diffPkg.getEntry().key).mActiveAppOps.contains(op));
+            assertTrue(mRow.getEntry().getKey() + " doesn't have op " + op,
+                    mNotificationData.get(mRow.getEntry().getKey()).mActiveAppOps.contains(op));
+            assertTrue(row2.getEntry().getKey() + " doesn't have op " + op,
+                    mNotificationData.get(row2.getEntry().getKey()).mActiveAppOps.contains(op));
+            assertFalse(diffPkg.getEntry().getKey() + " has op " + op,
+                    mNotificationData.get(diffPkg.getEntry().getKey()).mActiveAppOps.contains(op));
         }
     }
 
@@ -202,22 +202,22 @@
 
         for (int op : expectedOps) {
             mNotificationData.updateAppOp(op, NotificationTestHelper.UID,
-                    NotificationTestHelper.PKG, row2.getEntry().key, true);
+                    NotificationTestHelper.PKG, row2.getEntry().getKey(), true);
         }
 
         expectedOps.remove(OP_ACCEPT_HANDOVER);
         mNotificationData.updateAppOp(OP_ACCEPT_HANDOVER, NotificationTestHelper.UID,
-                NotificationTestHelper.PKG, row2.getEntry().key, false);
+                NotificationTestHelper.PKG, row2.getEntry().getKey(), false);
 
-        assertTrue(mRow.getEntry().key + " doesn't have op " + OP_CAMERA,
-                mNotificationData.get(mRow.getEntry().key).mActiveAppOps.contains(OP_CAMERA));
-        assertTrue(row2.getEntry().key + " doesn't have op " + OP_CAMERA,
-                mNotificationData.get(row2.getEntry().key).mActiveAppOps.contains(OP_CAMERA));
-        assertFalse(mRow.getEntry().key + " has op " + OP_ACCEPT_HANDOVER,
-                mNotificationData.get(mRow.getEntry().key)
+        assertTrue(mRow.getEntry().getKey() + " doesn't have op " + OP_CAMERA,
+                mNotificationData.get(mRow.getEntry().getKey()).mActiveAppOps.contains(OP_CAMERA));
+        assertTrue(row2.getEntry().getKey() + " doesn't have op " + OP_CAMERA,
+                mNotificationData.get(row2.getEntry().getKey()).mActiveAppOps.contains(OP_CAMERA));
+        assertFalse(mRow.getEntry().getKey() + " has op " + OP_ACCEPT_HANDOVER,
+                mNotificationData.get(mRow.getEntry().getKey())
                         .mActiveAppOps.contains(OP_ACCEPT_HANDOVER));
-        assertFalse(row2.getEntry().key + " has op " + OP_ACCEPT_HANDOVER,
-                mNotificationData.get(row2.getEntry().key)
+        assertFalse(row2.getEntry().getKey() + " has op " + OP_ACCEPT_HANDOVER,
+                mNotificationData.get(row2.getEntry().getKey())
                         .mActiveAppOps.contains(OP_ACCEPT_HANDOVER));
     }
 
@@ -230,9 +230,9 @@
         mNotificationData.add(row2.getEntry());
 
         when(mEnvironment.isNotificationForCurrentProfiles(
-                mRow.getEntry().notification)).thenReturn(false);
+                mRow.getEntry().getSbn())).thenReturn(false);
         when(mEnvironment.isNotificationForCurrentProfiles(
-                row2.getEntry().notification)).thenReturn(true);
+                row2.getEntry().getSbn())).thenReturn(true);
         ArrayList<NotificationEntry> result =
                 mNotificationData.getNotificationsForCurrentUser();
 
@@ -249,7 +249,7 @@
         mNotificationData.add(mEntry);
         Bundle override = new Bundle();
         override.putInt(OVERRIDE_VIS_EFFECTS, 255);
-        mNotificationData.rankingOverrides.put(mEntry.key, override);
+        mNotificationData.rankingOverrides.put(mEntry.getKey(), override);
 
         assertTrue(mEntry.isExemptFromDndVisualSuppression());
         assertFalse(mEntry.shouldSuppressAmbient());
@@ -269,7 +269,7 @@
         mNotificationData.add(mEntry);
         Bundle override = new Bundle();
         override.putInt(OVERRIDE_VIS_EFFECTS, 255);
-        mNotificationData.rankingOverrides.put(mEntry.key, override);
+        mNotificationData.rankingOverrides.put(mEntry.getKey(), override);
 
         assertTrue(mEntry.isExemptFromDndVisualSuppression());
         assertFalse(mEntry.shouldSuppressAmbient());
@@ -283,7 +283,7 @@
         mNotificationData.add(mEntry);
         Bundle override = new Bundle();
         override.putInt(OVERRIDE_VIS_EFFECTS, 255);
-        mNotificationData.rankingOverrides.put(mEntry.key, override);
+        mNotificationData.rankingOverrides.put(mEntry.getKey(), override);
 
         assertTrue(mEntry.isExemptFromDndVisualSuppression());
         assertFalse(mEntry.shouldSuppressAmbient());
@@ -299,7 +299,7 @@
         entry.mIsSystemNotification = true;
         Bundle override = new Bundle();
         override.putInt(OVERRIDE_VIS_EFFECTS, NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT);
-        mNotificationData.rankingOverrides.put(entry.key, override);
+        mNotificationData.rankingOverrides.put(entry.getKey(), override);
         mNotificationData.add(entry);
 
         modifySbn(entry)
@@ -511,7 +511,7 @@
         Bundle override = new Bundle();
         override.putInt(OVERRIDE_IMPORTANCE, IMPORTANCE_LOW);
         override.putInt(OVERRIDE_RANK, 1);
-        mNotificationData.rankingOverrides.put(a.key, override);
+        mNotificationData.rankingOverrides.put(a.getKey(), override);
 
         Notification bN = new Notification.Builder(mContext, "test")
                 .setStyle(new Notification.MessagingStyle(""))
@@ -530,7 +530,7 @@
         Bundle bOverride = new Bundle();
         bOverride.putInt(OVERRIDE_IMPORTANCE, IMPORTANCE_LOW);
         bOverride.putInt(OVERRIDE_RANK, 2);
-        mNotificationData.rankingOverrides.put(b.key, bOverride);
+        mNotificationData.rankingOverrides.put(b.getKey(), bOverride);
 
         assertEquals(1, mNotificationData.mRankingComparator.compare(a, b));
     }
@@ -555,7 +555,7 @@
         Bundle override = new Bundle();
         override.putInt(OVERRIDE_IMPORTANCE, IMPORTANCE_LOW);
         override.putInt(OVERRIDE_RANK, 1);
-        mNotificationData.rankingOverrides.put(a.key, override);
+        mNotificationData.rankingOverrides.put(a.getKey(), override);
 
         Notification bN = new Notification.Builder(mContext, "test")
                 .setStyle(new Notification.MessagingStyle(""))
@@ -574,7 +574,7 @@
         Bundle bOverride = new Bundle();
         bOverride.putInt(OVERRIDE_IMPORTANCE, IMPORTANCE_LOW);
         bOverride.putInt(OVERRIDE_RANK, 2);
-        mNotificationData.rankingOverrides.put(b.key, bOverride);
+        mNotificationData.rankingOverrides.put(b.getKey(), bOverride);
 
         assertEquals(-1, mNotificationData.mRankingComparator.compare(a, b));
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java
index 24cd056..47c17ad 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java
@@ -113,7 +113,7 @@
     @Test
     public void testOnChildLocationsChangedReportsVisibilityChanged() throws Exception {
         NotificationVisibility[] newlyVisibleKeys = {
-                NotificationVisibility.obtain(mEntry.key, 0, 1, true)
+                NotificationVisibility.obtain(mEntry.getKey(), 0, 1, true)
         };
         NotificationVisibility[] noLongerVisibleKeys = {};
         doAnswer(invocation -> {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
index 41fe173..c7877bb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
@@ -487,13 +487,13 @@
         NotificationEntry entry = createTestNotificationRow().getEntry();
         mGutsManager.setShouldManageLifetime(entry, true /* shouldManage */);
 
-        assertTrue(entry.key.equals(mGutsManager.mKeyToRemoveOnGutsClosed));
+        assertTrue(entry.getKey().equals(mGutsManager.mKeyToRemoveOnGutsClosed));
     }
 
     @Test
     public void testSetShouldManageLifetime_setShouldNotManage() {
         NotificationEntry entry = createTestNotificationRow().getEntry();
-        mGutsManager.mKeyToRemoveOnGutsClosed = entry.key;
+        mGutsManager.mKeyToRemoveOnGutsClosed = entry.getKey();
         mGutsManager.setShouldManageLifetime(entry, false /* shouldManage */);
 
         assertNull(mGutsManager.mKeyToRemoveOnGutsClosed);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
index 6fcf550..2068f7c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
@@ -102,27 +102,27 @@
 
         mHeadsUpManager.snooze();
 
-        assertTrue(mHeadsUpManager.isSnoozed(mEntry.notification.getPackageName()));
+        assertTrue(mHeadsUpManager.isSnoozed(mEntry.getSbn().getPackageName()));
     }
 
     @Test
     public void testSwipedOutNotification() {
         mHeadsUpManager.showNotification(mEntry);
-        mHeadsUpManager.addSwipedOutNotification(mEntry.key);
+        mHeadsUpManager.addSwipedOutNotification(mEntry.getKey());
 
         // Remove should succeed because the notification is swiped out
-        mHeadsUpManager.removeNotification(mEntry.key, false /* releaseImmediately */);
+        mHeadsUpManager.removeNotification(mEntry.getKey(), false /* releaseImmediately */);
 
-        assertFalse(mHeadsUpManager.isAlerting(mEntry.key));
+        assertFalse(mHeadsUpManager.isAlerting(mEntry.getKey()));
     }
 
     @Test
     public void testCanRemoveImmediately_swipedOut() {
         mHeadsUpManager.showNotification(mEntry);
-        mHeadsUpManager.addSwipedOutNotification(mEntry.key);
+        mHeadsUpManager.addSwipedOutNotification(mEntry.getKey());
 
         // Notification is swiped so it can be immediately removed.
-        assertTrue(mHeadsUpManager.canRemoveImmediately(mEntry.key));
+        assertTrue(mHeadsUpManager.canRemoveImmediately(mEntry.getKey()));
     }
 
     @Test
@@ -135,7 +135,7 @@
         mHeadsUpManager.showNotification(laterEntry);
 
         // Notification is "behind" a higher priority notification so we can remove it immediately.
-        assertTrue(mHeadsUpManager.canRemoveImmediately(mEntry.key));
+        assertTrue(mHeadsUpManager.canRemoveImmediately(mEntry.getKey()));
     }
 
 
@@ -143,7 +143,7 @@
     public void testExtendHeadsUp() {
         mHeadsUpManager.showNotification(mEntry);
         Runnable pastNormalTimeRunnable =
-                () -> mLivesPastNormalTime = mHeadsUpManager.isAlerting(mEntry.key);
+                () -> mLivesPastNormalTime = mHeadsUpManager.isAlerting(mEntry.getKey());
         mTestHandler.postDelayed(pastNormalTimeRunnable,
                 TEST_AUTO_DISMISS_TIME + mHeadsUpManager.mExtensionTime / 2);
         mTestHandler.postDelayed(TEST_TIMEOUT_RUNNABLE, TEST_TIMEOUT_TIME);
@@ -155,6 +155,6 @@
 
         assertFalse("Test timed out", mTimedOut);
         assertTrue("Pulse was not extended", mLivesPastNormalTime);
-        assertFalse(mHeadsUpManager.isAlerting(mEntry.key));
+        assertFalse(mHeadsUpManager.isAlerting(mEntry.getKey()));
     }
 }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java
index 2254234..5b54fba 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java
@@ -102,8 +102,8 @@
         mGroupManager.onEntryAdded(childEntry);
 
         // A suppressed summary should transfer its alert state to the child.
-        assertFalse(mHeadsUpManager.isAlerting(summaryEntry.key));
-        assertTrue(mHeadsUpManager.isAlerting(childEntry.key));
+        assertFalse(mHeadsUpManager.isAlerting(summaryEntry.getKey()));
+        assertTrue(mHeadsUpManager.isAlerting(childEntry.getKey()));
     }
 
     @Test
@@ -120,14 +120,14 @@
         mGroupManager.onEntryAdded(childEntry);
 
         // Add second child notification so that summary is no longer suppressed.
-        mPendingEntries.put(childEntry2.key, childEntry2);
+        mPendingEntries.put(childEntry2.getKey(), childEntry2);
         mNotificationEntryListener.onPendingEntryAdded(childEntry2);
         mGroupManager.onEntryAdded(childEntry2);
 
         // The alert state should transfer back to the summary as there is now more than one
         // child and the summary should no longer be suppressed.
-        assertTrue(mHeadsUpManager.isAlerting(summaryEntry.key));
-        assertFalse(mHeadsUpManager.isAlerting(childEntry.key));
+        assertTrue(mHeadsUpManager.isAlerting(summaryEntry.getKey()));
+        assertFalse(mHeadsUpManager.isAlerting(childEntry.getKey()));
     }
 
     @Test
@@ -147,12 +147,12 @@
         mGroupAlertTransferHelper.onDozingChanged(true);
 
         // Add second child notification so that summary is no longer suppressed.
-        mPendingEntries.put(childEntry2.key, childEntry2);
+        mPendingEntries.put(childEntry2.getKey(), childEntry2);
         mNotificationEntryListener.onPendingEntryAdded(childEntry2);
         mGroupManager.onEntryAdded(childEntry2);
 
         // Dozing changed so no reason to re-alert summary.
-        assertFalse(mHeadsUpManager.isAlerting(summaryEntry.key));
+        assertFalse(mHeadsUpManager.isAlerting(summaryEntry.getKey()));
     }
 
     @Test
@@ -168,8 +168,8 @@
 
         // Alert is immediately removed from summary, but we do not show child yet either as its
         // content is not inflated.
-        assertFalse(mHeadsUpManager.isAlerting(summaryEntry.key));
-        assertFalse(mHeadsUpManager.isAlerting(childEntry.key));
+        assertFalse(mHeadsUpManager.isAlerting(summaryEntry.getKey()));
+        assertFalse(mHeadsUpManager.isAlerting(childEntry.getKey()));
         assertTrue(mGroupAlertTransferHelper.isAlertTransferPending(childEntry));
     }
 
@@ -189,8 +189,8 @@
         mNotificationEntryListener.onEntryReinflated(childEntry);
 
         // Alert is immediately removed from summary, and we show child as its content is inflated.
-        assertFalse(mHeadsUpManager.isAlerting(summaryEntry.key));
-        assertTrue(mHeadsUpManager.isAlerting(childEntry.key));
+        assertFalse(mHeadsUpManager.isAlerting(summaryEntry.getKey()));
+        assertTrue(mHeadsUpManager.isAlerting(childEntry.getKey()));
     }
 
     @Test
@@ -209,7 +209,7 @@
         mGroupManager.onEntryAdded(childEntry);
 
         // Add second child notification so that summary is no longer suppressed.
-        mPendingEntries.put(childEntry2.key, childEntry2);
+        mPendingEntries.put(childEntry2.getKey(), childEntry2);
         mNotificationEntryListener.onPendingEntryAdded(childEntry2);
         mGroupManager.onEntryAdded(childEntry2);
 
@@ -220,7 +220,7 @@
 
         verify(childEntry.getRow(), times(1)).freeContentViewWhenSafe(mHeadsUpManager
             .getContentFlag());
-        assertFalse(mHeadsUpManager.isAlerting(childEntry.key));
+        assertFalse(mHeadsUpManager.isAlerting(childEntry.getKey()));
     }
 
     @Test
@@ -255,10 +255,10 @@
         mGroupManager.onEntryAdded(childEntry);
 
         // Notify that entry changed groups.
-        StatusBarNotification oldNotification = childEntry.notification;
-        StatusBarNotification newSbn = spy(childEntry.notification.clone());
+        StatusBarNotification oldNotification = childEntry.getSbn();
+        StatusBarNotification newSbn = spy(childEntry.getSbn().clone());
         doReturn("other_group").when(newSbn).getGroupKey();
-        childEntry.setNotification(newSbn);
+        childEntry.setSbn(newSbn);
         mGroupManager.onEntryUpdated(childEntry, oldNotification);
 
         assertFalse(mGroupAlertTransferHelper.isAlertTransferPending(childEntry));
@@ -278,10 +278,10 @@
         mGroupManager.onEntryAdded(childEntry);
 
         // Update that child to a summary.
-        StatusBarNotification oldNotification = childEntry.notification;
-        childEntry.setNotification(
+        StatusBarNotification oldNotification = childEntry.getSbn();
+        childEntry.setSbn(
                 mGroupTestHelper.createSummaryNotification(
-                        Notification.GROUP_ALERT_SUMMARY, 47).notification);
+                        Notification.GROUP_ALERT_SUMMARY, 47).getSbn());
         mGroupManager.onEntryUpdated(childEntry, oldNotification);
 
         assertFalse(mGroupAlertTransferHelper.isAlertTransferPending(childEntry));
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerTest.java
index 493b74d..19ce1ea 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerTest.java
@@ -75,7 +75,7 @@
         mGroupManager.onEntryAdded(summaryEntry);
         mGroupManager.onEntryAdded(childEntry);
 
-        assertTrue(mGroupManager.isOnlyChildInGroup(childEntry.notification));
+        assertTrue(mGroupManager.isOnlyChildInGroup(childEntry.getSbn()));
     }
 
     @Test
@@ -87,7 +87,7 @@
         mGroupManager.onEntryAdded(childEntry);
         mGroupManager.onEntryAdded(mGroupTestHelper.createChildNotification());
 
-        assertTrue(mGroupManager.isChildInGroupWithSummary(childEntry.notification));
+        assertTrue(mGroupManager.isChildInGroupWithSummary(childEntry.getSbn()));
     }
 
     @Test
@@ -99,8 +99,8 @@
         mGroupManager.onEntryAdded(childEntry);
         mGroupManager.onEntryAdded(mGroupTestHelper.createChildNotification());
 
-        assertTrue(mGroupManager.isSummaryOfGroup(summaryEntry.notification));
-        assertEquals(summaryEntry, mGroupManager.getGroupSummary(childEntry.notification));
+        assertTrue(mGroupManager.isSummaryOfGroup(summaryEntry.getSbn()));
+        assertEquals(summaryEntry, mGroupManager.getGroupSummary(childEntry.getSbn()));
     }
 
     @Test
@@ -113,7 +113,7 @@
 
         mGroupManager.onEntryRemoved(childEntry);
 
-        assertFalse(mGroupManager.isChildInGroupWithSummary(childEntry.notification));
+        assertFalse(mGroupManager.isChildInGroupWithSummary(childEntry.getSbn()));
     }
 
     @Test
@@ -126,8 +126,8 @@
 
         mGroupManager.onEntryRemoved(summaryEntry);
 
-        assertNull(mGroupManager.getGroupSummary(childEntry.notification));
-        assertFalse(mGroupManager.isSummaryOfGroup(summaryEntry.notification));
+        assertNull(mGroupManager.getGroupSummary(childEntry.getSbn()));
+        assertFalse(mGroupManager.isSummaryOfGroup(summaryEntry.getSbn()));
     }
 
     @Test
@@ -137,13 +137,13 @@
         mGroupManager.onEntryAdded(summaryEntry);
         mGroupManager.onEntryAdded(childEntry);
         mGroupManager.onEntryAdded(mGroupTestHelper.createChildNotification());
-        when(mHeadsUpManager.isAlerting(childEntry.key)).thenReturn(true);
+        when(mHeadsUpManager.isAlerting(childEntry.getKey())).thenReturn(true);
 
         mGroupManager.onHeadsUpStateChanged(childEntry, true);
 
         // Child entries that are heads upped should be considered separate groups visually even if
         // they are the same group logically
-        assertEquals(childEntry, mGroupManager.getGroupSummary(childEntry.notification));
-        assertEquals(summaryEntry, mGroupManager.getLogicalGroupSummary(childEntry.notification));
+        assertEquals(childEntry, mGroupManager.getGroupSummary(childEntry.getSbn()));
+        assertEquals(summaryEntry, mGroupManager.getLogicalGroupSummary(childEntry.getSbn()));
     }
 }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HeadsUpManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HeadsUpManagerTest.java
index 6b83fed..fc7d0ce 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HeadsUpManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HeadsUpManagerTest.java
@@ -73,7 +73,7 @@
                 .getRecommendedTimeoutMillis(anyInt(), anyInt());
         mHeadsUpManager.showNotification(mEntry);
         Runnable pastNormalTimeRunnable =
-                () -> mLivesPastNormalTime = mHeadsUpManager.isAlerting(mEntry.key);
+                () -> mLivesPastNormalTime = mHeadsUpManager.isAlerting(mEntry.getKey());
         mTestHandler.postDelayed(pastNormalTimeRunnable,
                         (TEST_A11Y_AUTO_DISMISS_TIME + TEST_AUTO_DISMISS_TIME) / 2);
         mTestHandler.postDelayed(TEST_TIMEOUT_RUNNABLE, TEST_A11Y_TIMEOUT_TIME);
@@ -82,7 +82,7 @@
 
         assertFalse("Test timed out", mTimedOut);
         assertTrue("Heads up should live long enough", mLivesPastNormalTime);
-        assertFalse(mHeadsUpManager.isAlerting(mEntry.key));
+        assertFalse(mHeadsUpManager.isAlerting(mEntry.getKey()));
     }
 }