Do not hold locks when calling getAccounts

Not only it may cause a deadlock, calling authenticator while holding
the lock is also error-prone.

Test: manual
Bug: 36770176
Change-Id: I6871ea88643fc3c178214685c038b2238329e881
(cherry picked from commit 16bedd439775fdbf39ba9aec6a2815791b41e006)
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index 0ccaf8e..625e4a5 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -1597,17 +1597,11 @@
                 @Override
                 public void run() throws RemoteException {
                     // Confirm that the owner's account still exists before this step.
-                    UserAccounts owner = getUserAccounts(parentUserId);
-                    synchronized (owner.dbLock) {
-                        synchronized (owner.cacheLock) {
-                            for (Account acc : getAccounts(parentUserId,
-                                    mContext.getOpPackageName())) {
-                                if (acc.equals(account)) {
-                                    mAuthenticator.addAccountFromCredentials(
-                                            this, account, accountCredentials);
-                                    break;
-                                }
-                            }
+                    for (Account acc : getAccounts(parentUserId, mContext.getOpPackageName())) {
+                        if (acc.equals(account)) {
+                            mAuthenticator.addAccountFromCredentials(
+                                    this, account, accountCredentials);
+                            break;
                         }
                     }
                 }