summaryrefslogtreecommitdiffstats
path: root/core/java/android/accounts/AccountManager.java
diff options
context:
space:
mode:
authorAlexandra Gherghina <alexgherghina@google.com>2014-06-05 10:49:14 +0100
committerAlexandra Gherghina <alexgherghina@google.com>2014-06-12 18:39:33 +0100
commitc1cf161af036e0f337b58ef0739a8ff2e42f01e7 (patch)
tree5677bc04bce8515a67230d2df40c93302a8d4707 /core/java/android/accounts/AccountManager.java
parente830c37a4a499c439083afc56c64fa178ea5889d (diff)
downloadframeworks_base-c1cf161af036e0f337b58ef0739a8ff2e42f01e7.zip
frameworks_base-c1cf161af036e0f337b58ef0739a8ff2e42f01e7.tar.gz
frameworks_base-c1cf161af036e0f337b58ef0739a8ff2e42f01e7.tar.bz2
Modifies APIs for retrieving managed profile accounts.
This is needed for Account Settings UI. Bug: 13656853 Change-Id: I33129e4b7b33b428a7bf670259accacb60f62d9b
Diffstat (limited to 'core/java/android/accounts/AccountManager.java')
-rw-r--r--core/java/android/accounts/AccountManager.java46
1 files changed, 45 insertions, 1 deletions
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 12fcdcf..806a55b 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -359,7 +359,29 @@ public class AccountManager {
*/
public AuthenticatorDescription[] getAuthenticatorTypes() {
try {
- return mService.getAuthenticatorTypes();
+ return mService.getAuthenticatorTypes(UserHandle.getCallingUserId());
+ } catch (RemoteException e) {
+ // will never happen
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * @hide
+ * Lists the currently registered authenticators for a given user id.
+ *
+ * <p>It is safe to call this method from the main thread.
+ *
+ * <p>The caller has to be in the same user or have the permission
+ * {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL}.
+ *
+ * @return An array of {@link AuthenticatorDescription} for every
+ * authenticator known to the AccountManager service. Empty (never
+ * null) if no authenticators are known.
+ */
+ public AuthenticatorDescription[] getAuthenticatorTypesAsUser(int userId) {
+ try {
+ return mService.getAuthenticatorTypes(userId);
} catch (RemoteException e) {
// will never happen
throw new RuntimeException(e);
@@ -389,6 +411,28 @@ public class AccountManager {
/**
* @hide
+ * Lists all accounts of any type registered on the device for a given
+ * user id. Equivalent to getAccountsByType(null).
+ *
+ * <p>It is safe to call this method from the main thread.
+ *
+ * <p>This method requires the caller to hold the permission
+ * {@link android.Manifest.permission#GET_ACCOUNTS}.
+ *
+ * @return An array of {@link Account}, one for each account. Empty
+ * (never null) if no accounts have been added.
+ */
+ public Account[] getAccountsAsUser(int userId) {
+ try {
+ return mService.getAccountsAsUser(null, userId);
+ } catch (RemoteException e) {
+ // won't ever happen
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * @hide
* For use by internal activities. Returns the list of accounts that the calling package
* is authorized to use, particularly for shared accounts.
* @param packageName package name of the calling app.