Home | History | Annotate | Download | only in cts

Lines Matching refs:ACCOUNT

19 import android.accounts.Account;
62 public static final String ACCOUNT_NAME = "android.accounts.cts.account.name";
63 public static final String ACCOUNT_NEW_NAME = "android.accounts.cts.account.name.rename";
64 public static final String ACCOUNT_NAME_OTHER = "android.accounts.cts.account.name.other";
66 public static final String ACCOUNT_TYPE = "android.accounts.cts.account.type";
67 public static final String ACCOUNT_TYPE_CUSTOM = "android.accounts.cts.custom.account.type";
68 public static final String ACCOUNT_TYPE_ABSENT = "android.accounts.cts.account.type.absent";
70 public static final String ACCOUNT_PASSWORD = "android.accounts.cts.account.password";
72 public static final String ACCOUNT_STATUS_TOKEN = "android.accounts.cts.account.status.token";
100 public static final Account ACCOUNT = new Account(ACCOUNT_NAME, ACCOUNT_TYPE);
101 public static final Account ACCOUNT_FOR_NEW_REMOVE_ACCOUNT_API = new Account(
103 public static final Account ACCOUNT_FOR_DEFAULT_IMPL = new Account(
105 public static final Account ACCOUNT_SAME_TYPE = new Account(ACCOUNT_NAME_OTHER, ACCOUNT_TYPE);
107 public static final Account CUSTOM_TOKEN_ACCOUNT =
108 new Account(ACCOUNT_NAME,ACCOUNT_TYPE_CUSTOM);
118 public static final String ERROR_MESSAGE = "android.accounts.cts.account.error.message";
164 // Need to clean up created account
165 assertTrue(removeAccount(am, ACCOUNT, mActivity, null /* callback */).getBoolean(
171 Account[] ctsAccounts = am.getAccountsByType(ACCOUNT_TYPE);
172 Account[] ctsCustomAccounts = am.getAccountsByType(ACCOUNT_TYPE_CUSTOM);
173 ArrayList<Account> accounts = new ArrayList<>(Arrays.asList(ctsAccounts));
175 for (Account ctsAccount : accounts) {
188 public Account getAccount();
193 Account account = fetcher.getAccount();
195 expected.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
196 expected.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type);
211 ACCOUNT_TYPE.equals(account.type) || AUTH_EXPIRING_TOKEN_TYPE.equals(tokenType);
227 isCachingExpected = ACCOUNT_TYPE.equals(account.type);
233 am.invalidateAuthToken(account.type, token);
245 ACCOUNT.name,
248 ACCOUNT.type,
306 assertEquals(ACCOUNT, mockAuthenticator.getAccount());
310 Account[] accounts = am.getAccounts();
336 private Account renameAccount(AccountManager am, Account account, String newName)
338 AccountManagerFuture<Account> futureAccount = am.renameAccount(
339 account, newName, null /* callback */, null /* handler */);
340 Account renamedAccount = futureAccount.getResult();
346 private boolean removeAccount(AccountManager am, Account account,
349 AccountManagerFuture<Boolean> futureBoolean = am.removeAccount(account,
358 private Bundle removeAccountWithIntentLaunch(AccountManager am, Account account,
362 AccountManagerFuture<Bundle> futureBundle = am.removeAccount(account,
372 private Bundle removeAccount(AccountManager am, Account account, Activity activity,
376 AccountManagerFuture<Bundle> futureBundle = am.removeAccount(account,
386 private boolean removeAccountExplicitly(AccountManager am, Account account) {
387 return am.removeAccountExplicitly(account);
390 private void addAccountExplicitly(Account account
391 assertTrue(am.addAccountExplicitly(account, password, userdata));
415 private boolean isAccountPresent(Account[] accounts, Account accountToCheck) {
496 * Test addAccount() with no associated account authenticator
578 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
580 // Assert that we have one more account
581 Account[] accounts = am.getAccounts();
584 assertTrue(isAccountPresent(am.getAccounts(), ACCOUNT));
586 assertTrue(removeAccount(am, ACCOUNT, mActivity, null /* callback */).getBoolean(
606 // Assert that we have one more account
607 Account[] accounts = am.getAccounts();
617 // Check removal of account
638 // Assert that we have one more account
639 Account[] accounts = am.getAccounts();
643 // Check removal of account
661 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
663 // Assert that we have one more account
664 Account[] accounts = am.getAccounts();
667 assertTrue(isAccountPresent(am.getAccounts(), ACCOUNT));
669 assertTrue(removeAccount(am, ACCOUNT, null /* callback */));
684 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
686 // Assert that we have one more account
687 Account[] accounts = am.getAccounts();
690 assertTrue(isAccountPresent(am.getAccounts(), ACCOUNT));
692 assertTrue(removeAccountExplicitly(am, ACCOUNT));
701 * Test updates to account visibility.
706 am.addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
708 am.setAccountVisibility(ACCOUNT, PACKAGE_NAME_1, AccountManager.VISIBILITY_VISIBLE);
709 assertEquals(am.getAccountVisibility(ACCOUNT, PACKAGE_NAME_1),
712 am.setAccountVisibility(ACCOUNT, PACKAGE_NAME_1, AccountManager.VISIBILITY_NOT_VISIBLE);
713 assertEquals(am.getAccountVisibility(ACCOUNT, PACKAGE_NAME_1),
716 am.setAccountVisibility(ACCOUNT, PACKAGE_NAME_PRIVILEGED,
719 assertEquals(am.getAccountVisibility(ACCOUNT, PACKAGE_NAME_1),
724 * Test updates to account visibility for authenticator package.
729 am.addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
731 assertEquals(am.getAccountVisibility(ACCOUNT, PACKAGE_NAME_PRIVILEGED),
733 Map<String, Integer> visibilities = am.getPackagesAndVisibilityForAccount(ACCOUNT);
736 am.setAccountVisibility(ACCOUNT, PACKAGE_NAME_PRIVILEGED,
738 visibilities = am.getPackagesAndVisibilityForAccount(ACCOUNT);
743 assertEquals(am.getAccountVisibility(ACCOUNT, PACKAGE_NAME_PRIVILEGED),
753 am.addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
755 Map<String, Integer> visibilities = am.getPackagesAndVisibilityForAccount(ACCOUNT);
758 am.setAccountVisibility(ACCOUNT, PACKAGE_NAME_1, AccountManager.VISIBILITY_VISIBLE);
759 am.setAccountVisibility(ACCOUNT, PACKAGE_NAME_PRIVILEGED,
761 visibilities = am.getPackagesAndVisibilityForAccount(ACCOUNT);
780 am.addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */, visibility);
782 // Assert that we have one more account
783 Account[] accounts = am.getAccounts();
786 ACCOUNT));
789 assertEquals(am.getAccountVisibility(ACCOUNT, PACKAGE_NAME_1),
791 assertTrue(removeAccount(am, ACCOUNT, mActivity, null /* callback */)
795 Map<Account, Integer> visibilities =
797 assertNull(visibilities.get(ACCOUNT));
810 am.addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */, null);
813 am.setAccountVisibility(ACCOUNT, PACKAGE_NAME_1, AccountManager.VISIBILITY_NOT_VISIBLE);
818 assertEquals(am.getAccountVisibility(ACCOUNT, PACKAGE_NAME_1),
820 Account[] accounts = am.getAccountsByTypeForPackage(ACCOUNT_TYPE, PACKAGE_NAME_1);
823 Map<Account, Integer> visibilities =
825 assertEquals((int) visibilities.get(ACCOUNT), AccountManager.VISIBILITY_NOT_VISIBLE);
827 am.setAccountVisibility(ACCOUNT, PACKAGE_NAME_1,
830 assertEquals(am.getAccountVisibility(ACCOUNT, PACKAGE_NAME_1),
835 assertEquals((int) visibilities.get(ACCOUNT),
838 am.setAccountVisibility(ACCOUNT, PACKAGE_NAME_1,
841 assertEquals(am.getAccountVisibility(ACCOUNT, PACKAGE_NAME_1),
845 assertEquals((int) visibilities.get(ACCOUNT),
848 am.setAccountVisibility(ACCOUNT, PACKAGE_NAME_1, AccountManager.VISIBILITY_VISIBLE);
852 assertEquals((int) visibilities.get(ACCOUNT), AccountManager.VISIBILITY_VISIBLE);
868 Account account_1_1 = new Account("account_z", ACCOUNT_TYPE);
869 Account account_1_2 = new Account("account_c", ACCOUNT_TYPE);
870 Account account_1_3 = new Account("account_a", ACCOUNT_TYPE);
872 Account account_2_1 = new Account("account_b", ACCOUNT_TYPE_CUSTOM);
873 Account account_2_2 = new Account("account_f", ACCOUNT_TYPE_CUSTOM);
874 Account account_2_3 = new Account("account_a", ACCOUNT_TYPE_CUSTOM);
907 // Add a first account
909 boolean result = am.addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, USERDATA_BUNDLE);
914 String nullName = am.getPreviousName(ACCOUNT);
919 Account renamedAccount = renameAccount(am, ACCOUNT, ACCOUNT_NEW_NAME);
921 * Make sure that the resultant renamed account has the correct name
922 * and is associated with the correct account type.
925 assertEquals(ACCOUNT.type, renamedAccount.type);
928 Account[] accounts = am.getAccounts();
931 // Make sure the old account isn't present.
932 assertFalse(isAccountPresent(am.getAccounts(), ACCOUNT));
940 assertEquals(ACCOUNT.name, am.getPreviousName(renamedAccount));
953 assertEquals(false, isAccountPresent(am.getAccounts(), ACCOUNT));
958 // Add a first account
959 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
961 // Check that we have the new account
962 Account[] accounts = am.getAccounts();
964 assertEquals(true, isAccountPresent(accounts, ACCOUNT));
966 // Add another account
969 // Check that we have one more account again
978 // Check if we dont have any account from the other type
1000 // Add a first account
1001 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
1004 assertEquals(ACCOUNT_PASSWORD, am.getPassword(ACCOUNT));
1007 am.clearPassword(ACCOUNT);
1008 assertNull(am.getPassword(ACCOUNT));
1011 am.setPassword(ACCOUNT, ACCOUNT_PASSWORD);
1014 assertEquals(ACCOUNT_PASSWORD, am.getPassword(ACCOUNT));
1021 // Add a first account
1022 boolean result = am.addAccountExplicitly(ACCOUNT,
1029 assertEquals(USERDATA_VALUE_1, am.getUserData(ACCOUNT, USERDATA_NAME_1));
1031 am.setUserData(ACCOUNT, USERDATA_NAME_2, USERDATA_VALUE_2);
1034 assertEquals(USERDATA_VALUE_2, am.getUserData(ACCOUNT, USERDATA_NAME_2));
1043 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
1045 AccountManagerFuture<Account[]> futureAccounts = am.getAccountsByTypeAndFeatures(
1048 Account[] accounts = futureAccounts.getResult();
1052 assertEquals(true, isAccountPresent(accounts, ACCOUNT));
1070 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
1081 AccountManagerCallback<Account[]> callback1 = new AccountManagerCallback<Account[]>() {
1083 public void run(AccountManagerFuture<Account[]> accountsFuture) {
1085 Account[] accounts = accountsFuture.getResult();
1088 assertEquals(true, isAccountPresent(accounts, ACCOUNT));
1101 AccountManagerFuture<Account[]> futureAccounts = am.getAccountsByTypeAndFeatures(
1107 Account[] accounts = futureAccounts.getResult();
1111 assertEquals(true, isAccountPresent(accounts, ACCOUNT));
1122 AccountManagerCallback<Account[]> callback2 = new AccountManagerCallback<Account[]>() {
1124 public void run(AccountManagerFuture<Account[]> accountsFuture) {
1126 Account[] accounts = accountsFuture.getResult();
1164 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
1166 am.setAuthToken(ACCOUNT, AUTH_TOKEN_TYPE, expected);
1169 ACCOUNT, AUTH_TOKEN_TYPE);
1174 token = am.peekAuthToken(ACCOUNT, AUTH_TOKEN_TYPE);
1183 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null);
1185 String token = am.blockingGetAuthToken(ACCOUNT,
1195 private final Account mAccount;
1197 BlockingGetAuthTokenFetcher(Account account) {
1198 mAccount = account;
1215 public Account getAccount() {
1245 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
1246 AccountManagerFuture<Bundle> futureBundle = am.getAuthToken(ACCOUNT,
1288 public Account getAccount() {
1302 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
1304 AccountManagerFuture<Bundle> futureBundle = am.getAuthToken(ACCOUNT,
1353 public Account getAccount() {
1368 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null);
1414 public Account getAccount() {
1415 return ACCOUNT;
1474 public Account getAccount() {
1488 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
1523 AccountManagerFuture<Bundle> futureBundle = am.getAuthToken(ACCOUNT,
1549 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
1582 AccountManagerFuture<Bundle> futureBundle = am.getAuthToken(ACCOUNT,
1609 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
1680 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
1682 AccountManagerFuture<Bundle> futureBundle = am.confirmCredentials(ACCOUNT,
1695 * Tests the setting of lastAuthenticatedTime on adding account
1702 assertTrue(addAccountAndReturnAccountAddedTime(ACCOUNT, ACCOUNT_PASSWORD) > 0);
1706 * Test confirmCredentials() for account not on device. Just that no error
1712 Account account = new Account("AccountNotOnThisDevice", ACCOUNT_TYPE);
1713 AccountManagerFuture<Bundle> futureBundle = am.confirmCredentials(account,
1732 long accountAddTime = addAccountAndReturnAccountAddedTime(ACCOUNT, ACCOUNT_PASSWORD);
1736 Bundle result = am.confirmCredentials(ACCOUNT,
1756 long accountAddTime = addAccountAndReturnAccountAddedTime(ACCOUNT, ACCOUNT_PASSWORD);
1758 am.updateCredentials(ACCOUNT,
1764 long updateCredTime = getLastAuthenticatedTime(ACCOUNT);
1774 long accountAddTime = addAccountAndReturnAccountAddedTime(ACCOUNT, ACCOUNT_PASSWORD);
1776 long setPasswordTime = getLastAuthenticatedTime(ACCOUNT);
1785 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
1817 AccountManagerFuture<Bundle> futureBundle = am.confirmCredentials(ACCOUNT,
1836 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
1838 AccountManagerFuture<Bundle> futureBundle = am.updateCredentials(ACCOUNT,
1859 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
1895 AccountManagerFuture<Bundle> futureBundle = am.updateCredentials(ACCOUNT,
1978 assertTrue(removeAccount(am, ACCOUNT, mActivity, null /* callback */).getBoolean(
1985 assertTrue(removeAccount(am, ACCOUNT, mActivity, null /* callback */).getBoolean(
1992 assertTrue(removeAccount(am, ACCOUNT, mActivity, null /* callback */).getBoolean(
2010 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
2033 assertTrue(removeAccount(am, ACCOUNT, mActivity, null /* callback */).getBoolean(
2040 assertTrue(removeAccount(am, ACCOUNT, mActivity, null /* callback */).getBoolean(
2047 assertTrue(removeAccount(am, ACCOUNT, mActivity, null /* callback */).getBoolean(
2066 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
2088 assertTrue(removeAccount(am, ACCOUNT, mActivity, null /* callback */).getBoolean(
2107 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
2145 AccountManagerFuture<Boolean> booleanFuture = am.hasFeatures(ACCOUNT,
2151 booleanFuture = am.hasFeatures(ACCOUNT,
2157 booleanFuture = am.hasFeatures(ACCOUNT,
2163 booleanFuture = am.hasFeatures(ACCOUNT,
2169 booleanFuture = am.hasFeatures(ACCOUNT,
2175 booleanFuture = am.hasFeatures(ACCOUNT,
2239 am.hasFeatures(ACCOUNT,
2246 am.hasFeatures(ACCOUNT,
2253 am.hasFeatures(ACCOUNT,
2260 am.hasFeatures(ACCOUNT,
2267 am.hasFeatures(ACCOUNT,
2274 am.hasFeatures(ACCOUNT,
2281 private long getLastAuthenticatedTime(Account account) throws OperationCanceledException,
2286 Bundle result = am.confirmCredentials(account,
2295 private long addAccountAndReturnAccountAddedTime(Account account, String password)
2305 return getLastAuthenticatedTime(account);
2313 // Add an account,
2314 assertEquals(false, isAccountPresent(am.getAccounts(), ACCOUNT));
2315 addAccountExplicitly(ACCOUNT, ACCOUNT_PASSWORD, null /* userData */);
2323 Account[] accounts = am.getAccounts();
2328 Map<Account, Integer> accountsAndVisibility =
2334 Account[] accountsByType = am.getAccountsByType(ACCOUNT_TYPE);
2339 Account[] accountsByTypeForPackage =
2355 * encrypted session bundle, account password and status token.
2382 * Tests startAddAccountSession() with null session bundle. Only account
2417 * session bundle, account password and status token should be included in
2451 * account password and status token.
2546 * session bundle, account password and status token should be included in
2560 * session bundle, account password and status token. Callback should be
2763 * encrypted session bundle, account password and status token.
2772 ACCOUNT,
2788 * Tests startUpdateCredentialsSession() with null session bundle. Only account
2801 ACCOUNT,
2821 * session bundle, account password and status token should be included in
2834 ACCOUNT,
2853 * account password and status token.
2865 ACCOUNT,
2896 ACCOUNT,
2930 ACCOUNT,
2943 * session bundle, account password and status token should be included in
2958 * session bundle, account password and status token. Callback should be
3025 ACCOUNT,
3063 ACCOUNT,
3106 ACCOUNT,
3142 ACCOUNT,
3158 Account account,
3167 account,
3249 assertEquals(ACCOUNT, mockAuthenticator.mAccount);
3269 private void validateIsCredentialsUpdateSuggestedParametersAndOptions(Account account) {
3270 assertEquals(account, mockAuthenticator.getAccount());
3307 * startAddAccountSession(...). A bundle containing account name and account
3344 // Assert returned result containing account name, type but not auth token type.
3350 * startUpdateCredentialsSession(...). A bundle containing account name and account
3361 ACCOUNT,
3386 // Assert returned result containing account name, type but not auth token type.
3483 * Tests a finishSession() when account type is not added to session bundle
3484 * by startAddAccount(...) of authenticator. A bundle containing account
3485 * name and account type should still be returned as AccountManagerSerivce
3486 * will always add account type to the session bundle before encrypting it.
3491 // Create a session bundle without account type for MockAccountAuthenticator to return
3525 // Assert returned result containing account name, type but not auth token type.
3530 * Tests a finishSession() when account type is not added to session bundle
3532 * containing account name and account type should still be returned as
3533 * AccountManagerSerivce will always add account type to the session bundle
3539 // Create a session bundle without account type for MockAccountAuthenticator to return
3546 ACCOUNT,
3572 // Assert returned result containing account name, type but not auth token type.
3577 * Tests a finishSession() when a different account type is added to session bundle
3578 * by startAddAccount(...) of authenticator. A bundle containing account
3579 * name and the correct account type should be returned as AccountManagerSerivce
3580 * will always overrides account type to the session bundle before encrypting it.
3618 // Assert returned result containing account name, correct type but not auth token type.
3623 * Tests a finishSession() when a different account type is added to session bundle
3625 * containing account name and the correct account type should be returned as
3626 * AccountManagerSerivce will always override account type to the session bundle
3639 ACCOUNT,
3665 // Assert returned result containing account name, correct type but not auth token type.
3673 * A bundle containing account name and type will be returned.
3716 // Assert returned result containing account name, type but not auth token type.
3828 * account name and type should be returned via the callback regardless of
3841 * automatically. A bundle containing account name and type will be returned
3918 // Assert returned result containing account name, type but not auth token type.
3970 // Assert returned result containing account name, type but not auth token type.
4143 Account account = new Account(accountName, ACCOUNT_TYPE);
4147 account,
4153 validateIsCredentialsUpdateSuggestedParametersAndOptions(account);
4160 * Tests isCredentialsUpdateSuggested() when account is null.
4169 null /* account */,
4173 fail("Should have thrown IllegalArgumentation when calling with null account!");
4186 Account account = new Account(accountName, ACCOUNT_TYPE);
4190 account,
4206 Account account = new Account(accountName, ACCOUNT_TYPE);
4211 account,
4247 final Account account = new Account(accountName, ACCOUNT_TYPE);
4265 validateIsCredentialsUpdateSuggestedParametersAndOptions(account);
4276 account,
4288 final Account account = new Account(accountName, ACCOUNT_TYPE);
4314 account,
4325 Account account,
4332 account,
4346 private void verifyAccountsGroupedByType(Account[] accounts) {