Merge "Add content intent to child notification to allow user to open individual email in a card bundle." into ub-mail-master
diff --git a/src/com/android/mail/utils/NotificationUtils.java b/src/com/android/mail/utils/NotificationUtils.java
index 8f9498c..83bded2 100644
--- a/src/com/android/mail/utils/NotificationUtils.java
+++ b/src/com/android/mail/utils/NotificationUtils.java
@@ -654,16 +654,7 @@
                         return;
                     }
 
-                    // Amend the click intent with a hint that its source was a notification,
-                    // but remove the hint before it's used to generate notification action
-                    // intents. This prevents the following sequence:
-                    // 1. generate single notification
-                    // 2. user clicks reply, then completes Compose activity
-                    // 3. main activity launches, gets FROM_NOTIFICATION hint in intent
-                    notificationIntent.putExtra(Utils.EXTRA_FROM_NOTIFICATION, true);
-                    clickIntent = PendingIntent.getActivity(context, -1, notificationIntent,
-                            PendingIntent.FLAG_UPDATE_CURRENT);
-                    notificationIntent.removeExtra(Utils.EXTRA_FROM_NOTIFICATION);
+                    clickIntent = createClickPendingIntent(context, notificationIntent);
 
                     configureLatestEventInfoFromConversation(context, account, folderPreferences,
                             notification, wearableNotification, msgNotifications, notificationId,
@@ -773,6 +764,21 @@
         }
     }
 
+    private static PendingIntent createClickPendingIntent(Context context,
+            Intent notificationIntent) {
+        // Amend the click intent with a hint that its source was a notification,
+        // but remove the hint before it's used to generate notification action
+        // intents. This prevents the following sequence:
+        // 1. generate single notification
+        // 2. user clicks reply, then completes Compose activity
+        // 3. main activity launches, gets FROM_NOTIFICATION hint in intent
+        notificationIntent.putExtra(Utils.EXTRA_FROM_NOTIFICATION, true);
+        PendingIntent clickIntent = PendingIntent.getActivity(context, -1, notificationIntent,
+                PendingIntent.FLAG_UPDATE_CURRENT);
+        notificationIntent.removeExtra(Utils.EXTRA_FROM_NOTIFICATION);
+        return clickIntent;
+    }
+
     /**
      * @return an {@link Intent} which, if launched, will display the corresponding conversation
      */
@@ -949,6 +955,11 @@
                                     new NotificationCompat.Builder(context);
                             childNotif.setSmallIcon(R.drawable.stat_notify_email);
                             childNotif.setContentText(digestLine);
+                            Intent childNotificationIntent = createViewConversationIntent(context,
+                                    account, folder, conversationCursor);
+                            PendingIntent childClickIntent = createClickPendingIntent(context,
+                                    childNotificationIntent);
+                            childNotif.setContentIntent(childClickIntent);
 
                             WearableNotifications.Builder childWearNotif =
                                     new WearableNotifications.Builder(childNotif).setGroup(