Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9e938c9 authored by Kevin's avatar Kevin
Browse files

Rename setShouldExtendLifetime in LifetimeExtender

Rename NotificationLifetimeExtender.setShouldExtendLifetime to
setShouldManageLifetime.  This is more clear in what the logic actually
is and reads better.

Test: runtest systemui
Change-Id: Ic5792322ef0a557812d58f07285acee32cce0c1a
parent d4378f7a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -248,7 +248,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim
    }
    }


    @Override
    @Override
    public void setShouldExtendLifetime(NotificationData.Entry entry, boolean shouldExtend) {
    public void setShouldManageLifetime(NotificationData.Entry entry, boolean shouldExtend) {
        if (shouldExtend) {
        if (shouldExtend) {
            mExtendedLifetimeAlertEntries.add(entry);
            mExtendedLifetimeAlertEntries.add(entry);
        } else {
        } else {
+7 −7
Original line number Original line Diff line number Diff line
@@ -27,17 +27,17 @@ public interface NotificationLifetimeExtender {
    boolean shouldExtendLifetime(@NonNull NotificationData.Entry entry);
    boolean shouldExtendLifetime(@NonNull NotificationData.Entry entry);


    /**
    /**
     * Sets whether or not the lifetime should be extended.  In practice, if shouldExtend is
     * Sets whether or not the lifetime should be managed by the extender.  In practice, if
     * true, this is where the extender starts managing the entry internally and is now
     * shouldManage is true, this is where the extender starts managing the entry internally and is
     * responsible for calling {@link NotificationSafeToRemoveCallback#onSafeToRemove(String)} when
     * now responsible for calling {@link NotificationSafeToRemoveCallback#onSafeToRemove(String)}
     * the entry is safe to remove.  If shouldExtend is false, the extender no longer needs to
     * 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
     * worry about it (either because we will be removing it anyway or the entry is no longer
     * removed due to an update).
     * removed due to an update).
     *
     *
     * @param entry the entry to mark as having an extended lifetime
     * @param entry the entry that needs an extended lifetime
     * @param shouldExtend true if the extender should manage the entry now, false otherwise
     * @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).
     * The callback for when the notification is now safe to remove (i.e. its lifetime has ended).
+3 −3
Original line number Original line Diff line number Diff line
@@ -502,7 +502,7 @@ public class NotificationRemoteInputManager implements Dumpable {
        }
        }


        @Override
        @Override
        public void setShouldExtendLifetime(NotificationData.Entry entry,
        public void setShouldManageLifetime(NotificationData.Entry entry,
                boolean shouldExtend) {
                boolean shouldExtend) {
            if (shouldExtend) {
            if (shouldExtend) {
                CharSequence remoteInputText = entry.remoteInputText;
                CharSequence remoteInputText = entry.remoteInputText;
@@ -548,7 +548,7 @@ public class NotificationRemoteInputManager implements Dumpable {
        }
        }


        @Override
        @Override
        public void setShouldExtendLifetime(NotificationData.Entry entry,
        public void setShouldManageLifetime(NotificationData.Entry entry,
                boolean shouldExtend) {
                boolean shouldExtend) {
            if (shouldExtend) {
            if (shouldExtend) {
                StatusBarNotification newSbn = rebuildNotificationForCanceledSmartReplies(entry);
                StatusBarNotification newSbn = rebuildNotificationForCanceledSmartReplies(entry);
@@ -589,7 +589,7 @@ public class NotificationRemoteInputManager implements Dumpable {
        }
        }


        @Override
        @Override
        public void setShouldExtendLifetime(NotificationData.Entry entry,
        public void setShouldManageLifetime(NotificationData.Entry entry,
                boolean shouldExtend) {
                boolean shouldExtend) {
            if (shouldExtend) {
            if (shouldExtend) {
                if (Log.isLoggable(TAG, Log.DEBUG)) {
                if (Log.isLoggable(TAG, Log.DEBUG)) {
+4 −4
Original line number Original line Diff line number Diff line
@@ -491,7 +491,7 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater.
            for (NotificationLifetimeExtender extender : mNotificationLifetimeExtenders) {
            for (NotificationLifetimeExtender extender : mNotificationLifetimeExtenders) {
                if (extender.shouldExtendLifetime(entry)) {
                if (extender.shouldExtendLifetime(entry)) {
                    mLatestRankingMap = ranking;
                    mLatestRankingMap = ranking;
                    extender.setShouldExtendLifetime(entry, true /* shouldExtend */);
                    extender.setShouldManageLifetime(entry, true /* shouldManage */);
                    return;
                    return;
                }
                }
            }
            }
@@ -501,7 +501,7 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater.


        // Ensure any managers keeping the lifetime extended stop managing the entry
        // Ensure any managers keeping the lifetime extended stop managing the entry
        for (NotificationLifetimeExtender extender: mNotificationLifetimeExtenders) {
        for (NotificationLifetimeExtender extender: mNotificationLifetimeExtenders) {
            extender.setShouldExtendLifetime(entry, false /* shouldExtend */);
            extender.setShouldManageLifetime(entry, false /* shouldManage */);
        }
        }


        mMediaManager.onNotificationRemoved(key);
        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
        // 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) {
        for (NotificationLifetimeExtender extender : mNotificationLifetimeExtenders) {
            extender.setShouldExtendLifetime(entry, false /* shouldExtend */);
            extender.setShouldManageLifetime(entry, false /* shouldManage */);
        }
        }


        Notification n = notification.getNotification();
        Notification n = notification.getNotification();
+1 −1
Original line number Original line Diff line number Diff line
@@ -418,7 +418,7 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
    }
    }


    @Override
    @Override
    public void setShouldExtendLifetime(NotificationData.Entry entry, boolean shouldExtend) {
    public void setShouldManageLifetime(NotificationData.Entry entry, boolean shouldExtend) {
        if (shouldExtend) {
        if (shouldExtend) {
            mKeyToRemoveOnGutsClosed = entry.key;
            mKeyToRemoveOnGutsClosed = entry.key;
            if (Log.isLoggable(TAG, Log.DEBUG)) {
            if (Log.isLoggable(TAG, Log.DEBUG)) {
Loading