Repository: thundernest/k-9
Issue: Crash: TransactionTooLargeException when creating a summary notification

Received via Google Play Developer Console.

Presumably this happens when there are a lot of new messages and the list of serialized `MessageReference`s for all new messages exceeds the binder transaction limit.

### Stack trace

```text
Exception java.lang.RuntimeException:
  at android.app.PendingIntent.buildServicePendingIntent (PendingIntent.java:761)
  at android.app.PendingIntent.getService (PendingIntent.java:712)
  at com.fsck.k9.notification.K9NotificationActionCreator.createMarkAllAsReadPendingIntent (K9NotificationActionCreator.kt:110)
  at com.fsck.k9.notification.SummaryNotificationCreator.addMarkAllAsReadAction (SummaryNotificationCreator.kt:124)
  at com.fsck.k9.notification.SummaryNotificationCreator.setDeviceActions (SummaryNotificationCreator.kt:111)
  at com.fsck.k9.notification.SummaryNotificationCreator.createInboxStyleSummaryNotification (SummaryNotificationCreator.kt:67)
  at com.fsck.k9.notification.SummaryNotificationCreator.createSummaryNotification (SummaryNotificationCreator.kt:27)
  at com.fsck.k9.notification.NewMailNotificationController.createSummaryNotification (NewMailNotificationController.kt:90)
  at com.fsck.k9.notification.NewMailNotificationController.processNewMailNotificationData (NewMailNotificationController.kt:69)
  at com.fsck.k9.notification.NewMailNotificationController.restoreNewMailNotifications (NewMailNotificationController.kt:23)
  at com.fsck.k9.notification.NotificationController.restoreNewMailNotifications (NotificationController.kt:61)
  at com.fsck.k9.Core$restoreNotifications$1.invokeSuspend (Core.kt:86)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106)
  at kotlinx.coroutines.internal.LimitedDispatcher.run (LimitedDispatcher.kt:42)
  at kotlinx.coroutines.scheduling.TaskImpl.run (Tasks.kt:95)
  at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely (CoroutineScheduler.kt:570)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask (CoroutineScheduler.kt:750)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker (CoroutineScheduler.kt:677)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run (CoroutineScheduler.kt:664)
Caused by android.os.TransactionTooLargeException:
  at android.os.BinderProxy.transactNative
  at android.os.BinderProxy.transact (BinderProxy.java:584)
  at android.app.IActivityManager$Stub$Proxy.getIntentSenderWithFeature (IActivityManager.java:5885)
  at android.app.PendingIntent.buildServicePendingIntent (PendingIntent.java:754)
```

Changed files:
app/core/src/main/java/com/fsck/k9/notification/SummaryNotificationDataCreator.kt
app/core/src/main/java/com/fsck/k9/notification/NotificationData.kt

diff --git a/app/core/src/main/java/com/fsck/k9/notification/NotificationData.kt b/app/core/src/main/java/com/fsck/k9/notification/NotificationData.kt
index ab6f36399..d3f8dcd21 100644
--- a/app/core/src/main/java/com/fsck/k9/notification/NotificationData.kt
+++ b/app/core/src/main/java/com/fsck/k9/notification/NotificationData.kt
@@ -29,6 +29,9 @@ internal data class NotificationData(
             }
         }
 
+    val activeMessageReferences: List<MessageReference>
+        get() = activeNotifications.map { it.content.messageReference }
+
     fun isEmpty() = activeNotifications.isEmpty()
 
     companion object {
diff --git a/app/core/src/main/java/com/fsck/k9/notification/SummaryNotificationDataCreator.kt b/app/core/src/main/java/com/fsck/k9/notification/SummaryNotificationDataCreator.kt
index 6decadf15..34d82efcf 100644
--- a/app/core/src/main/java/com/fsck/k9/notification/SummaryNotificationDataCreator.kt
+++ b/app/core/src/main/java/com/fsck/k9/notification/SummaryNotificationDataCreator.kt
@@ -37,7 +37,7 @@ internal class SummaryNotificationDataCreator(
             timestamp = timestamp,
             content = data.summaryContent,
             additionalMessagesCount = data.additionalMessagesCount,
-            messageReferences = data.messageReferences,
+            messageReferences = data.activeMessageReferences,
             actions = createSummaryNotificationActions(),
             wearActions = createSummaryWearNotificationActions(data.account)
         )