public final class DeviceAdminInfo extends Object implements Parcelable
Modifier and Type | Class and Description |
---|---|
static class |
DeviceAdminInfo.PolicyInfo |
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<DeviceAdminInfo> |
CREATOR
Used to make this class parcelable.
|
static int |
USES_ENCRYPTED_STORAGE
A type of policy that this device admin can use: require encryption of stored data.
|
static int |
USES_POLICY_DEVICE_OWNER
A type of policy that this device admin can use: device owner meta-policy
for an admin that is designated as owner of the device.
|
static int |
USES_POLICY_DISABLE_CAMERA
A type of policy that this device admin can use: disables use of all device cameras.
|
static int |
USES_POLICY_DISABLE_KEYGUARD_FEATURES
A type of policy that this device admin can use: disables use of keyguard features.
|
static int |
USES_POLICY_EXPIRE_PASSWORD
A type of policy that this device admin can use: force the user to
change their password after an administrator-defined time limit.
|
static int |
USES_POLICY_FORCE_LOCK
A type of policy that this device admin can use: able to force the device
to lock via
DevicePolicyManager.lockNow() or limit the
maximum lock timeout for the device via
DevicePolicyManager.setMaximumTimeToLock(android.content.ComponentName, long) . |
static int |
USES_POLICY_LIMIT_PASSWORD
A type of policy that this device admin can use: limit the passwords
that the user can select, via
DevicePolicyManager.setPasswordQuality(android.content.ComponentName, int)
and DevicePolicyManager.setPasswordMinimumLength(android.content.ComponentName, int) . |
static int |
USES_POLICY_PROFILE_OWNER
A type of policy that this device admin can use: profile owner meta-policy
for admins that have been installed as owner of some user profile.
|
static int |
USES_POLICY_RESET_PASSWORD
A type of policy that this device admin can use: able to reset the
user's password via
DevicePolicyManager.resetPassword(java.lang.String, int) . |
static int |
USES_POLICY_SETS_GLOBAL_PROXY
A type of policy that this device admin can use: able to specify the
device Global Proxy, via
DevicePolicyManager.setGlobalProxy(android.content.ComponentName, java.net.Proxy, java.util.List<java.lang.String>) . |
static int |
USES_POLICY_WATCH_LOGIN
A type of policy that this device admin can use: able to watch login
attempts from the user, via
DeviceAdminReceiver.ACTION_PASSWORD_FAILED ,
DeviceAdminReceiver.ACTION_PASSWORD_SUCCEEDED , and
DevicePolicyManager.getCurrentFailedPasswordAttempts() . |
static int |
USES_POLICY_WIPE_DATA
A type of policy that this device admin can use: able to factory
reset the device, erasing all of the user's data, via
DevicePolicyManager.wipeData(int) . |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
DeviceAdminInfo(Context context,
ActivityInfo activityInfo)
Constructor.
|
DeviceAdminInfo(Context context,
ResolveInfo resolveInfo)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
void |
dump(Printer pw,
String prefix) |
ActivityInfo |
getActivityInfo()
Return the raw information about the receiver implementing this
device admin.
|
ComponentName |
getComponent()
Return the component of the receiver that implements this device admin.
|
String |
getPackageName()
Return the .apk package that implements this device admin.
|
String |
getReceiverName()
Return the class name of the receiver component that implements
this device admin.
|
String |
getTagForPolicy(int policyIdent)
Return the XML tag name for the given policy identifier.
|
ArrayList<DeviceAdminInfo.PolicyInfo> |
getUsedPolicies() |
boolean |
isVisible()
Returns whether this device admin would like to be visible to the
user, even when it is not enabled.
|
CharSequence |
loadDescription(PackageManager pm)
Load user-visible description associated with this device admin.
|
Drawable |
loadIcon(PackageManager pm)
Load the user-displayed icon for this device admin.
|
CharSequence |
loadLabel(PackageManager pm)
Load the user-displayed label for this device admin.
|
void |
readPoliciesFromXml(XmlPullParser parser) |
String |
toString()
Returns a string representation of the object.
|
boolean |
usesPolicy(int policyIdent)
Return true if the device admin has requested that it be able to use
the given policy control.
|
void |
writePoliciesToXml(XmlSerializer out) |
void |
writeToParcel(Parcel dest,
int flags)
Used to package this object into a
Parcel . |
public static final int USES_POLICY_DEVICE_OWNER
public static final int USES_POLICY_PROFILE_OWNER
public static final int USES_POLICY_LIMIT_PASSWORD
DevicePolicyManager.setPasswordQuality(android.content.ComponentName, int)
and DevicePolicyManager.setPasswordMinimumLength(android.content.ComponentName, int)
.
To control this policy, the device admin must have a "limit-password" tag in the "uses-policies" section of its meta-data.
public static final int USES_POLICY_WATCH_LOGIN
DeviceAdminReceiver.ACTION_PASSWORD_FAILED
,
DeviceAdminReceiver.ACTION_PASSWORD_SUCCEEDED
, and
DevicePolicyManager.getCurrentFailedPasswordAttempts()
.
To control this policy, the device admin must have a "watch-login" tag in the "uses-policies" section of its meta-data.
public static final int USES_POLICY_RESET_PASSWORD
DevicePolicyManager.resetPassword(java.lang.String, int)
.
To control this policy, the device admin must have a "reset-password" tag in the "uses-policies" section of its meta-data.
public static final int USES_POLICY_FORCE_LOCK
DevicePolicyManager.lockNow()
or limit the
maximum lock timeout for the device via
DevicePolicyManager.setMaximumTimeToLock(android.content.ComponentName, long)
.
To control this policy, the device admin must have a "force-lock" tag in the "uses-policies" section of its meta-data.
public static final int USES_POLICY_WIPE_DATA
DevicePolicyManager.wipeData(int)
.
To control this policy, the device admin must have a "wipe-data" tag in the "uses-policies" section of its meta-data.
public static final int USES_POLICY_SETS_GLOBAL_PROXY
DevicePolicyManager.setGlobalProxy(android.content.ComponentName, java.net.Proxy, java.util.List<java.lang.String>)
.
To control this policy, the device admin must have a "set-global-proxy" tag in the "uses-policies" section of its meta-data.
public static final int USES_POLICY_EXPIRE_PASSWORD
To control this policy, the device admin must have an "expire-password" tag in the "uses-policies" section of its meta-data.
public static final int USES_ENCRYPTED_STORAGE
To control this policy, the device admin must have a "encrypted-storage" tag in the "uses-policies" section of its meta-data.
public static final int USES_POLICY_DISABLE_CAMERA
To control this policy, the device admin must have a "disable-camera" tag in the "uses-policies" section of its meta-data.
public static final int USES_POLICY_DISABLE_KEYGUARD_FEATURES
To control this policy, the device admin must have a "disable-keyguard-features" tag in the "uses-policies" section of its meta-data.
public static final Parcelable.Creator<DeviceAdminInfo> CREATOR
public DeviceAdminInfo(Context context, ResolveInfo resolveInfo) throws XmlPullParserException, IOException
context
- The Context in which we are parsing the device admin.resolveInfo
- The ResolveInfo returned from the package manager about
this device admin's component.XmlPullParserException
IOException
public DeviceAdminInfo(Context context, ActivityInfo activityInfo) throws XmlPullParserException, IOException
context
- The Context in which we are parsing the device admin.activityInfo
- The ActivityInfo returned from the package manager about
this device admin's component.XmlPullParserException
IOException
public String getPackageName()
public String getReceiverName()
public ActivityInfo getActivityInfo()
public ComponentName getComponent()
public CharSequence loadLabel(PackageManager pm)
pm
- Supply a PackageManager used to load the device admin's
resources.public CharSequence loadDescription(PackageManager pm) throws Resources.NotFoundException
pm
- Supply a PackageManager used to load the device admin's
resources.Resources.NotFoundException
public Drawable loadIcon(PackageManager pm)
pm
- Supply a PackageManager used to load the device admin's
resources.public boolean isVisible()
public boolean usesPolicy(int policyIdent)
USES_POLICY_LIMIT_PASSWORD
, USES_POLICY_WATCH_LOGIN
,
USES_POLICY_RESET_PASSWORD
, USES_POLICY_FORCE_LOCK
,
USES_POLICY_WIPE_DATA
,
USES_POLICY_EXPIRE_PASSWORD
, USES_ENCRYPTED_STORAGE
,
USES_POLICY_DISABLE_CAMERA
.public String getTagForPolicy(int policyIdent)
usesPolicy(int)
. If the given identifier is not
known, null is returned.public ArrayList<DeviceAdminInfo.PolicyInfo> getUsedPolicies()
public void writePoliciesToXml(XmlSerializer out) throws IllegalArgumentException, IllegalStateException, IOException
public void readPoliciesFromXml(XmlPullParser parser) throws XmlPullParserException, IOException
XmlPullParserException
IOException
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public void writeToParcel(Parcel dest, int flags)
Parcel
.writeToParcel
in interface Parcelable
dest
- The Parcel
to be written.flags
- The flags used for parceling.public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR