public class AccountManagerService extends IAccountManager.Stub implements RegisteredServicesCacheListener<AuthenticatorDescription>
IAccountAuthenticator
services. This service is not accessed by users directly,
instead one uses an instance of AccountManager
, which can be accessed as follows:
AccountManager accountManager = AccountManager.get(context);Modifier and Type | Class and Description |
---|---|
static class |
AccountManagerService.Lifecycle |
Constructor and Description |
---|
AccountManagerService(Context context) |
AccountManagerService(Context context,
PackageManager packageManager,
IAccountAuthenticatorCache authenticatorCache) |
Modifier and Type | Method and Description |
---|---|
boolean |
accountAuthenticated(Account account) |
void |
addAccount(IAccountManagerResponse response,
String accountType,
String authTokenType,
String[] requiredFeatures,
boolean expectActivityLaunch,
Bundle optionsIn) |
void |
addAccountAsUser(IAccountManagerResponse response,
String accountType,
String authTokenType,
String[] requiredFeatures,
boolean expectActivityLaunch,
Bundle optionsIn,
int userId) |
boolean |
addAccountExplicitly(Account account,
String password,
Bundle extras) |
void |
addSharedAccountsFromParentUser(int parentUserId,
int userId) |
protected void |
cancelNotification(int id,
String packageName,
UserHandle user) |
protected void |
cancelNotification(int id,
UserHandle user) |
void |
clearPassword(Account account) |
void |
confirmCredentialsAsUser(IAccountManagerResponse response,
Account account,
Bundle options,
boolean expectActivityLaunch,
int userId) |
void |
copyAccountToUser(IAccountManagerResponse response,
Account account,
int userFrom,
int userTo) |
IntentSender |
createRequestAccountAccessIntentSenderAsUser(Account account,
String packageName,
UserHandle userHandle) |
protected void |
dump(FileDescriptor fd,
PrintWriter fout,
String[] args) |
void |
editProperties(IAccountManagerResponse response,
String accountType,
boolean expectActivityLaunch) |
void |
finishSessionAsUser(IAccountManagerResponse response,
Bundle sessionBundle,
boolean expectActivityLaunch,
Bundle appInfo,
int userId) |
Account[] |
getAccounts(int userId,
String opPackageName)
Returns the accounts visible to the client within the context of a specific user
|
Account[] |
getAccounts(String type,
String opPackageName) |
Account[] |
getAccountsAsUser(String type,
int userId,
String opPackageName) |
void |
getAccountsByFeatures(IAccountManagerResponse response,
String type,
String[] features,
String opPackageName) |
Account[] |
getAccountsByTypeForPackage(String type,
String packageName,
String opPackageName) |
Account[] |
getAccountsForPackage(String packageName,
int uid,
String opPackageName) |
protected Account[] |
getAccountsFromCacheLocked(com.android.server.accounts.AccountManagerService.UserAccounts userAccounts,
String accountType,
int callingUid,
String callingPackage) |
AccountAndUser[] |
getAllAccounts() |
AuthenticatorDescription[] |
getAuthenticatorTypes(int userId) |
void |
getAuthToken(IAccountManagerResponse response,
Account account,
String authTokenType,
boolean notifyOnAuthFailure,
boolean expectActivityLaunch,
Bundle loginOptions) |
void |
getAuthTokenLabel(IAccountManagerResponse response,
String accountType,
String authTokenType) |
String |
getPassword(Account account) |
String |
getPreviousName(Account account) |
AccountAndUser[] |
getRunningAccounts()
Returns accounts for all running users.
|
Account[] |
getSharedAccountsAsUser(int userId) |
static AccountManagerService |
getSingleton()
This should only be called by system code.
|
protected com.android.server.accounts.AccountManagerService.UserAccounts |
getUserAccounts(int userId) |
String |
getUserData(Account account,
String key) |
boolean |
hasAccountAccess(Account account,
String packageName,
UserHandle userHandle) |
void |
hasFeatures(IAccountManagerResponse response,
Account account,
String[] features,
String opPackageName) |
protected void |
installNotification(int notificationId,
Notification notification,
UserHandle user) |
void |
invalidateAuthToken(String accountType,
String authToken) |
void |
isCredentialsUpdateSuggested(IAccountManagerResponse response,
Account account,
String statusToken) |
void |
onAccountAccessed(String token) |
IBinder |
onBind(Intent intent) |
void |
onServiceChanged(AuthenticatorDescription desc,
int userId,
boolean removed)
Invoked when a service is registered or changed.
|
boolean |
onTransact(int code,
Parcel data,
Parcel reply,
int flags) |
String |
peekAuthToken(Account account,
String authTokenType) |
protected String |
readAuthTokenInternal(com.android.server.accounts.AccountManagerService.UserAccounts accounts,
Account account,
String authTokenType) |
protected HashMap<String,String> |
readAuthTokensForAccountFromDatabaseLocked(SQLiteDatabase db,
Account account) |
protected String |
readCachedTokenInternal(com.android.server.accounts.AccountManagerService.UserAccounts accounts,
Account account,
String tokenType,
String callingPackage,
byte[] pkgSigDigest) |
protected HashMap<String,String> |
readUserDataForAccountFromDatabaseLocked(SQLiteDatabase db,
Account account) |
protected String |
readUserDataInternalLocked(com.android.server.accounts.AccountManagerService.UserAccounts accounts,
Account account,
String key) |
void |
removeAccount(IAccountManagerResponse response,
Account account,
boolean expectActivityLaunch) |
void |
removeAccountAsUser(IAccountManagerResponse response,
Account account,
boolean expectActivityLaunch,
int userId) |
boolean |
removeAccountExplicitly(Account account) |
protected void |
removeAccountInternal(Account account) |
boolean |
removeSharedAccountAsUser(Account account,
int userId) |
void |
renameAccount(IAccountManagerResponse response,
Account accountToRename,
String newName) |
boolean |
renameSharedAccountAsUser(Account account,
String newName,
int userId) |
void |
setAuthToken(Account account,
String authTokenType,
String authToken) |
void |
setPassword(Account account,
String password) |
void |
setUserData(Account account,
String key,
String value) |
boolean |
someUserHasAccount(Account account) |
void |
startAddAccountSession(IAccountManagerResponse response,
String accountType,
String authTokenType,
String[] requiredFeatures,
boolean expectActivityLaunch,
Bundle optionsIn) |
void |
startUpdateCredentialsSession(IAccountManagerResponse response,
Account account,
String authTokenType,
boolean expectActivityLaunch,
Bundle loginOptions) |
void |
updateAppPermission(Account account,
String authTokenType,
int uid,
boolean value) |
void |
updateCredentials(IAccountManagerResponse response,
Account account,
String authTokenType,
boolean expectActivityLaunch,
Bundle loginOptions) |
void |
validateAccounts(int userId)
Validate internal set of accounts against installed authenticators for
given user.
|
protected void |
writeAuthTokenIntoCacheLocked(com.android.server.accounts.AccountManagerService.UserAccounts accounts,
SQLiteDatabase db,
Account account,
String key,
String value) |
protected void |
writeUserDataIntoCacheLocked(com.android.server.accounts.AccountManagerService.UserAccounts accounts,
SQLiteDatabase db,
Account account,
String key,
String value) |
public AccountManagerService(Context context)
public AccountManagerService(Context context, PackageManager packageManager, IAccountAuthenticatorCache authenticatorCache)
public static AccountManagerService getSingleton()
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException
RemoteException
public void validateAccounts(int userId)
protected com.android.server.accounts.AccountManagerService.UserAccounts getUserAccounts(int userId)
public void onServiceChanged(AuthenticatorDescription desc, int userId, boolean removed)
RegisteredServicesCacheListener
onServiceChanged
in interface RegisteredServicesCacheListener<AuthenticatorDescription>
desc
- the type of registered serviceremoved
- true if the service was removedpublic String getPassword(Account account)
public String getPreviousName(Account account)
public AuthenticatorDescription[] getAuthenticatorTypes(int userId)
public boolean addAccountExplicitly(Account account, String password, Bundle extras)
public void copyAccountToUser(IAccountManagerResponse response, Account account, int userFrom, int userTo)
public boolean accountAuthenticated(Account account)
public void hasFeatures(IAccountManagerResponse response, Account account, String[] features, String opPackageName)
public void renameAccount(IAccountManagerResponse response, Account accountToRename, String newName)
public void removeAccount(IAccountManagerResponse response, Account account, boolean expectActivityLaunch)
public void removeAccountAsUser(IAccountManagerResponse response, Account account, boolean expectActivityLaunch, int userId)
public boolean removeAccountExplicitly(Account account)
protected void removeAccountInternal(Account account)
public void setPassword(Account account, String password)
public void clearPassword(Account account)
public void getAuthTokenLabel(IAccountManagerResponse response, String accountType, String authTokenType) throws RemoteException
RemoteException
public void getAuthToken(IAccountManagerResponse response, Account account, String authTokenType, boolean notifyOnAuthFailure, boolean expectActivityLaunch, Bundle loginOptions)
public void addAccount(IAccountManagerResponse response, String accountType, String authTokenType, String[] requiredFeatures, boolean expectActivityLaunch, Bundle optionsIn)
public void addAccountAsUser(IAccountManagerResponse response, String accountType, String authTokenType, String[] requiredFeatures, boolean expectActivityLaunch, Bundle optionsIn, int userId)
public void startAddAccountSession(IAccountManagerResponse response, String accountType, String authTokenType, String[] requiredFeatures, boolean expectActivityLaunch, Bundle optionsIn)
public void finishSessionAsUser(IAccountManagerResponse response, Bundle sessionBundle, boolean expectActivityLaunch, Bundle appInfo, int userId)
public void confirmCredentialsAsUser(IAccountManagerResponse response, Account account, Bundle options, boolean expectActivityLaunch, int userId)
public void updateCredentials(IAccountManagerResponse response, Account account, String authTokenType, boolean expectActivityLaunch, Bundle loginOptions)
public void startUpdateCredentialsSession(IAccountManagerResponse response, Account account, String authTokenType, boolean expectActivityLaunch, Bundle loginOptions)
public void isCredentialsUpdateSuggested(IAccountManagerResponse response, Account account, String statusToken)
public void editProperties(IAccountManagerResponse response, String accountType, boolean expectActivityLaunch)
public boolean hasAccountAccess(Account account, String packageName, UserHandle userHandle)
public IntentSender createRequestAccountAccessIntentSenderAsUser(Account account, String packageName, UserHandle userHandle)
public boolean someUserHasAccount(Account account)
public Account[] getAccounts(int userId, String opPackageName)
public AccountAndUser[] getRunningAccounts()
public AccountAndUser[] getAllAccounts()
public void addSharedAccountsFromParentUser(int parentUserId, int userId)
public boolean renameSharedAccountAsUser(Account account, String newName, int userId)
public boolean removeSharedAccountAsUser(Account account, int userId)
public Account[] getSharedAccountsAsUser(int userId)
public Account[] getAccountsForPackage(String packageName, int uid, String opPackageName)
public Account[] getAccountsByTypeForPackage(String type, String packageName, String opPackageName)
public void getAccountsByFeatures(IAccountManagerResponse response, String type, String[] features, String opPackageName)
public void onAccountAccessed(String token) throws RemoteException
RemoteException
protected void dump(FileDescriptor fd, PrintWriter fout, String[] args)
protected void installNotification(int notificationId, Notification notification, UserHandle user)
protected void cancelNotification(int id, UserHandle user)
protected void cancelNotification(int id, String packageName, UserHandle user)
public void updateAppPermission(Account account, String authTokenType, int uid, boolean value) throws RemoteException
RemoteException
protected Account[] getAccountsFromCacheLocked(com.android.server.accounts.AccountManagerService.UserAccounts userAccounts, String accountType, int callingUid, String callingPackage)
protected void writeUserDataIntoCacheLocked(com.android.server.accounts.AccountManagerService.UserAccounts accounts, SQLiteDatabase db, Account account, String key, String value)
protected String readCachedTokenInternal(com.android.server.accounts.AccountManagerService.UserAccounts accounts, Account account, String tokenType, String callingPackage, byte[] pkgSigDigest)
protected void writeAuthTokenIntoCacheLocked(com.android.server.accounts.AccountManagerService.UserAccounts accounts, SQLiteDatabase db, Account account, String key, String value)
protected String readAuthTokenInternal(com.android.server.accounts.AccountManagerService.UserAccounts accounts, Account account, String authTokenType)
protected String readUserDataInternalLocked(com.android.server.accounts.AccountManagerService.UserAccounts accounts, Account account, String key)
protected HashMap<String,String> readUserDataForAccountFromDatabaseLocked(SQLiteDatabase db, Account account)
protected HashMap<String,String> readAuthTokensForAccountFromDatabaseLocked(SQLiteDatabase db, Account account)