Bug 1036459. r=nalexander

This commit is contained in:
Richard Newman 2014-07-09 13:41:58 -07:00
parent 45299e6afd
commit 4a20225495

View File

@ -16,7 +16,7 @@ public class FxAccountAuthenticatorService extends Service {
// Lazily initialized by <code>getAuthenticator</code>.
protected FxAccountAuthenticator accountAuthenticator = null;
protected FxAccountAuthenticator getAuthenticator() {
protected synchronized FxAccountAuthenticator getAuthenticator() {
if (accountAuthenticator == null) {
accountAuthenticator = new FxAccountAuthenticator(this);
}
@ -35,10 +35,21 @@ public class FxAccountAuthenticatorService extends Service {
public IBinder onBind(Intent intent) {
Logger.debug(LOG_TAG, "onBind");
if (intent.getAction().equals(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT)) {
return getAuthenticator().getIBinder();
if (intent == null) {
// Should never happen, but can -- Bug 1025937.
return null;
}
return null;
if (!android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT.equals(intent.getAction())) {
return null;
}
final FxAccountAuthenticator authenticator = getAuthenticator();
if (authenticator == null) {
// Should never happen.
return null;
}
return authenticator.getIBinder();
}
}