Dismiss lock screen for reply notification action
If no real lock is set, selecting a notification action should launch
the ComposeActivity in front of the lock screen.
Rather than going through a Service, we now launch ComposeActivity
directly, and clear the notification from there.
Bug: 7957838
Change-Id: I6344c93656106b2875bafac5bec18236d5c1d996
diff --git a/src/com/android/mail/compose/ComposeActivity.java b/src/com/android/mail/compose/ComposeActivity.java
index 2def962..04b3939 100644
--- a/src/com/android/mail/compose/ComposeActivity.java
+++ b/src/com/android/mail/compose/ComposeActivity.java
@@ -67,6 +67,7 @@
import com.android.common.Rfc822Validator;
import com.android.ex.chips.RecipientEditTextView;
+import com.android.mail.MailIntentService;
import com.android.mail.R;
import com.android.mail.compose.AttachmentsView.AttachmentAddedOrDeletedListener;
import com.android.mail.compose.AttachmentsView.AttachmentFailureException;
@@ -75,6 +76,7 @@
import com.android.mail.providers.Account;
import com.android.mail.providers.Address;
import com.android.mail.providers.Attachment;
+import com.android.mail.providers.Folder;
import com.android.mail.providers.MailAppProvider;
import com.android.mail.providers.Message;
import com.android.mail.providers.MessageModification;
@@ -175,6 +177,9 @@
public static final String EXTRA_ATTACHMENTS = "attachments";
+ /** If set, we will clear notifications for this folder. */
+ public static final String EXTRA_NOTIFICATION_FOLDER = "extra-notification-folder";
+
// If this is a reply/forward then this extra will hold the original message
private static final String EXTRA_IN_REFERENCE_TO_MESSAGE = "in-reference-to-message";
// If this is a reply/forward then this extra will hold a uri we must query
@@ -386,6 +391,18 @@
return;
}
+ // Clear the notification and mark the conversation as seen, if necessary
+ final Folder notificationFolder =
+ intent.getParcelableExtra(EXTRA_NOTIFICATION_FOLDER);
+ if (notificationFolder != null) {
+ final Intent clearNotifIntent =
+ new Intent(MailIntentService.ACTION_CLEAR_NEW_MAIL_NOTIFICATIONS);
+ clearNotifIntent.putExtra(MailIntentService.ACCOUNT_EXTRA, account.name);
+ clearNotifIntent.putExtra(MailIntentService.FOLDER_EXTRA, notificationFolder);
+
+ startService(clearNotifIntent);
+ }
+
if (intent.getBooleanExtra(EXTRA_FROM_EMAIL_TASK, false)) {
mLaunchedFromEmail = true;
} else if (Intent.ACTION_SEND.equals(intent.getAction())) {