From b483a99c6bdfee72fbb8fbcf893e63ef3f54658b Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Tue, 22 May 2012 13:14:25 -0700 Subject: Preserve account list in order of creation in the database. This makes it possible to retrieve the account list in the order of creation, if we want to display them in the account settings screen in that order. Bug: 6579937 Change-Id: I2025aaa8b770fbb78be978dfde64ef95823fd5aa --- core/java/android/accounts/AccountManagerService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core/java/android/accounts/AccountManagerService.java') diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java index 2b643c2..306159dd 100644 --- a/core/java/android/accounts/AccountManagerService.java +++ b/core/java/android/accounts/AccountManagerService.java @@ -163,7 +163,8 @@ public class AccountManagerService new HashMap(); private final Object cacheLock = new Object(); /** protected by the {@link #cacheLock} */ - private final HashMap accountCache = new HashMap(); + private final HashMap accountCache = + new LinkedHashMap(); /** protected by the {@link #cacheLock} */ private HashMap> userDataCache = new HashMap>(); @@ -296,7 +297,7 @@ public class AccountManagerService try { accounts.accountCache.clear(); final HashMap> accountNamesByType = - new HashMap>(); + new LinkedHashMap>(); while (cursor.moveToNext()) { final long accountId = cursor.getLong(0); final String accountType = cursor.getString(1); -- cgit v1.1