diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/accounts/AccountManager.java | 17 | ||||
| -rw-r--r-- | core/java/android/accounts/IAccountManager.aidl | 1 | ||||
| -rw-r--r-- | core/java/android/app/admin/DevicePolicyManager.java | 27 | ||||
| -rw-r--r-- | core/java/android/content/Intent.java | 4 |
4 files changed, 41 insertions, 8 deletions
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java index 241a64af65ae..b4a12c4bdbff 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 81418132d5c8..86e279f3d005 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); diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 8284b2c0a5e7..17e8dd968006 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -1537,14 +1537,21 @@ public class DevicePolicyManager { return false; } + /** - * Used to determine if a particular package has been registered as a Device Owner admin. - * Device Owner admins cannot be deactivated by the user unless the Device Owner itself allows - * it. And Device Owner packages cannot be uninstalled, once registered. - * @param packageName the package name to check against the registered device owner. - * @return whether or not the package is registered as the Device Owner. + * Used to determine if a particular package has been registered as a Device Owner app. + * A device owner app is a special device admin that cannot be deactivated by the user, once + * activated as a device admin. It also cannot be uninstalled. To check if a particular + * package is currently registered as the device owner app, pass in the package name from + * {@link Context#getPackageName()} to this method.<p/>This is useful for device + * admin apps that want to check if they are also registered as the device owner app. The + * exact mechanism by which a device admin app is registered as a device owner app is defined by + * the setup process. + * @param packageName the package name of the app, to compare with the registered device owner + * app, if any. + * @return whether or not the package is registered as the device owner app. */ - public boolean isDeviceOwner(String packageName) { + public boolean isDeviceOwnerApp(String packageName) { if (mService != null) { try { return mService.isDeviceOwner(packageName); @@ -1555,6 +1562,14 @@ public class DevicePolicyManager { return false; } + /** + * @hide + * Redirect to isDeviceOwnerApp. + */ + public boolean isDeviceOwner(String packageName) { + return isDeviceOwnerApp(packageName); + } + /** @hide */ public String getDeviceOwner() { if (mService != null) { diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 1ab1eb8e90aa..67bd952c3534 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -2425,8 +2425,8 @@ public class Intent implements Parcelable, Cloneable { * which is of type <code>ArrayList<RestrictionEntry></code>. It can also * contain an extra {@link #EXTRA_RESTRICTIONS_INTENT}, which is of type <code>Intent</code>. * The activity specified by that intent will be launched for a result which must contain - * the extra {@link #EXTRA_RESTRICTIONS_LIST}. The keys and values of the returned restrictions - * will be persisted. + * one of the extras {@link #EXTRA_RESTRICTIONS_LIST} or {@link #EXTRA_RESTRICTIONS_BUNDLE}. + * The keys and values of the returned restrictions will be persisted. * @see RestrictionEntry */ public static final String ACTION_GET_RESTRICTION_ENTRIES = |
