public class UserRestrictionsUtils extends Object
See UserManagerService
for the method suffixes.
Modifier and Type | Field and Description |
---|---|
static Set<String> |
USER_RESTRICTIONS |
Modifier and Type | Method and Description |
---|---|
static void |
applyUserRestrictions(Context context,
int userId,
Bundle newRestrictions,
Bundle prevRestrictions)
Takes a new use restriction set and the previous set, and apply the restrictions that have
changed.
|
static boolean |
areEqual(Bundle a,
Bundle b) |
static boolean |
canDeviceOwnerChange(String restriction) |
static boolean |
canProfileOwnerChange(String restriction,
int userId) |
static Bundle |
clone(Bundle in)
Creates a copy of the
in Bundle. |
static void |
dumpRestrictions(PrintWriter pw,
String prefix,
Bundle restrictions) |
static boolean |
isEmpty(Bundle in) |
static boolean |
isValidRestriction(String restriction)
Throws
IllegalArgumentException if the given restriction name is invalid. |
static void |
merge(Bundle dest,
Bundle in) |
static Bundle |
nonNull(Bundle in) |
static void |
readRestrictions(XmlPullParser parser,
Bundle restrictions) |
static void |
sortToGlobalAndLocal(Bundle in,
Bundle global,
Bundle local)
Takes restrictions that can be set by device owner, and sort them into what should be applied
globally and what should be applied only on the current user.
|
static void |
writeRestrictions(XmlSerializer serializer,
Bundle restrictions,
String tag) |
public static boolean isValidRestriction(String restriction)
IllegalArgumentException
if the given restriction name is invalid.public static void writeRestrictions(XmlSerializer serializer, Bundle restrictions, String tag) throws IOException
IOException
public static void readRestrictions(XmlPullParser parser, Bundle restrictions)
public static Bundle nonNull(Bundle in)
in
itself when it's not null, or an empty bundle (which can writable).public static boolean isEmpty(Bundle in)
public static Bundle clone(Bundle in)
in
Bundle. If in
is null, it'll return an empty
bundle.
The resulting Bundle
is always writable. (i.e. it won't return
Bundle.EMPTY
)
public static boolean canDeviceOwnerChange(String restriction)
public static boolean canProfileOwnerChange(String restriction, int userId)
public static void sortToGlobalAndLocal(Bundle in, Bundle global, Bundle local)
public static boolean areEqual(Bundle a, Bundle b)
public static void applyUserRestrictions(Context context, int userId, Bundle newRestrictions, Bundle prevRestrictions)
Note this method is called by UserManagerService
without holding any locks.
public static void dumpRestrictions(PrintWriter pw, String prefix, Bundle restrictions)