Loading services/core/java/com/android/server/accounts/AccountManagerService.java +54 −36 Original line number Diff line number Diff line Loading @@ -660,7 +660,12 @@ public class AccountManagerService long identityToken = clearCallingIdentity(); try { UserAccounts accounts = getUserAccounts(userId); return readUserDataInternal(accounts, account, key); synchronized (accounts.cacheLock) { if (!accountExistsCacheLocked(accounts, account)) { return null; } return readUserDataInternalLocked(accounts, account, key); } } finally { restoreCallingIdentity(identityToken); } Loading Loading @@ -1716,18 +1721,33 @@ public class AccountManagerService long identityToken = clearCallingIdentity(); try { UserAccounts accounts = getUserAccounts(userId); setUserdataInternal(accounts, account, key, value); synchronized (accounts.cacheLock) { if (!accountExistsCacheLocked(accounts, account)) { return; } setUserdataInternalLocked(accounts, account, key, value); } } finally { restoreCallingIdentity(identityToken); } } private void setUserdataInternal(UserAccounts accounts, Account account, String key, private boolean accountExistsCacheLocked(UserAccounts accounts, Account account) { if (accounts.accountCache.containsKey(account.type)) { for (Account acc : getUserAccountsForCaller().accountCache.get(account.type)) { if (acc.name.equals(account.name)) { return true; } } } return false; } private void setUserdataInternalLocked(UserAccounts accounts, Account account, String key, String value) { if (account == null || key == null) { return; } synchronized (accounts.cacheLock) { final SQLiteDatabase db = accounts.openHelper.getWritableDatabase(); db.beginTransaction(); try { Loading Loading @@ -1755,7 +1775,6 @@ public class AccountManagerService db.endTransaction(); } } } private void onResult(IAccountManagerResponse response, Bundle result) { if (result == null) { Loading Loading @@ -4788,8 +4807,8 @@ public class AccountManagerService } } protected String readUserDataInternal(UserAccounts accounts, Account account, String key) { synchronized (accounts.cacheLock) { protected String readUserDataInternalLocked( UserAccounts accounts, Account account, String key) { HashMap<String, String> userDataForAccount = accounts.userDataCache.get(account); if (userDataForAccount == null) { // need to populate the cache for this account Loading @@ -4799,7 +4818,6 @@ public class AccountManagerService } return userDataForAccount.get(key); } } protected HashMap<String, String> readUserDataForAccountFromDatabaseLocked( final SQLiteDatabase db, Account account) { Loading Loading
services/core/java/com/android/server/accounts/AccountManagerService.java +54 −36 Original line number Diff line number Diff line Loading @@ -660,7 +660,12 @@ public class AccountManagerService long identityToken = clearCallingIdentity(); try { UserAccounts accounts = getUserAccounts(userId); return readUserDataInternal(accounts, account, key); synchronized (accounts.cacheLock) { if (!accountExistsCacheLocked(accounts, account)) { return null; } return readUserDataInternalLocked(accounts, account, key); } } finally { restoreCallingIdentity(identityToken); } Loading Loading @@ -1716,18 +1721,33 @@ public class AccountManagerService long identityToken = clearCallingIdentity(); try { UserAccounts accounts = getUserAccounts(userId); setUserdataInternal(accounts, account, key, value); synchronized (accounts.cacheLock) { if (!accountExistsCacheLocked(accounts, account)) { return; } setUserdataInternalLocked(accounts, account, key, value); } } finally { restoreCallingIdentity(identityToken); } } private void setUserdataInternal(UserAccounts accounts, Account account, String key, private boolean accountExistsCacheLocked(UserAccounts accounts, Account account) { if (accounts.accountCache.containsKey(account.type)) { for (Account acc : getUserAccountsForCaller().accountCache.get(account.type)) { if (acc.name.equals(account.name)) { return true; } } } return false; } private void setUserdataInternalLocked(UserAccounts accounts, Account account, String key, String value) { if (account == null || key == null) { return; } synchronized (accounts.cacheLock) { final SQLiteDatabase db = accounts.openHelper.getWritableDatabase(); db.beginTransaction(); try { Loading Loading @@ -1755,7 +1775,6 @@ public class AccountManagerService db.endTransaction(); } } } private void onResult(IAccountManagerResponse response, Bundle result) { if (result == null) { Loading Loading @@ -4788,8 +4807,8 @@ public class AccountManagerService } } protected String readUserDataInternal(UserAccounts accounts, Account account, String key) { synchronized (accounts.cacheLock) { protected String readUserDataInternalLocked( UserAccounts accounts, Account account, String key) { HashMap<String, String> userDataForAccount = accounts.userDataCache.get(account); if (userDataForAccount == null) { // need to populate the cache for this account Loading @@ -4799,7 +4818,6 @@ public class AccountManagerService } return userDataForAccount.get(key); } } protected HashMap<String, String> readUserDataForAccountFromDatabaseLocked( final SQLiteDatabase db, Account account) { Loading