From c133ab8258f8e976f402d57456b1f06d11a78b03 Mon Sep 17 00:00:00 2001 From: John Spurlock Date: Mon, 10 Jun 2013 15:16:22 -0400 Subject: Log errors found in notification listener callbacks. Otherwise, exceptions thrown inside listener callbacks are not logged at all. Change-Id: Iaef28e06abc4d6caf66051725e14a17ac954173e --- .../service/notification/NotificationListenerService.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index bfea9ca..2e0e59b 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -164,11 +164,19 @@ public abstract class NotificationListenerService extends Service { private class INotificationListenerWrapper extends INotificationListener.Stub { @Override public void onNotificationPosted(StatusBarNotification sbn) { - NotificationListenerService.this.onNotificationPosted(sbn); + try { + NotificationListenerService.this.onNotificationPosted(sbn); + } catch (Throwable t) { + Log.w(TAG, "Error running onNotificationPosted", t); + } } @Override public void onNotificationRemoved(StatusBarNotification sbn) { - NotificationListenerService.this.onNotificationRemoved(sbn); + try { + NotificationListenerService.this.onNotificationRemoved(sbn); + } catch (Throwable t) { + Log.w(TAG, "Error running onNotificationRemoved", t); + } } } } -- cgit v1.1