Split ambient pulse notif logic from heads up.

This CL aims to split the ambient pulse logic from the heads up logic as
a lot of the logic is specific to one or the other.  This CL introduces
the following major changes.

1. Introduces AmbientPulseManager which manages notifications that pulse
while the screen is dozing or on AOD and manages their lifetime.

2. Ties pulse duration for notifications more tightly with the lifetime.
This means DozeScrimController does not control the pulse time but
instead AmbientPulseManager.  This is because previously, having two
separate lifetimes (one for the pulse, one for the notification) caused
some strange issues to occur if one ended before the other.

3. Divide out logic for heads up and ambient pulse, so they are no
longer both tied to shouldPeek in NotificationEntryManager.

4. Multiple naming refactors for readability (e.g. contains ->
isAlerting, mShowAmbient -> mOnAmbient, etc.).

Although this is a refactor, some of the behavior does change in some
places where I thought the current behavior was not intended.  In
particular:

* Ambient notifications are no longer marked as seen immediately on
pulsing.  We should reserve this for when we are confident the user has
seen the notification.
* Ambient notifications are no longer disabled or snoozed when heads up
notifications are disabled or snoozed respectively.
* Removing/cancelling a notification that is pulsing no longer keeps
the pulse going awkwardly with no notification in the middle.  Instead,
the pulse ends (provided it was shown for a minimum amount of time).

Change-Id: I26af6f7e7ad7fa71d2d43f7c4d86fb34551151b0
Test: manual, runtest systemui
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 a81d17f..1070795 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
@@ -82,28 +82,26 @@
         // Remove should succeed because the notification is swiped out
         mHeadsUpManager.removeNotification(mEntry.key, false /* releaseImmediately */);
 
-        assertFalse(mHeadsUpManager.contains(mEntry.key));
+        assertFalse(mHeadsUpManager.isAlerting(mEntry.key));
     }
 
     @Test
-    public void testShouldExtendLifetime_swipedOut() {
+    public void testCanRemoveImmediately_swipedOut() {
         mHeadsUpManager.showNotification(mEntry);
         mHeadsUpManager.addSwipedOutNotification(mEntry.key);
 
-        // Notification is swiped so its lifetime should not be extended even if it hasn't been
-        // shown long enough
-        assertFalse(mHeadsUpManager.shouldExtendLifetime(mEntry));
+        // Notification is swiped so it can be immediately removed.
+        assertTrue(mHeadsUpManager.canRemoveImmediately(mEntry.key));
     }
 
     @Test
-    public void testShouldExtendLifetime_notTopEntry() {
+    public void testCanRemoveImmediately_notTopEntry() {
         NotificationData.Entry laterEntry = new NotificationData.Entry(createNewNotification(1));
         laterEntry.row = mRow;
         mHeadsUpManager.showNotification(mEntry);
         mHeadsUpManager.showNotification(laterEntry);
 
-        // Notification is "behind" a higher priority notification so we have no reason to keep
-        // its lifetime extended
-        assertFalse(mHeadsUpManager.shouldExtendLifetime(mEntry));
+        // Notification is "behind" a higher priority notification so we can remove it immediately.
+        assertTrue(mHeadsUpManager.canRemoveImmediately(mEntry.key));
     }
 }