Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 940299bd authored by Fyodor Kupolov's avatar Fyodor Kupolov Committed by gitbuildkicker
Browse files

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 16bedd43)
parent d16ecc9e
Loading
Loading
Loading
Loading
+5 −11
Original line number Diff line number Diff line
@@ -1597,11 +1597,7 @@ public class AccountManagerService
                @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())) {
                    for (Account acc : getAccounts(parentUserId, mContext.getOpPackageName())) {
                        if (acc.equals(account)) {
                            mAuthenticator.addAccountFromCredentials(
                                    this, account, accountCredentials);
@@ -1609,8 +1605,6 @@ public class AccountManagerService
                        }
                    }
                }
                    }
                }

                @Override
                public void onResult(Bundle result) {