diff --git a/res/values/strings.xml b/res/values/strings.xml index 183e4fc21..9426fceec 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -40,6 +40,14 @@ + + + + + + + + Email @@ -413,16 +421,17 @@ save attachment. %1$d messages moved to %2$s + Could not forward one or more attachments - - Could not forward - %s - - %s - sign-in failed - - Touch to change account settings + + Attachment not forwarded + + + + %s sign-in failed + + Sign-in failed @@ -726,12 +735,12 @@ save attachment. to administer your device will delete all Email accounts that require it, along with their email, contacts, calendar events, and other data. - + Account \"%s\" requires security settings update. - - Update Security Settings + + Security update required Device Security - Account \"%s\" requires you to update your screen - unlock code. + \"%s\" requires you to change your lock screen + PIN or password. - New screen unlock required - - - Account \"%s\" requires you to update your screen - unlock code. Touch here to update it. + [CHAR_LIMIT=30] --> + Lock screen password expiring - Your screen unlock code has expired. + Your lock screen PIN or password has expired. - New screen unlock required - - - Your screen unlock code has expired. Touch here to update it. + Lock screen password expired diff --git a/src/com/android/email/NotificationController.java b/src/com/android/email/NotificationController.java index 406ed850b..775e39af5 100644 --- a/src/com/android/email/NotificationController.java +++ b/src/com/android/email/NotificationController.java @@ -83,6 +83,7 @@ public class NotificationController { /** * Generic notifier for any account. Uses notification rules from account. + * NOTE: Ticker is not shown in Holo XL notifications. * * @param account The account for which the notification is posted * @param ticker String for ticker @@ -95,8 +96,11 @@ public class NotificationController { String contentText, Intent intent, int notificationId) { // Pending Intent - PendingIntent pending = - PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); + PendingIntent pending = null; + if (intent != null) { + pending = + PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); + } // Ringtone & Vibration String ringtoneString = account.getRingtone(); @@ -293,37 +297,20 @@ public class NotificationController { notification.defaults |= Notification.DEFAULT_LIGHTS; } - /** - * Generic warning notification - */ - public void showWarningNotification(int id, String tickerText, String notificationText, - Intent intent) { - PendingIntent pendingIntent = null; - if (intent != null) { - pendingIntent = PendingIntent.getActivity(mContext, 0, intent, - PendingIntent.FLAG_UPDATE_CURRENT); - } - Builder b = new Builder(mContext); - b.setSmallIcon(android.R.drawable.stat_notify_error) - .setTicker(tickerText) - .setWhen(mClock.getTime()) - .setContentTitle(tickerText) - .setContentText(notificationText) - .setContentIntent(pendingIntent) - .setAutoCancel(true); - Notification n = b.getNotification(); - mNotificationManager.notify(id, n); - } - /** * Alert the user that an attachment couldn't be forwarded. This is a very unusual case, and * perhaps we shouldn't even send a notification. For now, it's helpful for debugging. + * NOTE: DO NOT CALL THIS METHOD FROM THE UI THREAD (DATABASE ACCESS) */ - public void showDownloadForwardFailedNotification(Attachment att) { - showWarningNotification(NOTIFICATION_ID_ATTACHMENT_WARNING, + public void showDownloadForwardFailedNotification(Attachment attachment) { + final Account account = Account.restoreAccountWithId(mContext, attachment.mAccountKey); + if (account == null) return; + postAccountNotification(account, mContext.getString(R.string.forward_download_failed_ticker), - mContext.getString(R.string.forward_download_failed_notification, - att.mFileName), null); + mContext.getString(R.string.forward_download_failed_title), + attachment.mFileName, + null, + NOTIFICATION_ID_ATTACHMENT_WARNING); } /** @@ -333,14 +320,19 @@ public class NotificationController { return NOTIFICATION_ID_BASE_LOGIN_WARNING + (int)accountId; } - // NOTE: DO NOT CALL THIS METHOD FROM THE UI THREAD (DATABASE ACCESS) + /** + * Alert the user that login failed on a particular account. + * NOTE: DO NOT CALL THIS METHOD FROM THE UI THREAD (DATABASE ACCESS) + */ public void showLoginFailedNotification(long accountId) { final Account account = Account.restoreAccountWithId(mContext, accountId); if (account == null) return; - showWarningNotification(getLoginFailedNotificationId(accountId), + postAccountNotification(account, mContext.getString(R.string.login_failed_ticker, account.mDisplayName), - mContext.getString(R.string.login_failed_notification), - AccountSettingsXL.createAccountSettingsIntent(mContext, accountId)); + mContext.getString(R.string.login_failed_title), + account.getDisplayName(), + AccountSettingsXL.createAccountSettingsIntent(mContext, accountId), + getLoginFailedNotificationId(accountId)); } public void cancelLoginFailedNotification(long accountId) { diff --git a/src/com/android/email/SecurityPolicy.java b/src/com/android/email/SecurityPolicy.java index f49f3dd4d..e5aac8682 100644 --- a/src/com/android/email/SecurityPolicy.java +++ b/src/com/android/email/SecurityPolicy.java @@ -586,8 +586,7 @@ public class SecurityPolicy { R.string.password_expire_warning_ticker_fmt, account.getDisplayName()); String contentTitle = context.getString( R.string.password_expire_warning_content_title); - String contentText = context.getString( - R.string.password_expire_warning_content_text_fmt, account.getDisplayName()); + String contentText = account.getDisplayName(); NotificationController nc = NotificationController.getInstance(mContext); nc.postAccountNotification(account, ticker, contentTitle, contentText, intent, NotificationController.NOTIFICATION_ID_PASSWORD_EXPIRING); @@ -598,11 +597,10 @@ public class SecurityPolicy { // Post notification Account account = Account.restoreAccountWithId(context, nextExpiringAccountId); if (account == null) return; - Intent intent = - new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD); + Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD); String ticker = context.getString(R.string.password_expired_ticker); String contentTitle = context.getString(R.string.password_expired_content_title); - String contentText = context.getString(R.string.password_expired_content_text); + String contentText = account.getDisplayName(); NotificationController nc = NotificationController.getInstance(mContext); nc.postAccountNotification(account, ticker, contentTitle, contentText, intent,