OSDN Git Service

Updated JavaDoc for getApplicationRestrictions
authorFyodor Kupolov <fkupolov@google.com>
Mon, 18 Jul 2016 23:59:11 +0000 (16:59 -0700)
committerFyodor Kupolov <fkupolov@google.com>
Tue, 19 Jul 2016 17:28:31 +0000 (10:28 -0700)
The method performs disk I/O and shouldn't be called on the main thread.

Bug: 28303952
Change-Id: Iab4d79158b32858baac4147ab73c6ac7aaa51b5b

core/java/android/app/admin/DevicePolicyManager.java
core/java/android/os/UserManager.java

index 6e58f09..6176652 100644 (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) {
index b9193b2..f893896 100644 (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 {