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

Commit 6d24aa43 authored by Roman Birg's avatar Roman Birg Committed by Steve Kondik
Browse files

SystemUI: survive notification update spam



When handling a very high number of incoming notification updates, SystemUI can
choke up at updateNotifications() in PhoneStatusBar. Funnel
updateNotification() calls through the StatusBar's handler and don't
stack them up.

Change-Id: I806d1fd8eac73c4af0820319d127423ae6467f60
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 83490989
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -224,6 +224,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    private static final int MSG_CLOSE_PANELS = 1001;
    private static final int MSG_OPEN_SETTINGS_PANEL = 1002;
    private static final int MSG_LAUNCH_TRANSITION_TIMEOUT = 1003;
    private static final int MSG_UPDATE_NOTIFICATIONS = 1004;
    // 1020-1040 reserved for BaseStatusBar

    // Time after we abort the launch transition.
@@ -1662,14 +1663,20 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        return entry.row.getParent() instanceof NotificationStackScrollLayout;
    }

    @Override
    protected void updateNotifications() {
    private void handleUpdateNotifications() {
        mNotificationData.filterAndSort();

        updateNotificationShade();
        mIconController.updateNotificationIcons(mNotificationData);
    }

    @Override
    protected void updateNotifications() {
        if (!mHandler.hasMessages(MSG_UPDATE_NOTIFICATIONS)) {
            mHandler.sendEmptyMessage(MSG_UPDATE_NOTIFICATIONS);
        }
    }

    @Override
    protected void updateRowStates() {
        super.updateRowStates();
@@ -2287,6 +2294,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                case MSG_LAUNCH_TRANSITION_TIMEOUT:
                    onLaunchTransitionTimeout();
                    break;
                case MSG_UPDATE_NOTIFICATIONS:
                    handleUpdateNotifications();
                    break;
            }
        }
    }