summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2015-04-06 00:44:28 +0200
committerSteve Kondik <steve@cyngn.com>2015-10-18 14:13:46 -0700
commitf84ec950c0a31076222374f49672c831fbcd34a1 (patch)
tree0f929a8c924560047cb1a18df74293cc494b82bc /src
parent764a47d5a928d0edd9778a91be7b98d501711911 (diff)
downloadandroid_packages_apps_UnifiedEmail-f84ec950c0a31076222374f49672c831fbcd34a1.tar.gz
android_packages_apps_UnifiedEmail-f84ec950c0a31076222374f49672c831fbcd34a1.tar.bz2
android_packages_apps_UnifiedEmail-f84ec950c0a31076222374f49672c831fbcd34a1.zip
unified-email: check notification support prior to create notification objects
Change-Id: I86513d397d75c3dc2f0dad1b3399c4ffeaabf173 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src')
-rw-r--r--src/com/android/mail/utils/NotificationUtils.java36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/com/android/mail/utils/NotificationUtils.java b/src/com/android/mail/utils/NotificationUtils.java
index 456d47adc..910870248 100644
--- a/src/com/android/mail/utils/NotificationUtils.java
+++ b/src/com/android/mail/utils/NotificationUtils.java
@@ -547,6 +547,26 @@ public class NotificationUtils {
final Account account, boolean getAttention, boolean ignoreUnobtrusiveSetting,
NotificationKey key, final ContactFetcher contactFetcher) {
+ // Check that the folder supports notifications, prior to create all the
+ // NotificationManager stuff
+ final boolean isInbox = folder.folderUri.equals(account.settings.defaultInbox);
+ final FolderPreferences folderPreferences =
+ new FolderPreferences(context, account.getAccountId(), folder, isInbox);
+
+ if (isInbox) {
+ final AccountPreferences accountPreferences =
+ new AccountPreferences(context, account.getAccountId());
+ moveNotificationSetting(accountPreferences, folderPreferences);
+ }
+
+ if (!folderPreferences.areNotificationsEnabled()) {
+ LogUtils.i(LOG_TAG, "Notifications are disabled for this folder; not notifying");
+ // Don't notify
+ return;
+ }
+
+
+
NotificationManagerCompat nm = NotificationManagerCompat.from(context);
final NotificationMap notificationMap = getNotificationMap(context);
@@ -675,22 +695,6 @@ public class NotificationUtils {
boolean eventInfoConfigured = false;
- final boolean isInbox = folder.folderUri.equals(account.settings.defaultInbox);
- final FolderPreferences folderPreferences =
- new FolderPreferences(context, account.getAccountId(), folder, isInbox);
-
- if (isInbox) {
- final AccountPreferences accountPreferences =
- new AccountPreferences(context, account.getAccountId());
- moveNotificationSetting(accountPreferences, folderPreferences);
- }
-
- if (!folderPreferences.areNotificationsEnabled()) {
- LogUtils.i(LOG_TAG, "Notifications are disabled for this folder; not notifying");
- // Don't notify
- return;
- }
-
if (unreadCount > 0) {
// How can I order this properly?
if (cursor.moveToNext()) {