共用方式為


DevicePolicyManager.SetKeyguardDisabledFeatures Method

Definition

Called by an application that is administering the device to disable keyguard customizations, such as widgets.

[Android.Runtime.Register("setKeyguardDisabledFeatures", "(Landroid/content/ComponentName;I)V", "GetSetKeyguardDisabledFeatures_Landroid_content_ComponentName_IHandler")]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_KEYGUARD")]
public virtual void SetKeyguardDisabledFeatures (Android.Content.ComponentName? admin, Android.App.Admin.KeyguardDisable which);
[<Android.Runtime.Register("setKeyguardDisabledFeatures", "(Landroid/content/ComponentName;I)V", "GetSetKeyguardDisabledFeatures_Landroid_content_ComponentName_IHandler")>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_KEYGUARD")>]
abstract member SetKeyguardDisabledFeatures : Android.Content.ComponentName * Android.App.Admin.KeyguardDisable -> unit
override this.SetKeyguardDisabledFeatures : Android.Content.ComponentName * Android.App.Admin.KeyguardDisable -> unit

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with. Null if the caller is not a device admin

which
KeyguardDisable

The disabled features flag which can be either #KEYGUARD_DISABLE_FEATURES_NONE (default), #KEYGUARD_DISABLE_FEATURES_ALL, or a combination of #KEYGUARD_DISABLE_WIDGETS_ALL, #KEYGUARD_DISABLE_SECURE_CAMERA, #KEYGUARD_DISABLE_SECURE_NOTIFICATIONS, #KEYGUARD_DISABLE_TRUST_AGENTS, #KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS, #KEYGUARD_DISABLE_FINGERPRINT, #KEYGUARD_DISABLE_FACE, #KEYGUARD_DISABLE_IRIS, #KEYGUARD_DISABLE_SHORTCUTS_ALL.

Attributes

Remarks

Called by an application that is administering the device to disable keyguard customizations, such as widgets. After setting this, keyguard features will be disabled according to the provided feature list.

A calling device admin must have requested DeviceAdminInfo#USES_POLICY_DISABLE_KEYGUARD_FEATURES to be able to call this method; if it has not, a security exception will be thrown.

Calling this from a managed profile before version android.os.Build.VERSION_CODES#M will throw a security exception. From version android.os.Build.VERSION_CODES#M the profile owner of a managed profile can set: <ul> <li>#KEYGUARD_DISABLE_TRUST_AGENTS, which affects the parent user, but only if there is no separate challenge set on the managed profile. <li>#KEYGUARD_DISABLE_FINGERPRINT, #KEYGUARD_DISABLE_FACE or #KEYGUARD_DISABLE_IRIS which affects the managed profile challenge if there is one, or the parent user otherwise. <li>#KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS which affects notifications generated by applications in the managed profile. </ul>

From version android.os.Build.VERSION_CODES#R the profile owner of an organization-owned managed profile can set: <ul> <li>#KEYGUARD_DISABLE_SECURE_CAMERA which affects the parent user when called on the parent profile. <li>#KEYGUARD_DISABLE_SECURE_NOTIFICATIONS which affects the parent user when called on the parent profile. </ul> #KEYGUARD_DISABLE_TRUST_AGENTS, #KEYGUARD_DISABLE_FINGERPRINT, #KEYGUARD_DISABLE_FACE, #KEYGUARD_DISABLE_IRIS, #KEYGUARD_DISABLE_SECURE_CAMERA and #KEYGUARD_DISABLE_SECURE_NOTIFICATIONS can also be set on the DevicePolicyManager instance returned by #getParentProfileInstance(ComponentName) in order to set restrictions on the parent profile. #KEYGUARD_DISABLE_SECURE_CAMERA can only be set on the parent profile instance if the calling device admin is the profile owner of an organization-owned managed profile.

Requests to disable other features on a managed profile will be ignored.

The admin can check which features have been disabled by calling #getKeyguardDisabledFeatures(ComponentName)

Java documentation for android.app.admin.DevicePolicyManager.setKeyguardDisabledFeatures(android.content.ComponentName, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to