Updated JavaDoc for getApplicationRestrictions

The method performs disk I/O and shouldn't be called on the main thread.

Bug: 28303952
Change-Id: Iab4d79158b32858baac4147ab73c6ac7aaa51b5b
This commit is contained in:
Fyodor Kupolov
2016-07-18 16:59:11 -07:00
parent be4eae9f9f
commit 4e9af06576
2 changed files with 13 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
import android.annotation.UserIdInt;
import android.annotation.WorkerThread;
import android.app.Activity;
import android.app.admin.SecurityLog.SecurityEvent;
import android.content.ComponentName;
@@ -4226,6 +4227,8 @@ public class DevicePolicyManager {
* owner, and the application restrictions managing package via
* {@link #getApplicationRestrictions}.
*
* <p>NOTE: The method performs disk I/O and shouldn't be called on the main thread
*
* @param admin Which {@link DeviceAdminReceiver} this request is associated with, or
* {@code null} if called by the application restrictions managing package.
* @param packageName The name of the package to update restricted settings for.
@@ -4235,6 +4238,7 @@ public class DevicePolicyManager {
* @see #setApplicationRestrictionsManagingPackage
* @see UserManager#KEY_RESTRICTIONS_PENDING
*/
@WorkerThread
public void setApplicationRestrictions(@Nullable ComponentName admin, String packageName,
Bundle settings) {
throwIfParentInstance("setApplicationRestrictions");
@@ -4981,6 +4985,8 @@ public class DevicePolicyManager {
* application restrictions via {@link #setApplicationRestrictionsManagingPackage}; otherwise a
* security exception will be thrown.
*
* <p>NOTE: The method performs disk I/O and shouldn't be called on the main thread
*
* @param admin Which {@link DeviceAdminReceiver} this request is associated with, or
* {@code null} if called by the application restrictions managing package.
* @param packageName The name of the package to fetch restricted settings of.
@@ -4990,6 +4996,7 @@ public class DevicePolicyManager {
* @throws SecurityException if {@code admin} is not a device or profile owner.
* @see {@link #setApplicationRestrictionsManagingPackage}
*/
@WorkerThread
public Bundle getApplicationRestrictions(@Nullable ComponentName admin, String packageName) {
throwIfParentInstance("getApplicationRestrictions");
if (mService != null) {

View File

@@ -23,6 +23,7 @@ import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.UserIdInt;
import android.annotation.WorkerThread;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManagerNative;
@@ -2072,12 +2073,15 @@ public class UserManager {
* <li>From {@link android.os.Build.VERSION_CODES#M}, {@code Bundle} or {@code Bundle[]}
* </ul>
*
* <p>NOTE: The method performs disk I/O and shouldn't be called on the main thread
*
* @param packageName the package name of the calling application
* @return a {@link Bundle} with the restrictions for that package, or an empty {@link Bundle}
* if there are no saved restrictions.
*
* @see #KEY_RESTRICTIONS_PENDING
*/
@WorkerThread
public Bundle getApplicationRestrictions(String packageName) {
try {
return mService.getApplicationRestrictions(packageName);
@@ -2089,6 +2093,7 @@ public class UserManager {
/**
* @hide
*/
@WorkerThread
public Bundle getApplicationRestrictions(String packageName, UserHandle user) {
try {
return mService.getApplicationRestrictionsForUser(packageName, user.getIdentifier());
@@ -2100,6 +2105,7 @@ public class UserManager {
/**
* @hide
*/
@WorkerThread
public void setApplicationRestrictions(String packageName, Bundle restrictions,
UserHandle user) {
try {