다음을 통해 공유


DevicePolicyManager.UsbDataSignalingEnabled Property

Definition

Returns whether USB data signaling is currently enabled. -or- Called by a device owner or profile owner of an organization-owned managed profile to enable or disable USB data signaling for the device.

public virtual bool UsbDataSignalingEnabled { [Android.Runtime.Register("isUsbDataSignalingEnabled", "()Z", "GetIsUsbDataSignalingEnabledHandler", ApiSince=31)] get; [Android.Runtime.Register("setUsbDataSignalingEnabled", "(Z)V", "GetSetUsbDataSignalingEnabled_ZHandler", ApiSince=31)] [Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_USB_DATA_SIGNALLING")] set; }
[<get: Android.Runtime.Register("isUsbDataSignalingEnabled", "()Z", "GetIsUsbDataSignalingEnabledHandler", ApiSince=31)>]
[<set: Android.Runtime.Register("setUsbDataSignalingEnabled", "(Z)V", "GetSetUsbDataSignalingEnabled_ZHandler", ApiSince=31)>]
[<set: Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_USB_DATA_SIGNALLING")>]
member this.UsbDataSignalingEnabled : bool with get, set

Property Value

true if USB data signaling is enabled, false otherwise.

Attributes

Remarks

Property getter documentation:

Returns whether USB data signaling is currently enabled.

When called by a device owner or profile owner of an organization-owned managed profile, this API returns whether USB data signaling is currently enabled by that admin. When called by any other app, returns whether USB data signaling is currently enabled on the device.

Java documentation for android.app.admin.DevicePolicyManager.isUsbDataSignalingEnabled().

Property setter documentation:

Called by a device owner or profile owner of an organization-owned managed profile to enable or disable USB data signaling for the device. When disabled, USB data connections (except from charging functions) are prohibited.

This API is not supported on all devices, the caller should call #canUsbDataSignalingBeDisabled() to check whether enabling or disabling USB data signaling is supported on the device.

Starting from Android 15, after the USB data signaling policy has been set, PolicyUpdateReceiver#onPolicySetResult(Context, String, Bundle, TargetUser, PolicyUpdateResult) will notify the admin on whether the policy was successfully set or not. This callback will contain: <ul> <li> The TargetUser that this policy relates to <li> The PolicyUpdateResult, which will be PolicyUpdateResult#RESULT_POLICY_SET if the policy was successfully set or the reason the policy failed to be set e.g. PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY) </ul> If there has been a change to the policy, PolicyUpdateReceiver#onPolicyChanged(Context, String, Bundle, TargetUser, PolicyUpdateResult) will notify the admin of this change. This callback will contain the same parameters as PolicyUpdateReceiver#onPolicySetResult and the PolicyUpdateResult will contain the reason why the policy changed.

Java documentation for android.app.admin.DevicePolicyManager.setUsbDataSignalingEnabled(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