Merge "Toast: Fix the concurrency problem of mAuthenticator" am: a8438682f7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2276161 Change-Id: Ieeeb0477c1c423b0443f8d8e934e21d886de16aa Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -4794,6 +4794,7 @@ public class AccountManagerService
|
||||
|
||||
private abstract class Session extends IAccountAuthenticatorResponse.Stub
|
||||
implements IBinder.DeathRecipient, ServiceConnection {
|
||||
private final Object mSessionLock = new Object();
|
||||
IAccountManagerResponse mResponse;
|
||||
final String mAccountType;
|
||||
final boolean mExpectActivityLaunch;
|
||||
@@ -4959,9 +4960,11 @@ public class AccountManagerService
|
||||
}
|
||||
|
||||
private void unbind() {
|
||||
if (mAuthenticator != null) {
|
||||
mAuthenticator = null;
|
||||
mContext.unbindService(this);
|
||||
synchronized (mSessionLock) {
|
||||
if (mAuthenticator != null) {
|
||||
mAuthenticator = null;
|
||||
mContext.unbindService(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4971,12 +4974,14 @@ public class AccountManagerService
|
||||
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
mAuthenticator = IAccountAuthenticator.Stub.asInterface(service);
|
||||
try {
|
||||
run();
|
||||
} catch (RemoteException e) {
|
||||
onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION,
|
||||
"remote exception");
|
||||
synchronized (mSessionLock) {
|
||||
mAuthenticator = IAccountAuthenticator.Stub.asInterface(service);
|
||||
try {
|
||||
run();
|
||||
} catch (RemoteException e) {
|
||||
onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION,
|
||||
"remote exception");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user