diff options
9 files changed, 26 insertions, 29 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java index 35e9d55c83b6..45165180e93a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java @@ -248,7 +248,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim } @Override - public void setShouldExtendLifetime(NotificationData.Entry entry, boolean shouldExtend) { + public void setShouldManageLifetime(NotificationData.Entry entry, boolean shouldExtend) { if (shouldExtend) { mExtendedLifetimeAlertEntries.add(entry); } else { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLifetimeExtender.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLifetimeExtender.java index 42e380f9b076..62c21dc17386 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLifetimeExtender.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLifetimeExtender.java @@ -27,17 +27,17 @@ public interface NotificationLifetimeExtender { boolean shouldExtendLifetime(@NonNull NotificationData.Entry entry); /** - * Sets whether or not the lifetime should be extended. In practice, if shouldExtend is - * true, this is where the extender starts managing the entry internally and is now - * responsible for calling {@link NotificationSafeToRemoveCallback#onSafeToRemove(String)} when - * the entry is safe to remove. If shouldExtend is false, the extender no longer needs to + * Sets whether or not the lifetime should be managed by the extender. In practice, if + * shouldManage is true, this is where the extender starts managing the entry internally and is + * now responsible for calling {@link NotificationSafeToRemoveCallback#onSafeToRemove(String)} + * when the entry is safe to remove. If shouldManage is false, the extender no longer needs to * worry about it (either because we will be removing it anyway or the entry is no longer * removed due to an update). * - * @param entry the entry to mark as having an extended lifetime - * @param shouldExtend true if the extender should manage the entry now, false otherwise + * @param entry the entry that needs an extended lifetime + * @param shouldManage true if the extender should manage the entry now, false otherwise */ - void setShouldExtendLifetime(@NonNull NotificationData.Entry entry, boolean shouldExtend); + void setShouldManageLifetime(@NonNull NotificationData.Entry entry, boolean shouldManage); /** * The callback for when the notification is now safe to remove (i.e. its lifetime has ended). diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java index 1a3e812a1368..ea7e03e686b5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java @@ -502,7 +502,7 @@ public class NotificationRemoteInputManager implements Dumpable { } @Override - public void setShouldExtendLifetime(NotificationData.Entry entry, + public void setShouldManageLifetime(NotificationData.Entry entry, boolean shouldExtend) { if (shouldExtend) { CharSequence remoteInputText = entry.remoteInputText; @@ -548,7 +548,7 @@ public class NotificationRemoteInputManager implements Dumpable { } @Override - public void setShouldExtendLifetime(NotificationData.Entry entry, + public void setShouldManageLifetime(NotificationData.Entry entry, boolean shouldExtend) { if (shouldExtend) { StatusBarNotification newSbn = rebuildNotificationForCanceledSmartReplies(entry); @@ -589,7 +589,7 @@ public class NotificationRemoteInputManager implements Dumpable { } @Override - public void setShouldExtendLifetime(NotificationData.Entry entry, + public void setShouldManageLifetime(NotificationData.Entry entry, boolean shouldExtend) { if (shouldExtend) { if (Log.isLoggable(TAG, Log.DEBUG)) { 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 906bbb9cdd88..ac01fa32c902 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java @@ -491,7 +491,7 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater. for (NotificationLifetimeExtender extender : mNotificationLifetimeExtenders) { if (extender.shouldExtendLifetime(entry)) { mLatestRankingMap = ranking; - extender.setShouldExtendLifetime(entry, true /* shouldExtend */); + extender.setShouldManageLifetime(entry, true /* shouldManage */); return; } } @@ -501,7 +501,7 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater. // Ensure any managers keeping the lifetime extended stop managing the entry for (NotificationLifetimeExtender extender: mNotificationLifetimeExtenders) { - extender.setShouldExtendLifetime(entry, false /* shouldExtend */); + extender.setShouldManageLifetime(entry, false /* shouldManage */); } mMediaManager.onNotificationRemoved(key); @@ -745,9 +745,9 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater. } // Notification is updated so it is essentially re-added and thus alive again. Don't need - // to keep it's lifetime extended. + // to keep its lifetime extended. for (NotificationLifetimeExtender extender : mNotificationLifetimeExtenders) { - extender.setShouldExtendLifetime(entry, false /* shouldExtend */); + extender.setShouldManageLifetime(entry, false /* shouldManage */); } Notification n = notification.getNotification(); 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 a096baa2df9d..f4ef0f865a76 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 @@ -418,7 +418,7 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx } @Override - public void setShouldExtendLifetime(NotificationData.Entry entry, boolean shouldExtend) { + public void setShouldManageLifetime(NotificationData.Entry entry, boolean shouldExtend) { if (shouldExtend) { mKeyToRemoveOnGutsClosed = entry.key; if (Log.isLoggable(TAG, Log.DEBUG)) { 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 32c972cbd188..f21ce2780d40 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java @@ -34,7 +34,6 @@ import android.testing.TestableLooper; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; -import com.android.systemui.statusbar.AlertingNotificationManager; import com.android.systemui.statusbar.notification.NotificationData; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; @@ -183,19 +182,19 @@ public class AlertingNotificationManagerTest extends SysuiTestCase { } @Test - public void testSetShouldExtendLifetime_setShouldExtend() { + public void testSetShouldManageLifetime_setShouldManage() { mAlertingNotificationManager.showNotification(mEntry); - mAlertingNotificationManager.setShouldExtendLifetime(mEntry, true /* shouldExtend */); + mAlertingNotificationManager.setShouldManageLifetime(mEntry, true /* shouldManage */); assertTrue(mAlertingNotificationManager.mExtendedLifetimeAlertEntries.contains(mEntry)); } @Test - public void testSetShouldExtendLifetime_setShouldNotExtend() { + public void testSetShouldManageLifetime_setShouldNotManage() { mAlertingNotificationManager.mExtendedLifetimeAlertEntries.add(mEntry); - mAlertingNotificationManager.setShouldExtendLifetime(mEntry, false /* shouldExtend */); + mAlertingNotificationManager.setShouldManageLifetime(mEntry, false /* shouldManage */); assertFalse(mAlertingNotificationManager.mExtendedLifetimeAlertEntries.contains(mEntry)); } 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 b2493b37327b..8a59e968d16e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java @@ -31,8 +31,6 @@ import com.android.systemui.statusbar.NotificationRemoteInputManager.SmartReplyH import com.google.android.collect.Sets; -import junit.framework.Assert; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -130,7 +128,7 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { @Test public void testNotificationWithRemoteInputActiveIsRemovedOnCollapse() { - mRemoteInputActiveExtender.setShouldExtendLifetime(mEntry, true); + mRemoteInputActiveExtender.setShouldManageLifetime(mEntry, true /* shouldManage */); assertEquals(mRemoteInputManager.getEntriesKeptForRemoteInputActive(), Sets.newArraySet(mEntry)); 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 dacf59c584ad..4e16b7f94283 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 @@ -330,7 +330,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase { mEntryManager.removeNotification(mSbn.getKey(), mRankingMap); assertNotNull(mEntryManager.getNotificationData().get(mSbn.getKey())); - verify(extender).setShouldExtendLifetime(mEntry, true); + verify(extender).setShouldManageLifetime(mEntry, true /* shouldManage */); } @Test 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 6656fdd42e92..8edbf176215a 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 @@ -363,18 +363,18 @@ public class NotificationGutsManagerTest extends SysuiTestCase { } @Test - public void testSetShouldExtendLifetime_setShouldExtend() { + public void testSetShouldManageLifetime_setShouldManage() { NotificationData.Entry entry = createTestNotificationRow().getEntry(); - mGutsManager.setShouldExtendLifetime(entry, true /* shouldExtend */); + mGutsManager.setShouldManageLifetime(entry, true /* shouldManage */); assertTrue(entry.key.equals(mGutsManager.mKeyToRemoveOnGutsClosed)); } @Test - public void testSetShouldExtendLifetime_setShouldNotExtend() { + public void testSetShouldManageLifetime_setShouldNotManage() { NotificationData.Entry entry = createTestNotificationRow().getEntry(); mGutsManager.mKeyToRemoveOnGutsClosed = entry.key; - mGutsManager.setShouldExtendLifetime(entry, false /* shouldExtend */); + mGutsManager.setShouldManageLifetime(entry, false /* shouldManage */); assertNull(mGutsManager.mKeyToRemoveOnGutsClosed); } |