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

Commit 166e569b authored by zhuning3's avatar zhuning3 Committed by ning zhu
Browse files

Fix the concurrency issue when 'linkToDeath' in AccountManagerService that leads to JE



Move the ref of 'mResponse' after the completion of 'linkToDeath' to avoid concurrency issues caused by 'unlinkToDeath' being triggered in different thread

Test: MTBF
Bug: 291856266

Change-Id: Ifc5af9f85aac83be56afec9a1fb32501a6f32ebc
Signed-off-by: default avatarzhuning3 <zhuning3@xiaomi.corp-partner.google.com>
parent 14b1b592
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -4854,7 +4854,6 @@ public class AccountManagerService
            if (accountType == null) throw new IllegalArgumentException("accountType is null");
            if (accountType == null) throw new IllegalArgumentException("accountType is null");
            mAccounts = accounts;
            mAccounts = accounts;
            mStripAuthTokenFromResult = stripAuthTokenFromResult;
            mStripAuthTokenFromResult = stripAuthTokenFromResult;
            mResponse = response;
            mAccountType = accountType;
            mAccountType = accountType;
            mExpectActivityLaunch = expectActivityLaunch;
            mExpectActivityLaunch = expectActivityLaunch;
            mCreationTime = SystemClock.elapsedRealtime();
            mCreationTime = SystemClock.elapsedRealtime();
@@ -4868,8 +4867,8 @@ public class AccountManagerService
            if (response != null) {
            if (response != null) {
                try {
                try {
                    response.asBinder().linkToDeath(this, 0 /* flags */);
                    response.asBinder().linkToDeath(this, 0 /* flags */);
                    mResponse = response;
                } catch (RemoteException e) {
                } catch (RemoteException e) {
                    mResponse = null;
                    binderDied();
                    binderDied();
                }
                }
            }
            }