Improvements to Restrictions API

Convert restrictions provider to a service instead of a receiver.
Add a way to get pending responses from restrictions provider.
Add AbstractRestrictionsProvider.
Add a callback API for responses.

Removed some constants in RestrictionsManager.
Added new constants for errors and error codes.
Much improved javadocs.

Bug: 16176009

Change-Id: I838a50fabc80b94b632294b3a55cd5d8092acf55
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 6ea6b4b..7790640 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -19,6 +19,7 @@
 import android.annotation.SdkConstant;
 import android.annotation.SdkConstant.SdkConstantType;
 import android.app.Activity;
+import android.content.AbstractRestrictionsProvider;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -2661,19 +2662,19 @@
     }
 
     /**
-     * Designates a specific broadcast receiver component as the provider for
+     * Designates a specific service component as the provider for
      * making permission requests of a local or remote administrator of the user.
      * <p/>
      * Only a profile owner can designate the restrictions provider.
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
-     * @param receiver The component name of a BroadcastReceiver that handles the
-     * {@link RestrictionsManager#ACTION_REQUEST_PERMISSION} intent. If this param is null,
+     * @param provider The component name of the service that implements
+     * {@link AbstractRestrictionsProvider}. If this param is null,
      * it removes the restrictions provider previously assigned.
      */
-    public void setRestrictionsProvider(ComponentName admin, ComponentName receiver) {
+    public void setRestrictionsProvider(ComponentName admin, ComponentName provider) {
         if (mService != null) {
             try {
-                mService.setRestrictionsProvider(admin, receiver);
+                mService.setRestrictionsProvider(admin, provider);
             } catch (RemoteException re) {
                 Log.w(TAG, "Failed to set permission provider on device policy service");
             }