Rename HeadsUpEntry add/removal without references to alerting

Bug: 320753095
Test: SystemUITests
Flag: none

Change-Id: I429e3f7c03003346825fd3e8e3a3437bce98c118
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 9948978..b07ba3c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
@@ -224,7 +224,7 @@
             for (NotificationEntry entry : mEntriesToRemoveAfterExpand) {
                 if (isHeadsUpEntry(entry.getKey())) {
                     // Maybe the heads-up was removed already
-                    removeAlertEntry(entry.getKey());
+                    removeEntry(entry.getKey());
                 }
             }
         }
@@ -359,7 +359,7 @@
         for (NotificationEntry entry : mEntriesToRemoveWhenReorderingAllowed) {
             if (isHeadsUpEntry(entry.getKey())) {
                 // Maybe the heads-up was removed already
-                removeAlertEntry(entry.getKey());
+                removeEntry(entry.getKey());
             }
         }
         mEntriesToRemoveWhenReorderingAllowed.clear();
@@ -370,13 +370,13 @@
     //  HeadsUpManager utility (protected) methods overrides:
 
     @Override
-    protected HeadsUpEntry createAlertEntry() {
+    protected HeadsUpEntry createHeadsUpEntry() {
         return mEntryPool.acquire();
     }
 
     @Override
-    protected void onAlertEntryRemoved(HeadsUpEntry headsUpEntry) {
-        super.onAlertEntryRemoved(headsUpEntry);
+    protected void onEntryRemoved(HeadsUpEntry headsUpEntry) {
+        super.onEntryRemoved(headsUpEntry);
         mEntryPool.release((HeadsUpEntryPhone) headsUpEntry);
     }
 
@@ -455,7 +455,7 @@
                 } else if (mTrackingHeadsUp) {
                     mEntriesToRemoveAfterExpand.add(entry);
                 } else {
-                    removeAlertEntry(entry.getKey());
+                    removeEntry(entry.getKey());
                 }
             };
 
@@ -535,7 +535,7 @@
                     }
                 }
                 for (String key : keysToRemove) {
-                    removeAlertEntry(key);
+                    removeEntry(key);
                 }
             }
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BaseHeadsUpManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BaseHeadsUpManager.java
index 9635c41..c85821a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BaseHeadsUpManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BaseHeadsUpManager.java
@@ -151,15 +151,15 @@
     }
 
     /**
-     * Called when posting a new notification that should alert the user and appear on screen.
+     * Called when posting a new notification that should appear on screen.
      * Adds the notification to be managed.
      * @param entry entry to show
      */
     @Override
     public void showNotification(@NonNull NotificationEntry entry) {
         mLogger.logShowNotification(entry);
-        addAlertEntry(entry);
-        updateNotification(entry.getKey(), true /* alert */);
+        addEntry(entry);
+        updateNotification(entry.getKey(), true /* show */);
         entry.setInterruption();
     }
 
@@ -178,7 +178,7 @@
             return true;
         }
         if (releaseImmediately || canRemoveImmediately(key)) {
-            removeAlertEntry(key);
+            removeEntry(key);
         } else {
             headsUpEntry.removeAsSoonAsPossible();
             return false;
@@ -190,12 +190,12 @@
     /**
      * Called when the notification state has been updated.
      * @param key the key of the entry that was updated
-     * @param alert whether the notification should alert again and force reevaluation of
+     * @param show whether the notification should show again and force reevaluation of
      *              removal time
      */
-    public void updateNotification(@NonNull String key, boolean alert) {
+    public void updateNotification(@NonNull String key, boolean show) {
         HeadsUpEntry headsUpEntry = mHeadsUpEntryMap.get(key);
-        mLogger.logUpdateNotification(key, alert, headsUpEntry != null);
+        mLogger.logUpdateNotification(key, show, headsUpEntry != null);
         if (headsUpEntry == null) {
             // the entry was released before this update (i.e by a listener) This can happen
             // with the groupmanager
@@ -204,7 +204,7 @@
 
         headsUpEntry.mEntry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
 
-        if (alert) {
+        if (show) {
             headsUpEntry.updateEntry(true /* updatePostTime */, "updateNotification");
             if (headsUpEntry != null) {
                 setEntryPinned(headsUpEntry, shouldHeadsUpBecomePinned(headsUpEntry.mEntry));
@@ -221,7 +221,7 @@
         // undefined behavior if we iterated over the key set directly.
         ArraySet<String> keysToRemove = new ArraySet<>(mHeadsUpEntryMap.keySet());
         for (String key : keysToRemove) {
-            removeAlertEntry(key);
+            removeEntry(key);
         }
     }
 
@@ -248,7 +248,7 @@
 
     /**
      * Whether or not there are any active notifications.
-     * @return true if there is an alert, false otherwise
+     * @return true if there is an entry, false otherwise
      */
     @Override
     public boolean hasNotifications() {
@@ -322,11 +322,11 @@
      * Add a new entry and begin managing it.
      * @param entry the entry to add
      */
-    protected final void addAlertEntry(@NonNull NotificationEntry entry) {
-        HeadsUpEntry headsUpEntry = createAlertEntry();
+    protected final void addEntry(@NonNull NotificationEntry entry) {
+        HeadsUpEntry headsUpEntry = createHeadsUpEntry();
         headsUpEntry.setEntry(entry);
         mHeadsUpEntryMap.put(entry.getKey(), headsUpEntry);
-        onAlertEntryAdded(headsUpEntry);
+        onEntryAdded(headsUpEntry);
         entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
         entry.setIsAlerting(true);
     }
@@ -335,7 +335,7 @@
      * Manager-specific logic that should occur when an entry is added.
      * @param headsUpEntry entry added
      */
-    protected void onAlertEntryAdded(HeadsUpEntry headsUpEntry) {
+    protected void onEntryAdded(HeadsUpEntry headsUpEntry) {
         NotificationEntry entry = headsUpEntry.mEntry;
         entry.setHeadsUp(true);
 
@@ -348,10 +348,10 @@
     }
 
     /**
-     * Remove a notification and reset the alert entry.
+     * Remove a notification and reset the entry.
      * @param key key of notification to remove
      */
-    protected final void removeAlertEntry(@NonNull String key) {
+    protected final void removeEntry(@NonNull String key) {
         HeadsUpEntry headsUpEntry = mHeadsUpEntryMap.get(key);
         if (headsUpEntry == null) {
             return;
@@ -364,16 +364,16 @@
         }
         entry.demoteStickyHun();
         mHeadsUpEntryMap.remove(key);
-        onAlertEntryRemoved(headsUpEntry);
+        onEntryRemoved(headsUpEntry);
         entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
         headsUpEntry.reset();
     }
 
     /**
-     * Manager-specific logic that should occur when an alert entry is removed.
+     * Manager-specific logic that should occur when an entry is removed.
      * @param headsUpEntry entry removed
      */
-    protected void onAlertEntryRemoved(HeadsUpEntry headsUpEntry) {
+    protected void onEntryRemoved(HeadsUpEntry headsUpEntry) {
         NotificationEntry entry = headsUpEntry.mEntry;
         entry.setHeadsUp(false);
         setEntryPinned(headsUpEntry, false /* isPinned */);
@@ -589,10 +589,10 @@
     }
 
     /**
-     * Whether or not the alert can be removed currently.  If it hasn't been on screen long enough
+     * Whether or not the entry can be removed currently.  If it hasn't been on screen long enough
      * it should not be removed unless forced
      * @param key the key to check if removable
-     * @return true if the alert entry can be removed
+     * @return true if the entry can be removed
      */
     @Override
     public boolean canRemoveImmediately(@NonNull String key) {
@@ -618,7 +618,7 @@
     }
 
     @NonNull
-    protected HeadsUpEntry createAlertEntry() {
+    protected HeadsUpEntry createHeadsUpEntry() {
         return new HeadsUpEntry();
     }
 
@@ -655,7 +655,7 @@
         @Nullable private Runnable mCancelRemoveAlertRunnable;
 
         public void setEntry(@NonNull final NotificationEntry entry) {
-            setEntry(entry, () -> removeAlertEntry(entry.getKey()));
+            setEntry(entry, () -> removeEntry(entry.getKey()));
         }
 
         public void setEntry(@NonNull final NotificationEntry entry,
@@ -807,7 +807,7 @@
         }
 
         /**
-         * Remove the alert at the earliest allowed removal time.
+         * Remove the entry at the earliest allowed removal time.
          */
         public void removeAsSoonAsPossible() {
             if (mRemoveAlertRunnable != null) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java
index af62a6e..4c824c0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java
@@ -132,8 +132,8 @@
         }
 
         @Override
-        protected HeadsUpEntry createAlertEntry() {
-            mLastCreatedEntry = spy(super.createAlertEntry());
+        protected HeadsUpEntry createHeadsUpEntry() {
+            mLastCreatedEntry = spy(super.createHeadsUpEntry());
             return mLastCreatedEntry;
         }
 
@@ -375,7 +375,7 @@
                 BaseHeadsUpManager.HeadsUpEntry.class);
         headsUpEntry.mEntry = notifEntry;
 
-        hum.onAlertEntryRemoved(headsUpEntry);
+        hum.onEntryRemoved(headsUpEntry);
 
         verify(mLogger, times(1)).logNotificationActuallyRemoved(eq(notifEntry));
     }
@@ -702,7 +702,7 @@
         // the notification and then updates it; in order to not log twice, the entry needs
         // to have a functional ExpandableNotificationRow that can keep track of whether it's
         // pinned or not (via isRowPinned()). That feels like a lot to pull in to test this one bit.
-        hum.onAlertEntryAdded(entryToPin);
+        hum.onEntryAdded(entryToPin);
 
         assertEquals(1, mUiEventLoggerFake.numLogs());
         assertEquals(BaseHeadsUpManager.NotificationPeekEvent.NOTIFICATION_PEEK.getId(),