Most visited

Recently visited

Added in API level 8

DeviceAdminInfo

public final class DeviceAdminInfo
extends Object implements Parcelable

java.lang.Object
   ↳ android.app.admin.DeviceAdminInfo


This class is used to specify meta information of a device administrator component.

Summary

Constants

int USES_ENCRYPTED_STORAGE

A type of policy that this device admin can use: require encryption of stored data.

int USES_POLICY_DISABLE_CAMERA

A type of policy that this device admin can use: disables use of all device cameras.

int USES_POLICY_DISABLE_KEYGUARD_FEATURES

A type of policy that this device admin can use: disables use of keyguard features.

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.

int USES_POLICY_FORCE_LOCK

A type of policy that this device admin can use: able to force the device to lock vialockNow() or limit the maximum lock timeout for the device via setMaximumTimeToLock(ComponentName, long).

int USES_POLICY_LIMIT_PASSWORD

A type of policy that this device admin can use: limit the passwords that the user can select, via setPasswordQuality(ComponentName, int) and setPasswordMinimumLength(ComponentName, int).

int USES_POLICY_RESET_PASSWORD

A type of policy that this device admin can use: able to reset the user's password via resetPassword(String, int).

int USES_POLICY_WATCH_LOGIN

A type of policy that this device admin can use: able to watch login attempts from the user, via ACTION_PASSWORD_FAILED, ACTION_PASSWORD_SUCCEEDED, and getCurrentFailedPasswordAttempts().

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 wipeData(int).

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<DeviceAdminInfo> CREATOR

Used to make this class parcelable.

Public constructors

DeviceAdminInfo(Context context, ResolveInfo resolveInfo)

Constructor.

Public methods

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.

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.

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 writeToParcel(Parcel dest, int flags)

Used to package this object into a Parcel.

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Constants

USES_ENCRYPTED_STORAGE

Added in API level 11
int USES_ENCRYPTED_STORAGE

A type of policy that this device admin can use: require encryption of stored data.

To control this policy, the device admin must have a "encrypted-storage" tag in the "uses-policies" section of its meta-data.

Constant Value: 7 (0x00000007)

USES_POLICY_DISABLE_CAMERA

Added in API level 14
int USES_POLICY_DISABLE_CAMERA

A type of policy that this device admin can use: disables use of all device cameras.

To control this policy, the device admin must have a "disable-camera" tag in the "uses-policies" section of its meta-data.

Constant Value: 8 (0x00000008)

USES_POLICY_DISABLE_KEYGUARD_FEATURES

Added in API level 17
int USES_POLICY_DISABLE_KEYGUARD_FEATURES

A type of policy that this device admin can use: disables use of 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.

Constant Value: 9 (0x00000009)

USES_POLICY_EXPIRE_PASSWORD

Added in API level 11
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.

To control this policy, the device admin must have an "expire-password" tag in the "uses-policies" section of its meta-data.

Constant Value: 6 (0x00000006)

USES_POLICY_FORCE_LOCK

Added in API level 8
int USES_POLICY_FORCE_LOCK

A type of policy that this device admin can use: able to force the device to lock vialockNow() or limit the maximum lock timeout for the device via setMaximumTimeToLock(ComponentName, long).

To control this policy, the device admin must have a "force-lock" tag in the "uses-policies" section of its meta-data.

Constant Value: 3 (0x00000003)

USES_POLICY_LIMIT_PASSWORD

Added in API level 8
int USES_POLICY_LIMIT_PASSWORD

A type of policy that this device admin can use: limit the passwords that the user can select, via setPasswordQuality(ComponentName, int) and setPasswordMinimumLength(ComponentName, int).

To control this policy, the device admin must have a "limit-password" tag in the "uses-policies" section of its meta-data.

Constant Value: 0 (0x00000000)

USES_POLICY_RESET_PASSWORD

Added in API level 8
int USES_POLICY_RESET_PASSWORD

A type of policy that this device admin can use: able to reset the user's password via resetPassword(String, int).

To control this policy, the device admin must have a "reset-password" tag in the "uses-policies" section of its meta-data.

Constant Value: 2 (0x00000002)

USES_POLICY_WATCH_LOGIN

Added in API level 8
int USES_POLICY_WATCH_LOGIN

A type of policy that this device admin can use: able to watch login attempts from the user, via ACTION_PASSWORD_FAILED, ACTION_PASSWORD_SUCCEEDED, and getCurrentFailedPasswordAttempts().

To control this policy, the device admin must have a "watch-login" tag in the "uses-policies" section of its meta-data.

Constant Value: 1 (0x00000001)

USES_POLICY_WIPE_DATA

Added in API level 8
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 wipeData(int).

To control this policy, the device admin must have a "wipe-data" tag in the "uses-policies" section of its meta-data.

Constant Value: 4 (0x00000004)

Fields

CREATOR

Added in API level 8
Creator<DeviceAdminInfo> CREATOR

Used to make this class parcelable.

Public constructors

DeviceAdminInfo

Added in API level 8
DeviceAdminInfo (Context context, 
                ResolveInfo resolveInfo)

Constructor.

Parameters
context Context: The Context in which we are parsing the device admin.
resolveInfo ResolveInfo: The ResolveInfo returned from the package manager about this device admin's component.
Throws
XmlPullParserException
IOException

Public methods

describeContents

Added in API level 8
int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.

dump

Added in API level 8
void dump (Printer pw, 
                String prefix)

Parameters
pw Printer
prefix String

getActivityInfo

Added in API level 8
ActivityInfo getActivityInfo ()

Return the raw information about the receiver implementing this device admin. Do not modify the returned object.

Returns
ActivityInfo

getComponent

Added in API level 8
ComponentName getComponent ()

Return the component of the receiver that implements this device admin.

Returns
ComponentName

getPackageName

Added in API level 8
String getPackageName ()

Return the .apk package that implements this device admin.

Returns
String

getReceiverName

Added in API level 8
String getReceiverName ()

Return the class name of the receiver component that implements this device admin.

Returns
String

getTagForPolicy

Added in API level 8
String getTagForPolicy (int policyIdent)

Return the XML tag name for the given policy identifier. Valid identifiers are as per usesPolicy(int). If the given identifier is not known, null is returned.

Parameters
policyIdent int
Returns
String

isVisible

Added in API level 8
boolean isVisible ()

Returns whether this device admin would like to be visible to the user, even when it is not enabled.

Returns
boolean

loadDescription

Added in API level 8
CharSequence loadDescription (PackageManager pm)

Load user-visible description associated with this device admin.

Parameters
pm PackageManager: Supply a PackageManager used to load the device admin's resources.
Returns
CharSequence
Throws
Resources.NotFoundException

loadIcon

Added in API level 8
Drawable loadIcon (PackageManager pm)

Load the user-displayed icon for this device admin.

Parameters
pm PackageManager: Supply a PackageManager used to load the device admin's resources.
Returns
Drawable

loadLabel

Added in API level 8
CharSequence loadLabel (PackageManager pm)

Load the user-displayed label for this device admin.

Parameters
pm PackageManager: Supply a PackageManager used to load the device admin's resources.
Returns
CharSequence

toString

Added in API level 8
String toString ()

Returns a string representation of the object. In general, the 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())
 

Returns
String a string representation of the object.

usesPolicy

Added in API level 8
boolean usesPolicy (int policyIdent)

Return true if the device admin has requested that it be able to use the given policy control. The possible policy identifier inputs are: 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.

Parameters
policyIdent int
Returns
boolean

writeToParcel

Added in API level 8
void writeToParcel (Parcel dest, 
                int flags)

Used to package this object into a Parcel.

Parameters
dest Parcel: The Parcel to be written.
flags int: The flags used for parceling.

Hooray!