@Implements(value=android.accounts.AccountManager.class) public class ShadowAccountManager extends java.lang.Object
Constructor and Description |
---|
ShadowAccountManager() |
Modifier and Type | Method and Description |
---|---|
protected void |
__constructor__(android.content.Context context,
android.accounts.IAccountManager service) |
void |
addAccount(android.accounts.Account account) |
void |
addAccount(android.accounts.Account account,
java.lang.String... visibileToPackages)
Adds an account to the AccountManager but when
AccountManager.getAccountsByTypeForPackage(String, String) is called will be included if is in one of the #visibileToPackages |
protected android.accounts.AccountManagerFuture<android.os.Bundle> |
addAccount(java.lang.String accountType,
java.lang.String authTokenType,
java.lang.String[] requiredFeatures,
android.os.Bundle addAccountOptions,
android.app.Activity activity,
android.accounts.AccountManagerCallback<android.os.Bundle> callback,
android.os.Handler handler) |
protected boolean |
addAccountExplicitly(android.accounts.Account account,
java.lang.String password,
android.os.Bundle userdata) |
void |
addAuthenticator(android.accounts.AuthenticatorDescription authenticator) |
void |
addAuthenticator(java.lang.String type) |
protected void |
addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener listener,
android.os.Handler handler,
boolean updateImmediately) |
protected java.lang.String |
blockingGetAuthToken(android.accounts.Account account,
java.lang.String authTokenType,
boolean notifyAuthFailure) |
protected static android.accounts.AccountManager |
get(android.content.Context context)
Deprecated.
This method will be removed in Robolectric 3.4 Use
AccountManager.get(Context) instead. |
protected android.accounts.Account[] |
getAccounts() |
protected android.accounts.Account[] |
getAccountsByType(java.lang.String type) |
protected android.accounts.AccountManagerFuture<android.accounts.Account[]> |
getAccountsByTypeAndFeatures(java.lang.String type,
java.lang.String[] features,
android.accounts.AccountManagerCallback<android.accounts.Account[]> callback,
android.os.Handler handler) |
protected android.accounts.Account[] |
getAccountsByTypeForPackage(java.lang.String type,
java.lang.String packageName) |
protected android.accounts.AuthenticatorDescription[] |
getAuthenticatorTypes() |
protected android.accounts.AccountManagerFuture<android.os.Bundle> |
getAuthToken(android.accounts.Account account,
java.lang.String authTokenType,
android.os.Bundle options,
android.app.Activity activity,
android.accounts.AccountManagerCallback<android.os.Bundle> callback,
android.os.Handler handler) |
protected android.accounts.AccountManagerFuture<android.os.Bundle> |
getAuthToken(android.accounts.Account account,
java.lang.String authTokenType,
android.os.Bundle options,
boolean notifyAuthFailure,
android.accounts.AccountManagerCallback<android.os.Bundle> callback,
android.os.Handler handler) |
android.os.Bundle |
getNextAddAccountOptions()
Consumes and returns the next
addAccountOptions passed to addAccount(android.accounts.Account) . |
protected java.lang.String |
getPassword(android.accounts.Account account) |
protected java.lang.String |
getPreviousName(android.accounts.Account account) |
protected java.lang.String |
getUserData(android.accounts.Account account,
java.lang.String key) |
protected android.accounts.AccountManagerFuture<java.lang.Boolean> |
hasFeatures(android.accounts.Account account,
java.lang.String[] features,
android.accounts.AccountManagerCallback<java.lang.Boolean> callback,
android.os.Handler handler) |
protected void |
invalidateAuthToken(java.lang.String accountType,
java.lang.String authToken) |
protected java.lang.String |
peekAuthToken(android.accounts.Account account,
java.lang.String tokenType) |
android.os.Bundle |
peekNextAddAccountOptions()
Returns the next
addAccountOptions passed to addAccount(android.accounts.Account) without consuming it. |
protected android.accounts.AccountManagerFuture<java.lang.Boolean> |
removeAccount(android.accounts.Account account,
android.accounts.AccountManagerCallback<java.lang.Boolean> callback,
android.os.Handler handler)
The remove operation is posted to the given
handler , and will be executed according to the Scheduler.IdleState of the corresponding Scheduler . |
protected boolean |
removeAccountExplicitly(android.accounts.Account account) |
void |
removeAllAccounts()
Removes all accounts that have been added.
|
protected void |
removeOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener listener) |
void |
setAuthenticationErrorOnNextResponse(boolean authenticationErrorOnNextResponse)
Sets authenticator exception, which will be thrown by
getAccountsByTypeAndFeatures(java.lang.String, java.lang.String[], android.accounts.AccountManagerCallback<android.accounts.Account[]>, android.os.Handler) . |
protected void |
setAuthToken(android.accounts.Account account,
java.lang.String tokenType,
java.lang.String authToken) |
void |
setFeatures(android.accounts.Account account,
java.lang.String[] accountFeatures) |
protected void |
setPassword(android.accounts.Account account,
java.lang.String password) |
void |
setPreviousAccountName(android.accounts.Account account,
java.lang.String previousName)
Sets the previous name for an account, which will be returned by
AccountManager.getPreviousName(Account) . |
protected void |
setUserData(android.accounts.Account account,
java.lang.String key,
java.lang.String value) |
@Implementation protected void __constructor__(android.content.Context context, android.accounts.IAccountManager service)
@Deprecated @Implementation protected static android.accounts.AccountManager get(android.content.Context context)
AccountManager.get(Context)
instead.@Implementation protected android.accounts.Account[] getAccounts()
@Implementation protected android.accounts.Account[] getAccountsByType(java.lang.String type)
@Implementation protected void setAuthToken(android.accounts.Account account, java.lang.String tokenType, java.lang.String authToken)
@Implementation protected java.lang.String peekAuthToken(android.accounts.Account account, java.lang.String tokenType)
@Implementation protected boolean addAccountExplicitly(android.accounts.Account account, java.lang.String password, android.os.Bundle userdata)
@Implementation protected java.lang.String blockingGetAuthToken(android.accounts.Account account, java.lang.String authTokenType, boolean notifyAuthFailure)
@Implementation protected android.accounts.AccountManagerFuture<java.lang.Boolean> removeAccount(android.accounts.Account account, android.accounts.AccountManagerCallback<java.lang.Boolean> callback, android.os.Handler handler)
The remove operation is posted to the given handler
, and will be executed according to the Scheduler.IdleState
of the corresponding Scheduler
.
@Implementation(minSdk=22) protected boolean removeAccountExplicitly(android.accounts.Account account)
public void removeAllAccounts()
Removes all accounts that have been added.
@Implementation protected android.accounts.AuthenticatorDescription[] getAuthenticatorTypes()
@Implementation protected void addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener listener, android.os.Handler handler, boolean updateImmediately)
@Implementation protected void removeOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener listener)
@Implementation protected java.lang.String getUserData(android.accounts.Account account, java.lang.String key)
@Implementation protected void setUserData(android.accounts.Account account, java.lang.String key, java.lang.String value)
@Implementation protected void setPassword(android.accounts.Account account, java.lang.String password)
@Implementation protected java.lang.String getPassword(android.accounts.Account account)
@Implementation protected void invalidateAuthToken(java.lang.String accountType, java.lang.String authToken)
public void addAccount(android.accounts.Account account)
account
- User account.public void addAccount(android.accounts.Account account, java.lang.String... visibileToPackages)
Adds an account to the AccountManager but when AccountManager.getAccountsByTypeForPackage(String, String)
is called will be included if is in one of the #visibileToPackages
account
- User account.public android.os.Bundle getNextAddAccountOptions()
Consumes and returns the next addAccountOptions
passed to addAccount(android.accounts.Account)
.
addAccountOptions
public android.os.Bundle peekNextAddAccountOptions()
Returns the next addAccountOptions
passed to addAccount(android.accounts.Account)
without consuming it.
addAccountOptions
@Implementation protected android.accounts.AccountManagerFuture<android.os.Bundle> addAccount(java.lang.String accountType, java.lang.String authTokenType, java.lang.String[] requiredFeatures, android.os.Bundle addAccountOptions, android.app.Activity activity, android.accounts.AccountManagerCallback<android.os.Bundle> callback, android.os.Handler handler)
public void setFeatures(android.accounts.Account account, java.lang.String[] accountFeatures)
public void addAuthenticator(android.accounts.AuthenticatorDescription authenticator)
authenticator
- System authenticator.public void addAuthenticator(java.lang.String type)
public void setPreviousAccountName(android.accounts.Account account, java.lang.String previousName)
Sets the previous name for an account, which will be returned by AccountManager.getPreviousName(Account)
.
account
- User account.previousName
- Previous account name.@Implementation(minSdk=21) protected java.lang.String getPreviousName(android.accounts.Account account)
setPreviousAccountName(Account, String)
@Implementation protected android.accounts.AccountManagerFuture<android.os.Bundle> getAuthToken(android.accounts.Account account, java.lang.String authTokenType, android.os.Bundle options, android.app.Activity activity, android.accounts.AccountManagerCallback<android.os.Bundle> callback, android.os.Handler handler)
@Implementation protected android.accounts.AccountManagerFuture<android.os.Bundle> getAuthToken(android.accounts.Account account, java.lang.String authTokenType, android.os.Bundle options, boolean notifyAuthFailure, android.accounts.AccountManagerCallback<android.os.Bundle> callback, android.os.Handler handler)
@Implementation protected android.accounts.AccountManagerFuture<java.lang.Boolean> hasFeatures(android.accounts.Account account, java.lang.String[] features, android.accounts.AccountManagerCallback<java.lang.Boolean> callback, android.os.Handler handler)
@Implementation protected android.accounts.AccountManagerFuture<android.accounts.Account[]> getAccountsByTypeAndFeatures(java.lang.String type, java.lang.String[] features, android.accounts.AccountManagerCallback<android.accounts.Account[]> callback, android.os.Handler handler)
@Implementation(minSdk=18) protected android.accounts.Account[] getAccountsByTypeForPackage(java.lang.String type, java.lang.String packageName)
public void setAuthenticationErrorOnNextResponse(boolean authenticationErrorOnNextResponse)
Sets authenticator exception, which will be thrown by getAccountsByTypeAndFeatures(java.lang.String, java.lang.String[], android.accounts.AccountManagerCallback<android.accounts.Account[]>, android.os.Handler)
.
authenticationErrorOnNextResponse
- to set flag that exception will be thrown on next response.