summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2014-09-18 12:09:12 +0000
committerGerrit Code Review <gerrit@cyanogenmod.org>2014-09-18 12:09:12 +0000
commit9a9e9b0bb731c845a2872ec80c3e28c6311ce900 (patch)
tree53abf38338f276525162cc797c2cd4e7f782fa92
parent480979076394b08fc7bd0e7e458e1b81405d353a (diff)
parent07c9e709919d7c664625ce281e9e0de5dbcf09a1 (diff)
downloadpackages_apps_ContactsCommon-9a9e9b0bb731c845a2872ec80c3e28c6311ce900.tar.gz
packages_apps_ContactsCommon-9a9e9b0bb731c845a2872ec80c3e28c6311ce900.tar.bz2
packages_apps_ContactsCommon-9a9e9b0bb731c845a2872ec80c3e28c6311ce900.zip
Merge "Make sure internal lists of AccountTypeManager aren't modified." into cm-11.0
-rw-r--r--src/com/android/contacts/common/model/AccountTypeManager.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/com/android/contacts/common/model/AccountTypeManager.java b/src/com/android/contacts/common/model/AccountTypeManager.java
index 4765349f..955242c3 100644
--- a/src/com/android/contacts/common/model/AccountTypeManager.java
+++ b/src/com/android/contacts/common/model/AccountTypeManager.java
@@ -66,6 +66,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@@ -434,10 +435,10 @@ class AccountTypeManagerImpl extends AccountTypeManager
accountType = new GoogleAccountType(mContext, auth.packageName);
} else if (ExchangeAccountType.isExchangeType(type)) {
accountType = new ExchangeAccountType(mContext, auth.packageName, type);
- } else if (SimAccountType.ACCOUNT_TYPE.equals(type)) {
- accountType = new SimAccountType(mContext, auth.packageName);
- } else if (PhoneAccountType.ACCOUNT_TYPE.equals(type)) {
- accountType = new PhoneAccountType(mContext, auth.packageName);
+ } else if (SimAccountType.ACCOUNT_TYPE.equals(type)) {
+ accountType = new SimAccountType(mContext, auth.packageName);
+ } else if (PhoneAccountType.ACCOUNT_TYPE.equals(type)) {
+ accountType = new PhoneAccountType(mContext, auth.packageName);
} else {
// TODO: use syncadapter package instead, since it provides resources
Log.d(TAG, "Registering external account type=" + type
@@ -602,9 +603,8 @@ class AccountTypeManagerImpl extends AccountTypeManager
if (isAirMode) {
return trimAccountByType(contactWritableOnly ? mContactWritableAccounts : mAccounts,
SimAccountType.ACCOUNT_TYPE);
- } else {
- return contactWritableOnly ? mContactWritableAccounts : mAccounts;
}
+ break;
case FLAG_ALL_ACCOUNTS_WITHOUT_LOCAL:
return trimAccountByType(
contactWritableOnly ? mContactWritableAccounts : mAccounts,
@@ -614,7 +614,8 @@ class AccountTypeManagerImpl extends AccountTypeManager
contactWritableOnly ? mContactWritableAccounts : mAccounts,
SimAccountType.ACCOUNT_TYPE);
}
- return contactWritableOnly ? mContactWritableAccounts : mAccounts;
+ List<AccountWithDataSet> list = contactWritableOnly ? mContactWritableAccounts : mAccounts;
+ return new ArrayList<AccountWithDataSet>(list);
}
private boolean isSimStateUnknown(Account account) {