Merge "Toast: Fix the concurrency problem of mAuthenticator"
This commit is contained in:
@@ -4794,6 +4794,7 @@ public class AccountManagerService
|
|||||||
|
|
||||||
private abstract class Session extends IAccountAuthenticatorResponse.Stub
|
private abstract class Session extends IAccountAuthenticatorResponse.Stub
|
||||||
implements IBinder.DeathRecipient, ServiceConnection {
|
implements IBinder.DeathRecipient, ServiceConnection {
|
||||||
|
private final Object mSessionLock = new Object();
|
||||||
IAccountManagerResponse mResponse;
|
IAccountManagerResponse mResponse;
|
||||||
final String mAccountType;
|
final String mAccountType;
|
||||||
final boolean mExpectActivityLaunch;
|
final boolean mExpectActivityLaunch;
|
||||||
@@ -4959,11 +4960,13 @@ public class AccountManagerService
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void unbind() {
|
private void unbind() {
|
||||||
|
synchronized (mSessionLock) {
|
||||||
if (mAuthenticator != null) {
|
if (mAuthenticator != null) {
|
||||||
mAuthenticator = null;
|
mAuthenticator = null;
|
||||||
mContext.unbindService(this);
|
mContext.unbindService(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void cancelTimeout() {
|
public void cancelTimeout() {
|
||||||
mHandler.removeMessages(MESSAGE_TIMED_OUT, this);
|
mHandler.removeMessages(MESSAGE_TIMED_OUT, this);
|
||||||
@@ -4971,6 +4974,7 @@ public class AccountManagerService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||||
|
synchronized (mSessionLock) {
|
||||||
mAuthenticator = IAccountAuthenticator.Stub.asInterface(service);
|
mAuthenticator = IAccountAuthenticator.Stub.asInterface(service);
|
||||||
try {
|
try {
|
||||||
run();
|
run();
|
||||||
@@ -4979,6 +4983,7 @@ public class AccountManagerService
|
|||||||
"remote exception");
|
"remote exception");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onServiceDisconnected(ComponentName name) {
|
public void onServiceDisconnected(ComponentName name) {
|
||||||
|
|||||||
Reference in New Issue
Block a user