summaryrefslogtreecommitdiffstats
path: root/src/com/android/mail/MailIntentService.java
diff options
context:
space:
mode:
authorScott Kennedy <skennedy@google.com>2012-12-05 11:11:32 -0800
committerScott Kennedy <skennedy@google.com>2013-02-07 18:15:37 -0800
commitd5edd2d02649dffb40065fdb6a16acf91552b800 (patch)
treed82dd21977830000c763035032adb868b1ba1b8c /src/com/android/mail/MailIntentService.java
parent5d5002d9e8f5b424299a46088688ac662b5e1003 (diff)
downloadandroid_packages_apps_UnifiedEmail-d5edd2d02649dffb40065fdb6a16acf91552b800.tar.gz
android_packages_apps_UnifiedEmail-d5edd2d02649dffb40065fdb6a16acf91552b800.tar.bz2
android_packages_apps_UnifiedEmail-d5edd2d02649dffb40065fdb6a16acf91552b800.zip
Move notifications to UnifiedEmail
This involves redoing the persistence model, to split general, account, and folder settings into separate SharedPreference stores. It also requires some preferences to be moved into UnifiedEmail. Depends on I71802444add85dc01f6645906a629ff80b964222 (UnifiedGmail) Depends on Ie6ec389b5b5d2e7ab1b299d0877811ae716526e2 (Email) Change-Id: Ibe2e3f93ec164370535ffc5f5b2409544cc8d36d
Diffstat (limited to 'src/com/android/mail/MailIntentService.java')
-rw-r--r--src/com/android/mail/MailIntentService.java43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/com/android/mail/MailIntentService.java b/src/com/android/mail/MailIntentService.java
index 709587997..f30a12844 100644
--- a/src/com/android/mail/MailIntentService.java
+++ b/src/com/android/mail/MailIntentService.java
@@ -16,20 +16,32 @@
package com.android.mail;
import android.app.IntentService;
+import android.content.Context;
import android.content.Intent;
+import com.android.mail.providers.Account;
+import com.android.mail.providers.Folder;
+import com.android.mail.utils.LogTag;
+import com.android.mail.utils.LogUtils;
+import com.android.mail.utils.NotificationUtils;
+
/**
* A service to handle various intents asynchronously.
*/
public class MailIntentService extends IntentService {
+ private static final String LOG_TAG = LogTag.getLogTag();
+
public static final String ACTION_RESEND_NOTIFICATIONS =
"com.android.mail.action.RESEND_NOTIFICATIONS";
public static final String ACTION_CLEAR_NEW_MAIL_NOTIFICATIONS =
"com.android.mail.action.CLEAR_NEW_MAIL_NOTIFICATIONS";
public static final String ACTION_MARK_SEEN = "com.android.mail.action.MARK_SEEN";
+ public static final String ACTION_BACKUP_DATA_CHANGED =
+ "com.android.mail.action.BACKUP_DATA_CHANGED";
public static final String ACCOUNT_EXTRA = "account";
public static final String FOLDER_EXTRA = "folder";
+ public static final String CONVERSATION_EXTRA = "conversation";
public MailIntentService() {
super("MailIntentService");
@@ -41,6 +53,35 @@ public class MailIntentService extends IntentService {
@Override
protected void onHandleIntent(final Intent intent) {
- // UnifiedEmail does not handle any of these at the moment
+ // UnifiedEmail does not handle all Intents
+
+ LogUtils.v(LOG_TAG, "Handling intent %s", intent);
+
+ final String action = intent.getAction();
+
+ if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
+ handleLocaleChanged();
+ } else if (ACTION_CLEAR_NEW_MAIL_NOTIFICATIONS.equals(action)) {
+ final Account account = intent.getParcelableExtra(ACCOUNT_EXTRA);
+ final Folder folder = intent.getParcelableExtra(FOLDER_EXTRA);
+
+ NotificationUtils.clearFolderNotification(this, account, folder);
+ } else if (ACTION_RESEND_NOTIFICATIONS.equals(action)) {
+ NotificationUtils.resendNotifications(this, false);
+ } else if (ACTION_MARK_SEEN.equals(action)) {
+ final Folder folder = intent.getParcelableExtra(FOLDER_EXTRA);
+
+ NotificationUtils.markSeen(this, folder);
+ }
+ }
+
+ public static void broadcastBackupDataChanged(final Context context) {
+ final Intent intent = new Intent(ACTION_BACKUP_DATA_CHANGED);
+ context.startService(intent);
+ }
+
+ private void handleLocaleChanged() {
+ // Cancel all notifications. The correct ones will be recreated when the app starts back up
+ NotificationUtils.cancelAndResendNotifications(this);
}
}