Lines Matching defs:accounts

17 package android.accounts;
82 * accounts on the device. Some of these calls are implemented with the help of the corresponding
94 private static final String DATABASE_NAME = "accounts.db";
110 private static final String TABLE_ACCOUNTS = "accounts";
151 AUTHTOKENS_ACCOUNTS_ID + "=(select _id FROM accounts WHERE name=? AND type=?)";
156 EXTRAS_ACCOUNTS_ID + "=(select _id FROM accounts WHERE name=? AND type=?)";
261 UserAccounts accounts = mUsers.get(userId);
262 if (accounts == null) {
263 accounts = new UserAccounts(mContext, userId);
264 mUsers.append(userId, accounts);
265 purgeOldGrants(accounts);
266 validateAccountsInternal(accounts, true /* invalidateAuthenticatorCache */);
268 return accounts;
280 private void purgeOldGrants(UserAccounts accounts) {
281 synchronized (accounts.cacheLock) {
282 final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
305 * Validate internal set of accounts against installed authenticators for
309 final UserAccounts accounts = getUserAccounts(userId);
313 validateAccountsInternal(accounts, true /* invalidateAuthenticatorCache */);
317 * Validate internal set of accounts against installed authenticators for
321 UserAccounts accounts, boolean invalidateAuthenticatorCache) {
323 mAuthenticatorCache.invalidateCache(accounts.userId);
328 mAuthenticatorCache.getAllServices(accounts.userId)) {
332 synchronized (accounts.cacheLock) {
333 final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
339 accounts.accountCache.clear();
353 accounts.userDataCache.remove(account);
354 accounts.authTokenCache.remove(account);
374 accounts.accountCache.put(accountType, accountsForType);
379 sendAccountsChangedBroadcast(accounts.userId);
391 UserAccounts accounts = mUsers.get(userId);
392 if (accounts == null) {
393 accounts = initUser(userId);
394 mUsers.append(userId, accounts);
396 return accounts;
404 UserAccounts accounts;
406 accounts = mUsers.get(userId);
409 if (accounts == null) {
415 synchronized (accounts.cacheLock) {
416 accounts.openHelper.close();
437 UserAccounts accounts = getUserAccountsForCaller();
440 return readPasswordInternal(accounts, account);
446 private String readPasswordInternal(UserAccounts accounts, Account account) {
451 synchronized (accounts.cacheLock) {
452 final SQLiteDatabase db = accounts.openHelper.getReadableDatabase();
477 UserAccounts accounts = getUserAccountsForCaller();
480 return readUserDataInternal(accounts, account, key);
520 UserAccounts accounts = getUserAccountsForCaller();
524 return addAccountInternal(accounts, account, password, extras);
530 private boolean addAccountInternal(UserAccounts accounts, Account account, String password,
535 synchronized (accounts.cacheLock) {
536 final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
569 insertAccountIntoCacheLocked(accounts, account);
573 sendAccountsChangedBroadcast(accounts.userId);
599 UserAccounts accounts = getUserAccountsForCaller();
602 new TestFeaturesSession(accounts, response, account, features).bind();
612 public TestFeaturesSession(UserAccounts accounts, IAccountManagerResponse response,
614 super(accounts, response, account.type, false /* expectActivityLaunch */,
671 UserAccounts accounts = getUserAccountsForCaller();
674 cancelNotification(getSigninRequiredNotificationId(accounts, account), user);
675 synchronized(accounts.credentialsPermissionNotificationIds) {
677 accounts.credentialsPermissionNotificationIds.keySet()) {
679 int id = accounts.credentialsPermissionNotificationIds.get(pair);
686 new RemoveAccountSession(accounts, response, account).bind();
694 public RemoveAccountSession(UserAccounts accounts, IAccountManagerResponse response,
696 super(accounts, response, account.type, false /* expectActivityLaunch */,
741 private void removeAccountInternal(UserAccounts accounts, Account account) {
742 synchronized (accounts.cacheLock) {
743 final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
746 removeAccountFromCacheLocked(accounts, account);
747 sendAccountsChangedBroadcast(accounts.userId);
760 UserAccounts accounts = getUserAccountsForCaller();
763 synchronized (accounts.cacheLock) {
764 final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
767 invalidateAuthTokenLocked(accounts, db, accountType, authToken);
778 private void invalidateAuthTokenLocked(UserAccounts accounts, SQLiteDatabase db,
800 writeAuthTokenIntoCacheLocked(accounts, db, new Account(accountName, accountType),
808 private boolean saveAuthTokenToDatabase(UserAccounts accounts, Account account, String type,
813 cancelNotification(getSigninRequiredNotificationId(accounts, account),
814 new UserHandle(accounts.userId));
815 synchronized (accounts.cacheLock) {
816 final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
832 writeAuthTokenIntoCacheLocked(accounts, db, account, type, authToken);
852 UserAccounts accounts = getUserAccountsForCaller();
855 return readAuthTokenInternal(accounts, account, authTokenType);
871 UserAccounts accounts = getUserAccountsForCaller();
874 saveAuthTokenToDatabase(accounts, account, authTokenType, authToken);
888 UserAccounts accounts = getUserAccountsForCaller();
891 setPasswordInternal(accounts, account, password);
897 private void setPasswordInternal(UserAccounts accounts, Account account, String password) {
901 synchronized (accounts.cacheLock) {
902 final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
912 accounts.authTokenCache.remove(account);
918 sendAccountsChangedBroadcast(accounts.userId);
923 Log.i(TAG, "the accounts changed, sending broadcast of "
936 UserAccounts accounts = getUserAccountsForCaller();
939 setPasswordInternal(accounts, account, null);
955 UserAccounts accounts = getUserAccountsForCaller();
958 setUserdataInternal(accounts, account, key, value);
964 private void setUserdataInternal(UserAccounts accounts, Account account, String key,
969 synchronized (accounts.cacheLock) {
970 final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
991 writeUserDataIntoCacheLocked(accounts, db, account, key, value);
1029 UserAccounts accounts = getUserAccounts(UserHandle.getUserId(callingUid));
1032 new Session(accounts, response, accountType, false,
1077 final UserAccounts accounts = getUserAccountsForCaller();
1080 AuthenticatorDescription.newKey(account.type), accounts.userId);
1103 String authToken = readAuthTokenInternal(accounts, account, authTokenType);
1114 new Session(accounts, response, account.type, expectActivityLaunch,
1166 intent, accounts.userId);
1228 UserAccounts accounts = getUserAccounts(UserHandle.getUserId(uid));
1229 synchronized (accounts.credentialsPermissionNotificationIds) {
1233 id = accounts.credentialsPermissionNotificationIds.get(key);
1236 accounts.credentialsPermissionNotificationIds.put(key, id);
1242 private Integer getSigninRequiredNotificationId(UserAccounts accounts, Account account) {
1244 synchronized (accounts.signinRequiredNotificationIds) {
1245 id = accounts.signinRequiredNotificationIds.get(account);
1248 accounts.signinRequiredNotificationIds.put(account, id);
1270 UserAccounts accounts = getUserAccountsForCaller();
1279 new Session(accounts, response, accountType, expectActivityLaunch,
1304 // Only allow the system process to read accounts of other users
1321 UserAccounts accounts = getUserAccounts(userId);
1324 new Session(accounts, response, account.type, expectActivityLaunch,
1354 UserAccounts accounts = getUserAccountsForCaller();
1357 new Session(accounts, response, account.type, expectActivityLaunch,
1387 UserAccounts accounts = getUserAccountsForCaller();
1390 new Session(accounts, response, accountType, expectActivityLaunch,
1411 public GetAccountsByTypeAndFeatureSession(UserAccounts accounts,
1413 super(accounts, response, type, false /* expectActivityLaunch */,
1471 Account[] accounts = new Account[mAccountsWithFeatures.size()];
1472 for (int i = 0; i < accounts.length; i++) {
1473 accounts[i] = mAccountsWithFeatures.get(i);
1480 result.putParcelableArray(AccountManager.KEY_ACCOUNTS, accounts);
1499 * Returns the accounts for a specific user
1504 UserAccounts accounts = getUserAccounts(userId);
1507 synchronized (accounts.cacheLock) {
1508 return getAccountsFromCacheLocked(accounts, null);
1516 * Returns accounts for all running users.
1548 Account[] accounts = getAccountsFromCacheLocked(userAccounts, null);
1549 for (int a = 0; a < accounts.length; a++) {
1550 runningAccounts.add(new AccountAndUser(accounts[a], userId));
1562 // Only allow the system process to read accounts of other users
1575 UserAccounts accounts = getUserAccounts(userId);
1578 synchronized (accounts.cacheLock) {
1579 return getAccountsFromCacheLocked(accounts, type);
1607 Account[] accounts;
1609 accounts = getAccountsFromCacheLocked(userAccounts, type);
1612 result.putParcelableArray(AccountManager.KEY_ACCOUNTS, accounts);
1666 public Session(UserAccounts accounts, IAccountManagerResponse response, String accountType,
1671 mAccounts = accounts;
2109 Account[] accounts = getAccountsFromCacheLocked(userAccounts, null /* type */);
2110 fout.println("Accounts: " + accounts.length);
2111 for (Account account : accounts) {
2130 private void doNotification(UserAccounts accounts, Account account, CharSequence message,
2143 final Integer notificationId = getSigninRequiredNotificationId(accounts, account);
2255 UserAccounts accounts = getUserAccountsForCaller();
2256 synchronized (accounts.cacheLock) {
2257 final SQLiteDatabase db = accounts.openHelper.getReadableDatabase();
2331 UserAccounts accounts = getUserAccounts(UserHandle.getUserId(uid));
2332 synchronized (accounts.cacheLock) {
2333 final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
2349 new UserHandle(accounts.userId));
2366 UserAccounts accounts = getUserAccounts(UserHandle.getUserId(uid));
2367 synchronized (accounts.cacheLock) {
2368 final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
2384 new UserHandle(accounts.userId));
2392 private void removeAccountFromCacheLocked(UserAccounts accounts, Account account) {
2393 final Account[] oldAccountsForType = accounts.accountCache.get(account.type);
2402 accounts.accountCache.remove(account.type);
2406 accounts.accountCache.put(account.type, newAccountsForType);
2409 accounts.userDataCache.remove(account);
2410 accounts.authTokenCache.remove(account);
2416 private void insertAccountIntoCacheLocked(UserAccounts accounts, Account account) {
2417 Account[] accountsForType = accounts.accountCache.get(account.type);
2424 accounts.accountCache.put(account.type, newAccountsForType);
2429 final Account[] accounts = userAccounts.accountCache.get(accountType);
2430 if (accounts == null) {
2433 return Arrays.copyOf(accounts, accounts.length);
2437 for (Account[] accounts : userAccounts.accountCache.values()) {
2438 totalLength += accounts.length;
2443 Account[] accounts = new Account[totalLength];
2446 System.arraycopy(accountsOfType, 0, accounts, totalLength,
2450 return accounts;
2454 protected void writeUserDataIntoCacheLocked(UserAccounts accounts, final SQLiteDatabase db,
2456 HashMap<String, String> userDataForAccount = accounts.userDataCache.get(account);
2459 accounts.userDataCache.put(account, userDataForAccount);
2468 protected void writeAuthTokenIntoCacheLocked(UserAccounts accounts, final SQLiteDatabase db,
2470 HashMap<String, String> authTokensForAccount = accounts.authTokenCache.get(account);
2473 accounts.authTokenCache.put(account, authTokensForAccount);
2482 protected String readAuthTokenInternal(UserAccounts accounts, Account account,
2484 synchronized (accounts.cacheLock) {
2485 HashMap<String, String> authTokensForAccount = accounts.authTokenCache.get(account);
2488 final SQLiteDatabase db = accounts.openHelper.getReadableDatabase();
2490 accounts.authTokenCache.put(account, authTokensForAccount);
2496 protected String readUserDataInternal(UserAccounts accounts, Account account, String key) {
2497 synchronized (accounts.cacheLock) {
2498 HashMap<String, String> userDataForAccount = accounts.userDataCache.get(account);
2501 final SQLiteDatabase db = accounts.openHelper.getReadableDatabase();
2503 accounts.userDataCache.put(account, userDataForAccount);