From 58fa836210a2872e58e8890456c2cd14a4b0fd3d Mon Sep 17 00:00:00 2001 From: Dmitry Dementyev Date: Tue, 20 Dec 2016 18:08:51 -0800 Subject: [PATCH] Implement Account Discovery API. Bug: https://b.corp.google.com/issues/33046496 Test: cts tests, manual tests. Change-Id: I03d1ae5dfa1577f191817aa7d508f6b4d0e625ed --- .../java/android/accounts/AccountManager.java | 9 +- .../accounts/ChooseAccountActivity.java | 4 +- core/res/AndroidManifest.xml | 3 + .../accounts/AccountManagerService.java | 870 +++++++++++++++--- .../android/server/accounts/AccountsDb.java | 4 +- 5 files changed, 736 insertions(+), 154 deletions(-) diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java index 8185818ccd294..2be84c14cce64 100644 --- a/core/java/android/accounts/AccountManager.java +++ b/core/java/android/accounts/AccountManager.java @@ -328,7 +328,6 @@ public class AccountManager { /** * Token type for the special case where a UID has access only to an account * but no authenticator specific auth token types. - * * @hide */ public static final String ACCOUNT_ACCESS_TOKEN_TYPE = @@ -354,9 +353,9 @@ public class AccountManager { * the applications are added, accounts are removed, or an account's credentials (saved * password, etc) are changed. List of supported account types shoud be specified in the * Manifest file using {@link #SUPPORTED_ACCOUNT_TYPES} - * - * @see #addOnAccountsUpdatedListener * @hide + * @see #addOnAccountsUpdatedListener + * */ public static final String ACTION_VISIBLE_ACCOUNTS_CHANGED = "android.accounts.action.VISIBLE_ACCOUNTS_CHANGED"; @@ -364,6 +363,7 @@ public class AccountManager { /** * Authenticators may subscribe to get notifications about apps interested in their managed account * types using {@link #SUPPORTED_ACCOUNT_TYPES}. + * Package name will be specified using {@link Intent.EXTRA_PACKAGE_NAME} * @hide */ public static final String ACTION_ACCOUNTS_LISTENER_PACKAGE_INSTALLED = @@ -1024,7 +1024,7 @@ public class AccountManager { public boolean isAccountVisible(Account account, int uid) { try { Integer visibility = mService.getAccountVisibility(account, uid); - return visibility == VISIBILITY_USER_MANAGED_NOT_VISIBLE + return visibility == VISIBILITY_USER_MANAGED_VISIBLE || visibility == VISIBILITY_VISIBLE; } catch (RemoteException re) { throw re.rethrowFromSystemServer(); @@ -1058,6 +1058,7 @@ public class AccountManager { /** * Gets visibility of certain account for given UID. Possible returned values are: *