edm新增禁止使用usb的设备类型

Signed-off-by: h30034439 <hanyiyichn@163.com>
This commit is contained in:
h30034439 2024-08-12 21:25:50 +08:00
parent 5e53a2d795
commit c7eed67703

View File

@ -96,6 +96,84 @@ declare namespace usbManager {
productId: number;
}
/**
* USB Descriptor
*
* @enum { number }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 13
*/
enum Descriptor {
/**
* Interface descriptor
*
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 13
*/
INTERFACE = 0,
/**
* Device descriptor
*
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 13
*/
DEVICE = 1
}
/**
* USB device Type.
*
* @typedef UsbDeviceType
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 13
*/
export interface UsbDeviceType {
/**
* The base class in USB class code information.
*
* @type { number }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 13
*/
baseClass: number;
/**
* The subclass in USB class code information.
*
* @type { number }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 13
*/
subClass: number;
/**
* The protocol in USB class code information.
*
* @type { number }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 13
*/
protocol: number;
/**
* The descriptor that the class code is used in.
*
* @type { Descriptor }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 13
*/
descriptor: Descriptor;
}
/**
* Set usb policy by {@link UsbPolicy}.
* This function can be called by a super administrator.
@ -281,6 +359,66 @@ declare namespace usbManager {
* @since 12
*/
function getUsbStorageDeviceAccessPolicy(admin: Want): UsbPolicy;
/**
* Adds disallowed USB devices by {@link UsbDeviceType} array.
* This function can be called by a super administrator.
*
* @permission ohos.permission.ENTERPRISE_MANAGE_USB
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* The admin must have the corresponding permission.
* @param { Array<UsbDeviceType> } usbDevices - list of USB device types.
* The size of the array after setting cannot be greater 1000.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 9200010 - A conflict policy has been configured.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 13
*/
function addDisallowedUsbDevices(admin: Want, usbDevices: Array<UsbDeviceType>): void;
/**
* Removes disallowed USB devices by {@link UsbDeviceType} array.
* This function can be called by a super administrator.
*
* @permission ohos.permission.ENTERPRISE_MANAGE_USB
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* The admin must have the corresponding permission.
* @param { Array<UsbDeviceType> } usbDevices - list of USB device types.
* The size of the array after setting cannot be greater 1000.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 13
*/
function removeDisallowedUsbDevices(admin: Want, usbDevices: Array<UsbDeviceType>): void;
/**
* Gets the disallowed USB devices list.
* This function can be called by a super administrator.
*
* @permission ohos.permission.ENTERPRISE_MANAGE_USB
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* The admin must have the corresponding permission.
* @returns { Array<UsbDeviceType> } USB device types that are disallowed.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 13
*/
function getDisallowedUsbDevices(admin: Want): Array<UsbDeviceType>;
}
export default usbManager;