* The following descriptions of each of the abstract authenticator methods will not describe the @@ -111,44 +114,35 @@ public abstract class AbstractAccountAuthenticator { String authTokenType, String[] requiredFeatures, Bundle options) throws RemoteException { checkBinderPermission(); - final Bundle result; try { - result = AbstractAccountAuthenticator.this.addAccount( + final Bundle result = AbstractAccountAuthenticator.this.addAccount( new AccountAuthenticatorResponse(response), accountType, authTokenType, requiredFeatures, options); + if (result != null) { + response.onResult(result); + } } catch (NetworkErrorException e) { response.onError(AccountManager.ERROR_CODE_NETWORK_ERROR, e.getMessage()); - return; } catch (UnsupportedOperationException e) { response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION, "addAccount not supported"); - return; - } - if (result != null) { - response.onResult(result); - } else { - response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE, - "no response from the authenticator"); } } public void confirmCredentials(IAccountAuthenticatorResponse response, Account account, Bundle options) throws RemoteException { checkBinderPermission(); - final Bundle result; try { - result = AbstractAccountAuthenticator.this.confirmCredentials( + final Bundle result = AbstractAccountAuthenticator.this.confirmCredentials( new AccountAuthenticatorResponse(response), account, options); + if (result != null) { + response.onResult(result); + } + } catch (NetworkErrorException e) { + response.onError(AccountManager.ERROR_CODE_NETWORK_ERROR, e.getMessage()); } catch (UnsupportedOperationException e) { response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION, "confirmCredentials not supported"); - return; - } - if (result != null) { - response.onResult(result); - } else { - response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE, - "no response from the authenticator"); } } @@ -180,9 +174,6 @@ public abstract class AbstractAccountAuthenticator { authTokenType, loginOptions); if (result != null) { response.onResult(result); - } else { - response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE, - "no response from the authenticator"); } } catch (UnsupportedOperationException e) { response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION, @@ -195,64 +186,50 @@ public abstract class AbstractAccountAuthenticator { public void updateCredentials(IAccountAuthenticatorResponse response, Account account, String authTokenType, Bundle loginOptions) throws RemoteException { checkBinderPermission(); - final Bundle result; try { - result = AbstractAccountAuthenticator.this.updateCredentials( + final Bundle result = AbstractAccountAuthenticator.this.updateCredentials( new AccountAuthenticatorResponse(response), account, authTokenType, loginOptions); + if (result != null) { + response.onResult(result); + } + } catch (NetworkErrorException e) { + response.onError(AccountManager.ERROR_CODE_NETWORK_ERROR, e.getMessage()); } catch (UnsupportedOperationException e) { response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION, "updateCredentials not supported"); - return; - } - if (result != null) { - response.onResult(result); - } else { - response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE, - "no response from the authenticator"); } } public void editProperties(IAccountAuthenticatorResponse response, String accountType) throws RemoteException { checkBinderPermission(); - final Bundle result; try { - result = AbstractAccountAuthenticator.this.editProperties( + final Bundle result = AbstractAccountAuthenticator.this.editProperties( new AccountAuthenticatorResponse(response), accountType); + if (result != null) { + response.onResult(result); + } } catch (UnsupportedOperationException e) { response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION, "editProperties not supported"); - return; - } - if (result != null) { - response.onResult(result); - } else { - response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE, - "no response from the authenticator"); } } public void hasFeatures(IAccountAuthenticatorResponse response, Account account, String[] features) throws RemoteException { checkBinderPermission(); - final Bundle result; try { - result = AbstractAccountAuthenticator.this.hasFeatures( + final Bundle result = AbstractAccountAuthenticator.this.hasFeatures( new AccountAuthenticatorResponse(response), account, features); + if (result != null) { + response.onResult(result); + } } catch (UnsupportedOperationException e) { response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION, "hasFeatures not supported"); - return; } catch (NetworkErrorException e) { response.onError(AccountManager.ERROR_CODE_NETWORK_ERROR, e.getMessage()); - return; - } - if (result != null) { - response.onResult(result); - } else { - response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE, - "no response from the authenticator"); } } @@ -264,9 +241,6 @@ public abstract class AbstractAccountAuthenticator { new AccountAuthenticatorResponse(response), account); if (result != null) { response.onResult(result); - } else { - response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE, - "no response from the authenticator"); } } catch (UnsupportedOperationException e) { response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION, @@ -347,16 +321,18 @@ public abstract class AbstractAccountAuthenticator { *