From 52020492f26990a1f18aa4474bbfce44b5d0c650 Mon Sep 17 00:00:00 2001 From: Chris Wren Date: Wed, 6 Apr 2016 11:12:02 -0400 Subject: [PATCH] don't pin ranking updates at the end of the queue. Apparently we schedule ranking updates all the time, so the job gets pulled to the end of the queue, and can get starved. This change makes sure we don't schedule multiple updates by leaving it in the queue. If a job in the queue behind hte update request needs to send an update it will jsut request one anyway, so we shouldn't miss updates. Bug: 28015158 Change-Id: Id5b9d05ea6eb35e610ee34651e4cde8cddd4ae66 --- .../server/notification/NotificationManagerService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 124d7f1b9c97b..ab49057d922de 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -2898,9 +2898,10 @@ public class NotificationManagerService extends SystemService { } private void scheduleSendRankingUpdate() { - mHandler.removeMessages(MESSAGE_SEND_RANKING_UPDATE); - Message m = Message.obtain(mHandler, MESSAGE_SEND_RANKING_UPDATE); - mHandler.sendMessage(m); + if (!mHandler.hasMessages(MESSAGE_SEND_RANKING_UPDATE)) { + Message m = Message.obtain(mHandler, MESSAGE_SEND_RANKING_UPDATE); + mHandler.sendMessage(m); + } } private void handleSendRankingUpdate() {