Skip to content

Commit 90f658e

Browse files
Amith YamasaniAndroid (Google) Code Review
authored andcommitted
Merge "Preserve account list in order of creation in the database." into jb-dev
2 parents 943a8be + b483a99 commit 90f658e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/java/android/accounts/AccountManagerService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ static class UserAccounts {
163163
new HashMap<Account, Integer>();
164164
private final Object cacheLock = new Object();
165165
/** protected by the {@link #cacheLock} */
166-
private final HashMap<String, Account[]> accountCache = new HashMap<String, Account[]>();
166+
private final HashMap<String, Account[]> accountCache =
167+
new LinkedHashMap<String, Account[]>();
167168
/** protected by the {@link #cacheLock} */
168169
private HashMap<Account, HashMap<String, String>> userDataCache =
169170
new HashMap<Account, HashMap<String, String>>();
@@ -296,7 +297,7 @@ private void validateAccountsAndPopulateCache(UserAccounts accounts) {
296297
try {
297298
accounts.accountCache.clear();
298299
final HashMap<String, ArrayList<String>> accountNamesByType =
299-
new HashMap<String, ArrayList<String>>();
300+
new LinkedHashMap<String, ArrayList<String>>();
300301
while (cursor.moveToNext()) {
301302
final long accountId = cursor.getLong(0);
302303
final String accountType = cursor.getString(1);

0 commit comments

Comments
 (0)