Loading api/current.txt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -67,7 +67,7 @@ package android { field public static final java.lang.String DUMP = "android.permission.DUMP"; field public static final java.lang.String DUMP = "android.permission.DUMP"; field public static final java.lang.String EXPAND_STATUS_BAR = "android.permission.EXPAND_STATUS_BAR"; field public static final java.lang.String EXPAND_STATUS_BAR = "android.permission.EXPAND_STATUS_BAR"; field public static final java.lang.String FACTORY_TEST = "android.permission.FACTORY_TEST"; field public static final java.lang.String FACTORY_TEST = "android.permission.FACTORY_TEST"; field public static final java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; field public static final deprecated java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; field public static final java.lang.String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED"; field public static final java.lang.String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED"; field public static final java.lang.String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE"; field public static final java.lang.String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE"; field public static final deprecated java.lang.String GET_TASKS = "android.permission.GET_TASKS"; field public static final deprecated java.lang.String GET_TASKS = "android.permission.GET_TASKS"; api/system-current.txt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -95,7 +95,7 @@ package android { field public static final java.lang.String FACTORY_TEST = "android.permission.FACTORY_TEST"; field public static final java.lang.String FACTORY_TEST = "android.permission.FACTORY_TEST"; field public static final java.lang.String FORCE_BACK = "android.permission.FORCE_BACK"; field public static final java.lang.String FORCE_BACK = "android.permission.FORCE_BACK"; field public static final java.lang.String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES"; field public static final java.lang.String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES"; field public static final java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; field public static final deprecated java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; field public static final java.lang.String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED"; field public static final java.lang.String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED"; field public static final java.lang.String GET_APP_OPS_STATS = "android.permission.GET_APP_OPS_STATS"; field public static final java.lang.String GET_APP_OPS_STATS = "android.permission.GET_APP_OPS_STATS"; field public static final java.lang.String GET_PACKAGE_IMPORTANCE = "android.permission.GET_PACKAGE_IMPORTANCE"; field public static final java.lang.String GET_PACKAGE_IMPORTANCE = "android.permission.GET_PACKAGE_IMPORTANCE"; api/test-current.txt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -67,7 +67,7 @@ package android { field public static final java.lang.String DUMP = "android.permission.DUMP"; field public static final java.lang.String DUMP = "android.permission.DUMP"; field public static final java.lang.String EXPAND_STATUS_BAR = "android.permission.EXPAND_STATUS_BAR"; field public static final java.lang.String EXPAND_STATUS_BAR = "android.permission.EXPAND_STATUS_BAR"; field public static final java.lang.String FACTORY_TEST = "android.permission.FACTORY_TEST"; field public static final java.lang.String FACTORY_TEST = "android.permission.FACTORY_TEST"; field public static final java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; field public static final deprecated java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; field public static final java.lang.String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED"; field public static final java.lang.String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED"; field public static final java.lang.String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE"; field public static final java.lang.String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE"; field public static final deprecated java.lang.String GET_TASKS = "android.permission.GET_TASKS"; field public static final deprecated java.lang.String GET_TASKS = "android.permission.GET_TASKS"; core/java/android/accounts/AccountManager.java +60 −64 Original line number Original line Diff line number Diff line Loading @@ -430,47 +430,46 @@ public class AccountManager { } } /** /** * Lists all accounts of any type registered on the device. * List every {@link Account} registered on the device that are managed by * Equivalent to getAccountsByType(null). * applications whose signatures match the caller. * * * <p>It is safe to call this method from the main thread. * <p>This method can be called safely from the main thread. It is * equivalent to calling <code>getAccountsByType(null)</code>. * * * <p>Clients of this method that have not been granted the * <p><b>NOTE:</b> Apps declaring a {@code targetSdkVersion<=23} in their * {@link android.Manifest.permission#GET_ACCOUNTS} permission, * manifests will continue to behave as they did on devices that support * will only see those accounts managed by AbstractAccountAuthenticators whose * API level 23. In particular the GET_ACCOUNTS permission is required to * signature matches the client. * see all the Accounts registered with the AccountManager. See docs for * this function in API level 23 for more information. * * * @return An array of {@link Account}, one for each account. Empty * @return Array of Accounts. The array may be empty if no accounts are * (never null) if no accounts have been added. * available to the caller. */ */ @NonNull @NonNull @RequiresPermission(GET_ACCOUNTS) public Account[] getAccounts() { public Account[] getAccounts() { try { return getAccountsByType(null); return mService.getAccounts(null, mContext.getOpPackageName()); } catch (RemoteException e) { // won't ever happen throw new RuntimeException(e); } } } /** /** * @hide * @hide * Lists all accounts of any type registered on the device for a given * List every {@link Account} registered on the device for a specific User * user id. Equivalent to getAccountsByType(null). * that are managed by applications whose signatures match the caller. * * * <p>It is safe to call this method from the main thread. * <p><b>NOTE:</b> Apps declaring a {@code targetSdkVersion<=23} in their * manifests will continue to behave as they did on devices that support * API level 23. In particular the GET_ACCOUNTS permission is required to * see all the Accounts registered with the AccountManager for the * specified userId. See docs for this function in API level 23 for more * information. * * * <p>Clients of this method that have not been granted the * <p>This method can be called safely from the main thread. * {@link android.Manifest.permission#GET_ACCOUNTS} permission, * will only see those accounts managed by AbstractAccountAuthenticators whose * signature matches the client. * * * @return An array of {@link Account}, one for each account. Empty * @param int userId associated with the User whose accounts should be * (never null) if no accounts have been added. * queried. * @return Array of Accounts. The array may be empty if no accounts are * available to the caller. */ */ @NonNull @NonNull @RequiresPermission(GET_ACCOUNTS) public Account[] getAccountsAsUser(int userId) { public Account[] getAccountsAsUser(int userId) { try { try { return mService.getAccountsAsUser(null, userId, mContext.getOpPackageName()); return mService.getAccountsAsUser(null, userId, mContext.getOpPackageName()); Loading Loading @@ -501,10 +500,11 @@ public class AccountManager { /** /** * Returns the accounts visible to the specified package, in an environment where some apps * 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. * 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 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 * @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 * @return Array of Accounts. The array may be empty if no accounts of th * (never null) if no accounts of the specified type have been added. * specified type are visible to the caller. */ */ @NonNull @NonNull public Account[] getAccountsByTypeForPackage(String type, String packageName) { public Account[] getAccountsByTypeForPackage(String type, String packageName) { Loading @@ -518,29 +518,22 @@ public class AccountManager { } } /** /** * Lists all accounts of a particular type. The account type is a * List every {@link Account} of a specified type managed by applications * string token corresponding to the authenticator and useful domain * whose signatures match the caller. * of the account. For example, there are types corresponding to Google * and Facebook. The exact string token to use will be published somewhere * associated with the authenticator in question. * * * <p>It is safe to call this method from the main thread. * <p><b>NOTE:</b> Apps declaring a {@code targetSdkVersion<=23} in their * * manifests will continue to behave as they did on devices that support * <p>Clients of this method that have not been granted the * API level 23. See docs for this function in API level 23 for more * {@link android.Manifest.permission#GET_ACCOUNTS} permission, * information. * will only see those accounts managed by AbstractAccountAuthenticators whose * signature matches the client. * * * <p><b>NOTE:</b> If targeting your app to work on API level 22 and before, * <p>This method can be called safely from the main thread. * GET_ACCOUNTS permission is needed for those platforms, irrespective of uid * or signature match. See docs for this function in API level 22. * * * @param type The type of accounts to return, null to retrieve all accounts * @param type String denoting the type of the accounts to return, * @return An array of {@link Account}, one per matching account. Empty * {@code null} to retrieve all accounts visible to the caller. * (never null) if no accounts of the specified type have been added. * @return An array of Accounts. Empty (never null) if no accounts * are available to the caller. */ */ @NonNull @NonNull @RequiresPermission(GET_ACCOUNTS) public Account[] getAccountsByType(String type) { public Account[] getAccountsByType(String type) { return getAccountsByTypeAsUser(type, Process.myUserHandle()); return getAccountsByTypeAsUser(type, Process.myUserHandle()); } } Loading Loading @@ -586,6 +579,7 @@ public class AccountManager { * @return a future containing the label string * @return a future containing the label string * @hide * @hide */ */ @NonNull public AccountManagerFuture<String> getAuthTokenLabel( public AccountManagerFuture<String> getAuthTokenLabel( final String accountType, final String authTokenType, final String accountType, final String authTokenType, AccountManagerCallback<String> callback, Handler handler) { AccountManagerCallback<String> callback, Handler handler) { Loading Loading @@ -617,9 +611,13 @@ public class AccountManager { * <p>This method may be called from any thread, but the returned * <p>This method may be called from any thread, but the returned * {@link AccountManagerFuture} must not be used on the main thread. * {@link AccountManagerFuture} must not be used on the main thread. * * * <p>This method requires the caller to hold the permission * <p><b>Note:</b>The specified account must be managed by an application * {@link android.Manifest.permission#GET_ACCOUNTS} or be a signature * whose signature matches the caller. * match with the AbstractAccountAuthenticator that manages the account. * * <p><b>Further note:</b>Apps targeting API level 23 or earlier will continue to * behave as they did on devices that support API level 23. In particular * they may still require the GET_ACCOUNTS permission. See docs for this * function in API level 23. * * * @param account The {@link Account} to test * @param account The {@link Account} to test * @param features An array of the account features to check * @param features An array of the account features to check Loading @@ -629,8 +627,10 @@ public class AccountManager { * null for the main thread * null for the main thread * @return An {@link AccountManagerFuture} which resolves to a Boolean, * @return An {@link AccountManagerFuture} which resolves to a Boolean, * true if the account exists and has all of the specified features. * true if the account exists and has all of the specified features. * @throws SecurityException if the specified account is managed by an * application whose signature doesn't match the caller's signature. */ */ @RequiresPermission(GET_ACCOUNTS) @NonNull public AccountManagerFuture<Boolean> hasFeatures(final Account account, public AccountManagerFuture<Boolean> hasFeatures(final Account account, final String[] features, final String[] features, AccountManagerCallback<Boolean> callback, Handler handler) { AccountManagerCallback<Boolean> callback, Handler handler) { Loading @@ -651,9 +651,10 @@ public class AccountManager { /** /** * Lists all accounts of a type which have certain features. The account * Lists all accounts of a type which have certain features. The account * type identifies the authenticator (see {@link #getAccountsByType}). * type identifies the authenticator (see {@link #getAccountsByType}). Said * Account features are authenticator-specific string tokens identifying * authenticator must be in a package whose signature matches the callers * boolean account properties (see {@link #hasFeatures}). * package signature. Account features are authenticator-specific string tokens * identifying boolean account properties (see {@link #hasFeatures}). * * * <p>Unlike {@link #getAccountsByType}, this method calls the authenticator, * <p>Unlike {@link #getAccountsByType}, this method calls the authenticator, * which may contact the server or do other work to check account features, * which may contact the server or do other work to check account features, Loading @@ -662,19 +663,14 @@ public class AccountManager { * <p>This method may be called from any thread, but the returned * <p>This method may be called from any thread, but the returned * {@link AccountManagerFuture} must not be used on the main thread. * {@link AccountManagerFuture} must not be used on the main thread. * * * <p>Clients of this method that have not been granted the * <p><b>NOTE:</b> Apps targeting API level 23 or earlier will continue to * {@link android.Manifest.permission#GET_ACCOUNTS} permission, * behave as they did on devices that support API level 23. In particular * will only see those accounts managed by AbstractAccountAuthenticators whose * they may still require the GET_ACCOUNTS permission. See docs for this * signature matches the client. * function in API level 23. * * * @param type The type of accounts to return, must not be null * @param type The type of accounts to return, must not be null * @param features An array of the account features to require, * @param features An array of the account features to require, * may be null or empty * may be null or empty * * <p><b>NOTE:</b> If targeting your app to work on API level 22 and before, * GET_ACCOUNTS permission is needed for those platforms, irrespective of uid * or signature match. See docs for this function in API level 22. * * @param callback Callback to invoke when the request completes, * @param callback Callback to invoke when the request completes, * null for no callback * null for no callback * @param handler {@link Handler} identifying the callback thread, * @param handler {@link Handler} identifying the callback thread, Loading @@ -683,7 +679,7 @@ public class AccountManager { * {@link Account}, one per account of the specified type which * {@link Account}, one per account of the specified type which * matches the requested features. * matches the requested features. */ */ @RequiresPermission(GET_ACCOUNTS) @NonNull public AccountManagerFuture<Account[]> getAccountsByTypeAndFeatures( public AccountManagerFuture<Account[]> getAccountsByTypeAndFeatures( final String type, final String[] features, final String type, final String[] features, AccountManagerCallback<Account[]> callback, Handler handler) { AccountManagerCallback<Account[]> callback, Handler handler) { Loading core/res/AndroidManifest.xml +2 −1 Original line number Original line Diff line number Diff line Loading @@ -1194,7 +1194,8 @@ <eat-comment /> <eat-comment /> <!-- Allows access to the list of accounts in the Accounts Service. <!-- Allows access to the list of accounts in the Accounts Service. <p>Protection level: normal <p>Protection level: dangerous @deprecated Not operative for apps apps with targetSdkVersion >= 24. --> --> <permission android:name="android.permission.GET_ACCOUNTS" <permission android:name="android.permission.GET_ACCOUNTS" android:permissionGroup="android.permission-group.CONTACTS" android:permissionGroup="android.permission-group.CONTACTS" Loading Loading
api/current.txt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -67,7 +67,7 @@ package android { field public static final java.lang.String DUMP = "android.permission.DUMP"; field public static final java.lang.String DUMP = "android.permission.DUMP"; field public static final java.lang.String EXPAND_STATUS_BAR = "android.permission.EXPAND_STATUS_BAR"; field public static final java.lang.String EXPAND_STATUS_BAR = "android.permission.EXPAND_STATUS_BAR"; field public static final java.lang.String FACTORY_TEST = "android.permission.FACTORY_TEST"; field public static final java.lang.String FACTORY_TEST = "android.permission.FACTORY_TEST"; field public static final java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; field public static final deprecated java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; field public static final java.lang.String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED"; field public static final java.lang.String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED"; field public static final java.lang.String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE"; field public static final java.lang.String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE"; field public static final deprecated java.lang.String GET_TASKS = "android.permission.GET_TASKS"; field public static final deprecated java.lang.String GET_TASKS = "android.permission.GET_TASKS";
api/system-current.txt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -95,7 +95,7 @@ package android { field public static final java.lang.String FACTORY_TEST = "android.permission.FACTORY_TEST"; field public static final java.lang.String FACTORY_TEST = "android.permission.FACTORY_TEST"; field public static final java.lang.String FORCE_BACK = "android.permission.FORCE_BACK"; field public static final java.lang.String FORCE_BACK = "android.permission.FORCE_BACK"; field public static final java.lang.String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES"; field public static final java.lang.String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES"; field public static final java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; field public static final deprecated java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; field public static final java.lang.String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED"; field public static final java.lang.String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED"; field public static final java.lang.String GET_APP_OPS_STATS = "android.permission.GET_APP_OPS_STATS"; field public static final java.lang.String GET_APP_OPS_STATS = "android.permission.GET_APP_OPS_STATS"; field public static final java.lang.String GET_PACKAGE_IMPORTANCE = "android.permission.GET_PACKAGE_IMPORTANCE"; field public static final java.lang.String GET_PACKAGE_IMPORTANCE = "android.permission.GET_PACKAGE_IMPORTANCE";
api/test-current.txt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -67,7 +67,7 @@ package android { field public static final java.lang.String DUMP = "android.permission.DUMP"; field public static final java.lang.String DUMP = "android.permission.DUMP"; field public static final java.lang.String EXPAND_STATUS_BAR = "android.permission.EXPAND_STATUS_BAR"; field public static final java.lang.String EXPAND_STATUS_BAR = "android.permission.EXPAND_STATUS_BAR"; field public static final java.lang.String FACTORY_TEST = "android.permission.FACTORY_TEST"; field public static final java.lang.String FACTORY_TEST = "android.permission.FACTORY_TEST"; field public static final java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; field public static final deprecated java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; field public static final java.lang.String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED"; field public static final java.lang.String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED"; field public static final java.lang.String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE"; field public static final java.lang.String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE"; field public static final deprecated java.lang.String GET_TASKS = "android.permission.GET_TASKS"; field public static final deprecated java.lang.String GET_TASKS = "android.permission.GET_TASKS";
core/java/android/accounts/AccountManager.java +60 −64 Original line number Original line Diff line number Diff line Loading @@ -430,47 +430,46 @@ public class AccountManager { } } /** /** * Lists all accounts of any type registered on the device. * List every {@link Account} registered on the device that are managed by * Equivalent to getAccountsByType(null). * applications whose signatures match the caller. * * * <p>It is safe to call this method from the main thread. * <p>This method can be called safely from the main thread. It is * equivalent to calling <code>getAccountsByType(null)</code>. * * * <p>Clients of this method that have not been granted the * <p><b>NOTE:</b> Apps declaring a {@code targetSdkVersion<=23} in their * {@link android.Manifest.permission#GET_ACCOUNTS} permission, * manifests will continue to behave as they did on devices that support * will only see those accounts managed by AbstractAccountAuthenticators whose * API level 23. In particular the GET_ACCOUNTS permission is required to * signature matches the client. * see all the Accounts registered with the AccountManager. See docs for * this function in API level 23 for more information. * * * @return An array of {@link Account}, one for each account. Empty * @return Array of Accounts. The array may be empty if no accounts are * (never null) if no accounts have been added. * available to the caller. */ */ @NonNull @NonNull @RequiresPermission(GET_ACCOUNTS) public Account[] getAccounts() { public Account[] getAccounts() { try { return getAccountsByType(null); return mService.getAccounts(null, mContext.getOpPackageName()); } catch (RemoteException e) { // won't ever happen throw new RuntimeException(e); } } } /** /** * @hide * @hide * Lists all accounts of any type registered on the device for a given * List every {@link Account} registered on the device for a specific User * user id. Equivalent to getAccountsByType(null). * that are managed by applications whose signatures match the caller. * * * <p>It is safe to call this method from the main thread. * <p><b>NOTE:</b> Apps declaring a {@code targetSdkVersion<=23} in their * manifests will continue to behave as they did on devices that support * API level 23. In particular the GET_ACCOUNTS permission is required to * see all the Accounts registered with the AccountManager for the * specified userId. See docs for this function in API level 23 for more * information. * * * <p>Clients of this method that have not been granted the * <p>This method can be called safely from the main thread. * {@link android.Manifest.permission#GET_ACCOUNTS} permission, * will only see those accounts managed by AbstractAccountAuthenticators whose * signature matches the client. * * * @return An array of {@link Account}, one for each account. Empty * @param int userId associated with the User whose accounts should be * (never null) if no accounts have been added. * queried. * @return Array of Accounts. The array may be empty if no accounts are * available to the caller. */ */ @NonNull @NonNull @RequiresPermission(GET_ACCOUNTS) public Account[] getAccountsAsUser(int userId) { public Account[] getAccountsAsUser(int userId) { try { try { return mService.getAccountsAsUser(null, userId, mContext.getOpPackageName()); return mService.getAccountsAsUser(null, userId, mContext.getOpPackageName()); Loading Loading @@ -501,10 +500,11 @@ public class AccountManager { /** /** * Returns the accounts visible to the specified package, in an environment where some apps * 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. * 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 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 * @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 * @return Array of Accounts. The array may be empty if no accounts of th * (never null) if no accounts of the specified type have been added. * specified type are visible to the caller. */ */ @NonNull @NonNull public Account[] getAccountsByTypeForPackage(String type, String packageName) { public Account[] getAccountsByTypeForPackage(String type, String packageName) { Loading @@ -518,29 +518,22 @@ public class AccountManager { } } /** /** * Lists all accounts of a particular type. The account type is a * List every {@link Account} of a specified type managed by applications * string token corresponding to the authenticator and useful domain * whose signatures match the caller. * of the account. For example, there are types corresponding to Google * and Facebook. The exact string token to use will be published somewhere * associated with the authenticator in question. * * * <p>It is safe to call this method from the main thread. * <p><b>NOTE:</b> Apps declaring a {@code targetSdkVersion<=23} in their * * manifests will continue to behave as they did on devices that support * <p>Clients of this method that have not been granted the * API level 23. See docs for this function in API level 23 for more * {@link android.Manifest.permission#GET_ACCOUNTS} permission, * information. * will only see those accounts managed by AbstractAccountAuthenticators whose * signature matches the client. * * * <p><b>NOTE:</b> If targeting your app to work on API level 22 and before, * <p>This method can be called safely from the main thread. * GET_ACCOUNTS permission is needed for those platforms, irrespective of uid * or signature match. See docs for this function in API level 22. * * * @param type The type of accounts to return, null to retrieve all accounts * @param type String denoting the type of the accounts to return, * @return An array of {@link Account}, one per matching account. Empty * {@code null} to retrieve all accounts visible to the caller. * (never null) if no accounts of the specified type have been added. * @return An array of Accounts. Empty (never null) if no accounts * are available to the caller. */ */ @NonNull @NonNull @RequiresPermission(GET_ACCOUNTS) public Account[] getAccountsByType(String type) { public Account[] getAccountsByType(String type) { return getAccountsByTypeAsUser(type, Process.myUserHandle()); return getAccountsByTypeAsUser(type, Process.myUserHandle()); } } Loading Loading @@ -586,6 +579,7 @@ public class AccountManager { * @return a future containing the label string * @return a future containing the label string * @hide * @hide */ */ @NonNull public AccountManagerFuture<String> getAuthTokenLabel( public AccountManagerFuture<String> getAuthTokenLabel( final String accountType, final String authTokenType, final String accountType, final String authTokenType, AccountManagerCallback<String> callback, Handler handler) { AccountManagerCallback<String> callback, Handler handler) { Loading Loading @@ -617,9 +611,13 @@ public class AccountManager { * <p>This method may be called from any thread, but the returned * <p>This method may be called from any thread, but the returned * {@link AccountManagerFuture} must not be used on the main thread. * {@link AccountManagerFuture} must not be used on the main thread. * * * <p>This method requires the caller to hold the permission * <p><b>Note:</b>The specified account must be managed by an application * {@link android.Manifest.permission#GET_ACCOUNTS} or be a signature * whose signature matches the caller. * match with the AbstractAccountAuthenticator that manages the account. * * <p><b>Further note:</b>Apps targeting API level 23 or earlier will continue to * behave as they did on devices that support API level 23. In particular * they may still require the GET_ACCOUNTS permission. See docs for this * function in API level 23. * * * @param account The {@link Account} to test * @param account The {@link Account} to test * @param features An array of the account features to check * @param features An array of the account features to check Loading @@ -629,8 +627,10 @@ public class AccountManager { * null for the main thread * null for the main thread * @return An {@link AccountManagerFuture} which resolves to a Boolean, * @return An {@link AccountManagerFuture} which resolves to a Boolean, * true if the account exists and has all of the specified features. * true if the account exists and has all of the specified features. * @throws SecurityException if the specified account is managed by an * application whose signature doesn't match the caller's signature. */ */ @RequiresPermission(GET_ACCOUNTS) @NonNull public AccountManagerFuture<Boolean> hasFeatures(final Account account, public AccountManagerFuture<Boolean> hasFeatures(final Account account, final String[] features, final String[] features, AccountManagerCallback<Boolean> callback, Handler handler) { AccountManagerCallback<Boolean> callback, Handler handler) { Loading @@ -651,9 +651,10 @@ public class AccountManager { /** /** * Lists all accounts of a type which have certain features. The account * Lists all accounts of a type which have certain features. The account * type identifies the authenticator (see {@link #getAccountsByType}). * type identifies the authenticator (see {@link #getAccountsByType}). Said * Account features are authenticator-specific string tokens identifying * authenticator must be in a package whose signature matches the callers * boolean account properties (see {@link #hasFeatures}). * package signature. Account features are authenticator-specific string tokens * identifying boolean account properties (see {@link #hasFeatures}). * * * <p>Unlike {@link #getAccountsByType}, this method calls the authenticator, * <p>Unlike {@link #getAccountsByType}, this method calls the authenticator, * which may contact the server or do other work to check account features, * which may contact the server or do other work to check account features, Loading @@ -662,19 +663,14 @@ public class AccountManager { * <p>This method may be called from any thread, but the returned * <p>This method may be called from any thread, but the returned * {@link AccountManagerFuture} must not be used on the main thread. * {@link AccountManagerFuture} must not be used on the main thread. * * * <p>Clients of this method that have not been granted the * <p><b>NOTE:</b> Apps targeting API level 23 or earlier will continue to * {@link android.Manifest.permission#GET_ACCOUNTS} permission, * behave as they did on devices that support API level 23. In particular * will only see those accounts managed by AbstractAccountAuthenticators whose * they may still require the GET_ACCOUNTS permission. See docs for this * signature matches the client. * function in API level 23. * * * @param type The type of accounts to return, must not be null * @param type The type of accounts to return, must not be null * @param features An array of the account features to require, * @param features An array of the account features to require, * may be null or empty * may be null or empty * * <p><b>NOTE:</b> If targeting your app to work on API level 22 and before, * GET_ACCOUNTS permission is needed for those platforms, irrespective of uid * or signature match. See docs for this function in API level 22. * * @param callback Callback to invoke when the request completes, * @param callback Callback to invoke when the request completes, * null for no callback * null for no callback * @param handler {@link Handler} identifying the callback thread, * @param handler {@link Handler} identifying the callback thread, Loading @@ -683,7 +679,7 @@ public class AccountManager { * {@link Account}, one per account of the specified type which * {@link Account}, one per account of the specified type which * matches the requested features. * matches the requested features. */ */ @RequiresPermission(GET_ACCOUNTS) @NonNull public AccountManagerFuture<Account[]> getAccountsByTypeAndFeatures( public AccountManagerFuture<Account[]> getAccountsByTypeAndFeatures( final String type, final String[] features, final String type, final String[] features, AccountManagerCallback<Account[]> callback, Handler handler) { AccountManagerCallback<Account[]> callback, Handler handler) { Loading
core/res/AndroidManifest.xml +2 −1 Original line number Original line Diff line number Diff line Loading @@ -1194,7 +1194,8 @@ <eat-comment /> <eat-comment /> <!-- Allows access to the list of accounts in the Accounts Service. <!-- Allows access to the list of accounts in the Accounts Service. <p>Protection level: normal <p>Protection level: dangerous @deprecated Not operative for apps apps with targetSdkVersion >= 24. --> --> <permission android:name="android.permission.GET_ACCOUNTS" <permission android:name="android.permission.GET_ACCOUNTS" android:permissionGroup="android.permission-group.CONTACTS" android:permissionGroup="android.permission-group.CONTACTS" Loading