Share via


DevicePolicyManager.SetSecurityLoggingEnabled(ComponentName, Boolean) Method

Definition

Called by device owner or a profile owner of an organization-owned managed profile to control the security logging feature.

[Android.Runtime.Register("setSecurityLoggingEnabled", "(Landroid/content/ComponentName;Z)V", "GetSetSecurityLoggingEnabled_Landroid_content_ComponentName_ZHandler", ApiSince=24)]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_SECURITY_LOGGING")]
public virtual void SetSecurityLoggingEnabled (Android.Content.ComponentName? admin, bool enabled);
[<Android.Runtime.Register("setSecurityLoggingEnabled", "(Landroid/content/ComponentName;Z)V", "GetSetSecurityLoggingEnabled_Landroid_content_ComponentName_ZHandler", ApiSince=24)>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_SECURITY_LOGGING")>]
abstract member SetSecurityLoggingEnabled : Android.Content.ComponentName * bool -> unit
override this.SetSecurityLoggingEnabled : Android.Content.ComponentName * bool -> unit

Parameters

admin
ComponentName

Which device admin this request is associated with, or null if called by a delegated app.

enabled
Boolean

whether security logging should be enabled or not.

Attributes

Remarks

Called by device owner or a profile owner of an organization-owned managed profile to control the security logging feature.

Security logs contain various information intended for security auditing purposes. When security logging is enabled by any app other than the device owner, certain security logs are not visible (for example personal app launch events) or they will be redacted (for example, details of the physical volume mount events). Please see SecurityEvent for details.

<strong>Note:</strong> The device owner won't be able to retrieve security logs if there are unaffiliated secondary users or profiles on the device, regardless of whether the feature is enabled. Logs will be discarded if the internal buffer fills up while waiting for all users to become affiliated. Therefore it's recommended that affiliation ids are set for new users as soon as possible after provisioning via #setAffiliationIds. Non device owners are not subject to this restriction since all privacy-sensitive events happening outside the managed profile would have been redacted already.

Java documentation for android.app.admin.DevicePolicyManager.setSecurityLoggingEnabled(android.content.ComponentName, boolean).

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