From 41da5ff98f68a575fc46085e8714c8a3e5e5c17a Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Tue, 5 Aug 2014 15:57:38 -0400 Subject: [PATCH] Debugging bad notification sorts. Bug: 16626175 Change-Id: I6cc7ee5f853c846e3aed6f9750e8fb6bc5aed699 --- .../NotificationManagerService.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index f575b9a5e6d0d..743abc8fae679 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -1642,7 +1642,23 @@ public class NotificationManagerService extends SystemService { applyZenModeLocked(r); - mRankingHelper.sort(mNotificationList); + try { + mRankingHelper.sort(mNotificationList); + } catch (RuntimeException ex) { + // Don't crash the system server if something bad happened. + Log.e(TAG, "Extreme badness during notification sort", ex); + Log.e(TAG, "Current notification list: "); + for (int ii=0; ii < mNotificationList.size(); ii++) { + NotificationRecord nr = mNotificationList.get(ii); + Log.e(TAG, String.format( + " [%d] %s (group %s, rank %d, sortkey %s, proxy %s)", + ii, nr, nr.getGroupKey(), nr.getAuthoritativeRank(), + nr.getNotification().getSortKey(), + nr.getRankingProxy())); + } + // STOPSHIP: remove once b/16626175 is found + throw ex; + } if (notification.icon != 0) { StatusBarNotification oldSbn = (old != null) ? old.sbn : null;