Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -2210,6 +2210,7 @@ package android.accounts { field public static final java.lang.String AUTHENTICATOR_ATTRIBUTES_NAME = "account-authenticator"; field public static final java.lang.String AUTHENTICATOR_META_DATA_NAME = "android.accounts.AccountAuthenticator"; field public static final int ERROR_CODE_BAD_ARGUMENTS = 7; // 0x7 field public static final int ERROR_CODE_BAD_AUTHENTICATION = 9; // 0x9 field public static final int ERROR_CODE_BAD_REQUEST = 8; // 0x8 field public static final int ERROR_CODE_CANCELED = 4; // 0x4 field public static final int ERROR_CODE_INVALID_RESPONSE = 5; // 0x5 core/java/android/accounts/AccountManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -151,6 +151,7 @@ public class AccountManager { public static final int ERROR_CODE_UNSUPPORTED_OPERATION = 6; public static final int ERROR_CODE_BAD_ARGUMENTS = 7; public static final int ERROR_CODE_BAD_REQUEST = 8; public static final int ERROR_CODE_BAD_AUTHENTICATION = 9; /** @hide */ public static final int ERROR_CODE_USER_RESTRICTED = 100; Loading services/java/com/android/server/accounts/AccountManagerService.java +8 −23 Original line number Diff line number Diff line Loading @@ -541,6 +541,7 @@ public class AccountManagerService } } @Override public boolean addAccount(Account account, String password, Bundle extras) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "addAccount: " + account Loading @@ -549,9 +550,13 @@ public class AccountManagerService } if (account == null) throw new IllegalArgumentException("account is null"); checkAuthenticateAccountsPermission(account); if (!canUserModifyAccounts(Binder.getCallingUid())) { return false; } /* * Child users are not allowed to add accounts. Only the accounts that are * shared by the parent profile can be added to child profile. * * TODO: Only allow accounts that were shared to be added by * a limited user. */ UserAccounts accounts = getUserAccountsForCaller(); // fails if the account already exists Loading Loading @@ -588,12 +593,9 @@ public class AccountManagerService if (result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT, false)) { // Create a Session for the target user and pass in the bundle completeCloningAccount(result, account, toAccounts); } else { clonePassword(fromAccounts, toAccounts, account); } return; } else { clonePassword(fromAccounts, toAccounts, account); super.onResult(result); } } Loading @@ -604,23 +606,6 @@ public class AccountManagerService return true; } // TODO: Remove fallback - move to authenticator private void clonePassword(UserAccounts fromAccounts, UserAccounts toAccounts, Account account) { long id = clearCallingIdentity(); try { String password = readPasswordInternal(fromAccounts, account); String extraFlags = readUserDataInternal(fromAccounts, account, "flags"); String extraServices = readUserDataInternal(fromAccounts, account, "services"); Bundle extras = new Bundle(); extras.putString("flags", extraFlags); extras.putString("services", extraServices); addAccountInternal(toAccounts, account, password, extras, true); } finally { restoreCallingIdentity(id); } } void completeCloningAccount(final Bundle result, final Account account, final UserAccounts targetUser) { long id = clearCallingIdentity(); Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -2210,6 +2210,7 @@ package android.accounts { field public static final java.lang.String AUTHENTICATOR_ATTRIBUTES_NAME = "account-authenticator"; field public static final java.lang.String AUTHENTICATOR_META_DATA_NAME = "android.accounts.AccountAuthenticator"; field public static final int ERROR_CODE_BAD_ARGUMENTS = 7; // 0x7 field public static final int ERROR_CODE_BAD_AUTHENTICATION = 9; // 0x9 field public static final int ERROR_CODE_BAD_REQUEST = 8; // 0x8 field public static final int ERROR_CODE_CANCELED = 4; // 0x4 field public static final int ERROR_CODE_INVALID_RESPONSE = 5; // 0x5
core/java/android/accounts/AccountManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -151,6 +151,7 @@ public class AccountManager { public static final int ERROR_CODE_UNSUPPORTED_OPERATION = 6; public static final int ERROR_CODE_BAD_ARGUMENTS = 7; public static final int ERROR_CODE_BAD_REQUEST = 8; public static final int ERROR_CODE_BAD_AUTHENTICATION = 9; /** @hide */ public static final int ERROR_CODE_USER_RESTRICTED = 100; Loading
services/java/com/android/server/accounts/AccountManagerService.java +8 −23 Original line number Diff line number Diff line Loading @@ -541,6 +541,7 @@ public class AccountManagerService } } @Override public boolean addAccount(Account account, String password, Bundle extras) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "addAccount: " + account Loading @@ -549,9 +550,13 @@ public class AccountManagerService } if (account == null) throw new IllegalArgumentException("account is null"); checkAuthenticateAccountsPermission(account); if (!canUserModifyAccounts(Binder.getCallingUid())) { return false; } /* * Child users are not allowed to add accounts. Only the accounts that are * shared by the parent profile can be added to child profile. * * TODO: Only allow accounts that were shared to be added by * a limited user. */ UserAccounts accounts = getUserAccountsForCaller(); // fails if the account already exists Loading Loading @@ -588,12 +593,9 @@ public class AccountManagerService if (result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT, false)) { // Create a Session for the target user and pass in the bundle completeCloningAccount(result, account, toAccounts); } else { clonePassword(fromAccounts, toAccounts, account); } return; } else { clonePassword(fromAccounts, toAccounts, account); super.onResult(result); } } Loading @@ -604,23 +606,6 @@ public class AccountManagerService return true; } // TODO: Remove fallback - move to authenticator private void clonePassword(UserAccounts fromAccounts, UserAccounts toAccounts, Account account) { long id = clearCallingIdentity(); try { String password = readPasswordInternal(fromAccounts, account); String extraFlags = readUserDataInternal(fromAccounts, account, "flags"); String extraServices = readUserDataInternal(fromAccounts, account, "services"); Bundle extras = new Bundle(); extras.putString("flags", extraFlags); extras.putString("services", extraServices); addAccountInternal(toAccounts, account, password, extras, true); } finally { restoreCallingIdentity(id); } } void completeCloningAccount(final Bundle result, final Account account, final UserAccounts targetUser) { long id = clearCallingIdentity(); Loading