Change notification undo timeout to 6 seconds

Bug: 7685493
Change-Id: I31eba6779641f907bfea0ee1e874d7fe18e13d0e
diff --git a/res/values/constants.xml b/res/values/constants.xml
index 31fa37a..a608523 100644
--- a/res/values/constants.xml
+++ b/res/values/constants.xml
@@ -100,4 +100,7 @@
 
     <!-- Whether or not to prompt the user to enable auto-fit the first time they encounter a wide message. TODO: Remove this when the email setting is added. -->
     <integer name="prompt_auto_fit_on_first_wide_message">0</integer>
+
+    <!-- The timeout, in milliseconds, before the "Undo" notification is removed. -->
+    <integer name="undo_notification_timeout">6000</integer>
 </resources>
diff --git a/src/com/android/mail/utils/NotificationActionUtils.java b/src/com/android/mail/utils/NotificationActionUtils.java
index 88ce49b..600306a 100644
--- a/src/com/android/mail/utils/NotificationActionUtils.java
+++ b/src/com/android/mail/utils/NotificationActionUtils.java
@@ -55,7 +55,7 @@
 import java.util.Set;
 
 public class NotificationActionUtils {
-    private static final long UNDO_TIMEOUT_MILLIS = 10 * DateUtils.SECOND_IN_MILLIS;
+    private static long sUndoTimeoutMillis = -1;
 
     /**
      * If an {@link NotificationAction} exists here for a given notification key, then we should
@@ -618,10 +618,15 @@
      */
     public static void registerUndoTimeout(
             final Context context, final NotificationAction notificationAction) {
+        if (sUndoTimeoutMillis == -1) {
+            sUndoTimeoutMillis =
+                    context.getResources().getInteger(R.integer.undo_notification_timeout);
+        }
+
         final AlarmManager alarmManager =
                 (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
 
-        final long triggerAtMills = SystemClock.elapsedRealtime() + UNDO_TIMEOUT_MILLIS;
+        final long triggerAtMills = SystemClock.elapsedRealtime() + sUndoTimeoutMillis;
 
         final PendingIntent pendingIntent =
                 createUndoTimeoutPendingIntent(context, notificationAction);