Merge "Frameworks/base: Fix Notification code"
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index 76c63b9..232d4fe 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -713,10 +713,10 @@
                 createLegacyIconExtras(sbn.getNotification());
                 maybePopulateRemoteViews(sbn.getNotification());
             } catch (IllegalArgumentException e) {
-                // drop corrupt notification
-                sbn = null;
+                // warn and drop corrupt notification
                 Log.w(TAG, "onNotificationPosted: can't rebuild notification from " +
                         sbn.getPackageName());
+                sbn = null;
             }
 
             // protect subclass from concurrent modifications of (@link mNotificationKeys}.
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 1464ea4..e6a48a8 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -3686,7 +3686,7 @@
                     for (int i = 0; i < tokens.length; i++) {
                         String token = tokens[i];
                         if (token != null) {
-                            token.trim();
+                            token = token.trim();
                         }
                         if (TextUtils.isEmpty(token)) {
                             continue;