diff options
author | Paul Westbrook <pwestbro@google.com> | 2014-07-29 22:30:49 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-25 21:16:23 +0000 |
commit | 04919a25559f6ffa7c68b054213ae89e868fc75d (patch) | |
tree | 808daa25b661c14368faafbe8cdcaf419b0c9d22 /src | |
parent | 2b97c08a2f4060cd8cfc4e65cfd2fc649dbb3190 (diff) | |
parent | ce9372d8ee7daf9b05569e98f684f5b7e14f6a04 (diff) | |
download | android_packages_apps_UnifiedEmail-04919a25559f6ffa7c68b054213ae89e868fc75d.tar.gz android_packages_apps_UnifiedEmail-04919a25559f6ffa7c68b054213ae89e868fc75d.tar.bz2 android_packages_apps_UnifiedEmail-04919a25559f6ffa7c68b054213ae89e868fc75d.zip |
Merge "Revert "Use getAccountId for AccountPreferences and FolderPreferences."" into ub-mail-master
Diffstat (limited to 'src')
4 files changed, 17 insertions, 19 deletions
diff --git a/src/com/android/mail/preferences/AccountPreferences.java b/src/com/android/mail/preferences/AccountPreferences.java index 9a0b0fa1b..8f69278ba 100644 --- a/src/com/android/mail/preferences/AccountPreferences.java +++ b/src/com/android/mail/preferences/AccountPreferences.java @@ -60,18 +60,18 @@ public class AccountPreferences extends VersionedPrefs { } /** - * @param account The account id + * @param account The account email. This must never change for the account. */ - public AccountPreferences(final Context context, final String accountId) { - super(context, buildSharedPrefsName(accountId)); + public AccountPreferences(final Context context, final String account) { + super(context, buildSharedPrefsName(account)); } - private static String buildSharedPrefsName(final String accountId) { - return PREFS_NAME_PREFIX + '-' + accountId; + private static String buildSharedPrefsName(final String account) { + return PREFS_NAME_PREFIX + '-' + account; } public static synchronized AccountPreferences get(Context context, Account account) { - final String id = account.getAccountId(); + final String id = account.getAccountId(context); AccountPreferences pref = mInstances.get(id); if (pref == null) { pref = new AccountPreferences(context, id); diff --git a/src/com/android/mail/providers/Account.java b/src/com/android/mail/providers/Account.java index a4d7b141f..aa6224ce8 100644 --- a/src/com/android/mail/providers/Account.java +++ b/src/com/android/mail/providers/Account.java @@ -850,7 +850,7 @@ public class Account implements Parcelable { /** * The account id is an unique id to represent this account. */ - public String getAccountId() { + public String getAccountId(Context context) { LogUtils.d(LogUtils.TAG, "getAccountId = %s for email %s", accountId, accountManagerName); return accountId; } diff --git a/src/com/android/mail/ui/AbstractConversationViewFragment.java b/src/com/android/mail/ui/AbstractConversationViewFragment.java index 924064df9..dc91754d9 100644 --- a/src/com/android/mail/ui/AbstractConversationViewFragment.java +++ b/src/com/android/mail/ui/AbstractConversationViewFragment.java @@ -230,7 +230,7 @@ public abstract class AbstractConversationViewFragment extends Fragment implemen public static String buildBaseUri(Context context, Account account, Conversation conversation) { // Since the uri specified in the conversation base uri may not be unique, we specify a // base uri that us guaranteed to be unique for this conversation. - return "x-thread://" + account.getAccountId().hashCode() + "/" + conversation.id; + return "x-thread://" + account.getAccountId(context).hashCode() + "/" + conversation.id; } @Override diff --git a/src/com/android/mail/utils/NotificationUtils.java b/src/com/android/mail/utils/NotificationUtils.java index 8a37b8516..cd965188b 100644 --- a/src/com/android/mail/utils/NotificationUtils.java +++ b/src/com/android/mail/utils/NotificationUtils.java @@ -394,22 +394,20 @@ public class NotificationUtils { /** * Validate the notifications for the specified account. */ - public static void validateAccountNotifications(Context context, Account account) { - final String email = account.getEmailAddress(); - LogUtils.d(LOG_TAG, "validateAccountNotifications - %s", email); + public static void validateAccountNotifications(Context context, String account) { + LogUtils.d(LOG_TAG, "validateAccountNotifications - %s", account); List<NotificationKey> notificationsToCancel = Lists.newArrayList(); // Iterate through the notification map to see if there are any entries that correspond to // labels that are not in the sync set. final NotificationMap notificationMap = getNotificationMap(context); Set<NotificationKey> keys = notificationMap.keySet(); - final AccountPreferences accountPreferences = new AccountPreferences(context, - account.getAccountId()); + final AccountPreferences accountPreferences = new AccountPreferences(context, account); final boolean enabled = accountPreferences.areNotificationsEnabled(); if (!enabled) { // Cancel all notifications for this account for (NotificationKey notification : keys) { - if (notification.account.getAccountManagerAccount().name.equals(email)) { + if (notification.account.getAccountManagerAccount().name.equals(account)) { notificationsToCancel.add(notification); } } @@ -417,14 +415,14 @@ public class NotificationUtils { // Iterate through the notification map to see if there are any entries that // correspond to labels that are not in the notification set. for (NotificationKey notification : keys) { - if (notification.account.getAccountManagerAccount().name.equals(email)) { + if (notification.account.getAccountManagerAccount().name.equals(account)) { // If notification is not enabled for this label, remember this NotificationKey // to later cancel the notification, and remove the entry from the map final Folder folder = notification.folder; final boolean isInbox = folder.folderUri.equals( notification.account.settings.defaultInbox); final FolderPreferences folderPreferences = new FolderPreferences( - context, notification.account.getAccountId(), folder, isInbox); + context, notification.account.getEmailAddress(), folder, isInbox); if (!folderPreferences.areNotificationsEnabled()) { notificationsToCancel.add(notification); @@ -650,11 +648,11 @@ public class NotificationUtils { final boolean isInbox = folder.folderUri.equals(account.settings.defaultInbox); final FolderPreferences folderPreferences = - new FolderPreferences(context, account.getAccountId(), folder, isInbox); + new FolderPreferences(context, account.getEmailAddress(), folder, isInbox); if (isInbox) { final AccountPreferences accountPreferences = - new AccountPreferences(context, account.getAccountId()); + new AccountPreferences(context, account.getEmailAddress()); moveNotificationSetting(accountPreferences, folderPreferences); } @@ -742,7 +740,7 @@ public class NotificationUtils { */ if (getAttention && oldWhen == 0 && hasNewConversationNotification) { final AccountPreferences accountPreferences = - new AccountPreferences(context, account.getAccountId()); + new AccountPreferences(context, account.getEmailAddress()); if (accountPreferences.areNotificationsEnabled()) { if (vibrate) { defaults |= Notification.DEFAULT_VIBRATE; |