Merge "Add DPM.getUserRestrictions()"

This commit is contained in:
Makoto Onuki
2015-11-06 18:32:35 +00:00
committed by Android (Google) Code Review
6 changed files with 69 additions and 0 deletions

View File

@@ -3636,6 +3636,28 @@ public class DevicePolicyManager {
}
}
/**
* Called by a profile or device owner to get user restrictions set with
* {@link #addUserRestriction(ComponentName, String)}.
* <p>
* The target user may have more restrictions set by the system or other device owner / profile
* owner. To get all the user restrictions currently set, use
* {@link UserManager#getUserRestrictions()}.
*
* @param admin Which {@link DeviceAdminReceiver} this request is associated with.
*/
public Bundle getUserRestrictions(@NonNull ComponentName admin) {
Bundle ret = null;
if (mService != null) {
try {
ret = mService.getUserRestrictions(admin);
} catch (RemoteException e) {
Log.w(TAG, "Failed talking with device policy service", e);
}
}
return ret == null ? new Bundle() : ret;
}
/**
* Called by profile or device owners to hide or unhide packages. When a package is hidden it
* is unavailable for use, but the data and actual package file remain.

View File

@@ -147,6 +147,7 @@ interface IDevicePolicyManager {
ComponentName getRestrictionsProvider(int userHandle);
void setUserRestriction(in ComponentName who, in String key, boolean enable);
Bundle getUserRestrictions(in ComponentName who);
void addCrossProfileIntentFilter(in ComponentName admin, in IntentFilter filter, int flags);
void clearCrossProfileIntentFilters(in ComponentName admin);