Use UserAccounts handed into accountExistsCacheLocked
Use the object we get handed rather than obtaining the one for the
calling user. We're previously clearing the caller, so the calling user
might not be the same as the one we used to obtain accounts object.
Bug: 27285299
Change-Id: Ie384bca83779593f6569bccea3c2851083ace31d
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index 163b9be..37f2425 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -1734,7 +1734,7 @@
private boolean accountExistsCacheLocked(UserAccounts accounts, Account account) {
if (accounts.accountCache.containsKey(account.type)) {
- for (Account acc : getUserAccountsForCaller().accountCache.get(account.type)) {
+ for (Account acc : accounts.accountCache.get(account.type)) {
if (acc.name.equals(account.name)) {
return true;
}