From 6fb157c90cc04a062eefa5ede850b6efd8d2fc80 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Fri, 25 May 2012 15:58:40 -0700 Subject: [PATCH] Fix problem with empty content disposition * And while we're at it, fix a repeating crash related to notifications. Bug: 6561972 Change-Id: I44f2441bf7bfe4b364a605c0d7c8bae83229837a --- .../src/com/android/emailcommon/internet/MimeUtility.java | 4 +++- email2/src/com/android/email/NotificationController.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/email2/emailcommon/src/com/android/emailcommon/internet/MimeUtility.java b/email2/emailcommon/src/com/android/emailcommon/internet/MimeUtility.java index fed601190..b96e01e59 100644 --- a/email2/emailcommon/src/com/android/emailcommon/internet/MimeUtility.java +++ b/email2/emailcommon/src/com/android/emailcommon/internet/MimeUtility.java @@ -16,6 +16,7 @@ package com.android.emailcommon.internet; +import android.text.TextUtils; import android.util.Base64; import android.util.Base64DataException; import android.util.Base64InputStream; @@ -408,7 +409,8 @@ public class MimeUtility { String disposition = part.getDisposition(); String dispositionType = MimeUtility.getHeaderParameter(disposition, null); // If a disposition is not specified, default to "inline" - boolean inline = dispositionType == null || "inline".equalsIgnoreCase(dispositionType); + boolean inline = + TextUtils.isEmpty(dispositionType) || "inline".equalsIgnoreCase(dispositionType); // The lower-case mime type String mimeType = part.getMimeType().toLowerCase(); diff --git a/email2/src/com/android/email/NotificationController.java b/email2/src/com/android/email/NotificationController.java index 6b65d05f6..c0073f261 100644 --- a/email2/src/com/android/email/NotificationController.java +++ b/email2/src/com/android/email/NotificationController.java @@ -499,7 +499,7 @@ public class NotificationController { EmailContent.MAILBOX_NOTIFICATION_URI, mailbox.mAccountKey), EmailContent.NOTIFICATION_PROJECTION, null, null, null); - if (messageCursor != null) { + if (messageCursor != null && messageCursor.getCount() > 0) { try { final int maxNumDigestItems = mContext.getResources().getInteger( R.integer.max_num_notification_digest_items);