diff options
author | Amith Yamasani <yamasani@google.com> | 2013-04-18 18:40:07 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2013-04-19 12:07:46 -0700 |
commit | 3b458ad9ee5f2d6b7cf28a13bc29123cdf540763 (patch) | |
tree | c4337769df97e9ec86dc34cb9590a208916f96d6 /core/java/android/accounts | |
parent | 7f6fc12997d67ae80a044bc0b4cc17797d887911 (diff) | |
download | frameworks_base-3b458ad9ee5f2d6b7cf28a13bc29123cdf540763.zip frameworks_base-3b458ad9ee5f2d6b7cf28a13bc29123cdf540763.tar.gz frameworks_base-3b458ad9ee5f2d6b7cf28a13bc29123cdf540763.tar.bz2 |
Improve API and documentation
API for querying accounts visible to a specific package.
Improve API and docs for device owner.
Bug: 8657158
Change-Id: I01b8701534f64b383391508a49ae93ed21f22ae0
Diffstat (limited to 'core/java/android/accounts')
-rw-r--r-- | core/java/android/accounts/AccountManager.java | 17 | ||||
-rw-r--r-- | core/java/android/accounts/IAccountManager.aidl | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java index 241a64a..b4a12c4 100644 --- a/core/java/android/accounts/AccountManager.java +++ b/core/java/android/accounts/AccountManager.java @@ -405,6 +405,23 @@ public class AccountManager { } /** + * Returns the accounts visible to the specified package, in an environment where some apps + * are not authorized to view all accounts. This method can only be called by system apps. + * @param type The type of accounts to return, null to retrieve all accounts + * @param packageName The package name of the app for which the accounts are to be returned + * @return An array of {@link Account}, one per matching account. Empty + * (never null) if no accounts of the specified type have been added. + */ + public Account[] getAccountsByTypeForPackage(String type, String packageName) { + try { + return mService.getAccountsByTypeForPackage(type, packageName); + } catch (RemoteException re) { + // possible security exception + throw new RuntimeException(re); + } + } + + /** * Lists all accounts of a particular type. The account type is a * string token corresponding to the authenticator and useful domain * of the account. For example, there are types corresponding to Google diff --git a/core/java/android/accounts/IAccountManager.aidl b/core/java/android/accounts/IAccountManager.aidl index 8141813..86e279f 100644 --- a/core/java/android/accounts/IAccountManager.aidl +++ b/core/java/android/accounts/IAccountManager.aidl @@ -32,6 +32,7 @@ interface IAccountManager { AuthenticatorDescription[] getAuthenticatorTypes(); Account[] getAccounts(String accountType); Account[] getAccountsForPackage(String packageName, int uid); + Account[] getAccountsByTypeForPackage(String type, String packageName); Account[] getAccountsAsUser(String accountType, int userId); void hasFeatures(in IAccountManagerResponse response, in Account account, in String[] features); void getAccountsByFeatures(in IAccountManagerResponse response, String accountType, in String[] features); |