From f0bb0e65de9e81cf66a6a6fce4d9c8315ceaac91 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 9 Jun 2023 16:33:51 +0800 Subject: [PATCH] update doc Signed-off-by: shawn_he --- .../reference/apis/js-apis-logs.md | 39 ++++- .../changelogs-geoLocationManager.md | 18 +++ .../v4.0-beta1/changelogs-global.md | 142 ++++++++++++++++++ .../changelogs/v4.0-beta1/changelogs-power.md | 82 ++++++++++ .../v4.0-beta1/changelogs-startup.md | 15 ++ .../v4.0-beta1/changelogs-telephony.md | 129 ++++++++++++++++ .../changelogs/v4.0-beta1/changelogs-usb.md | 88 +++++++++++ 7 files changed, 508 insertions(+), 5 deletions(-) create mode 100644 en/release-notes/changelogs/v4.0-beta1/changelogs-geoLocationManager.md create mode 100644 en/release-notes/changelogs/v4.0-beta1/changelogs-global.md create mode 100644 en/release-notes/changelogs/v4.0-beta1/changelogs-power.md create mode 100644 en/release-notes/changelogs/v4.0-beta1/changelogs-startup.md create mode 100644 en/release-notes/changelogs/v4.0-beta1/changelogs-telephony.md create mode 100644 en/release-notes/changelogs/v4.0-beta1/changelogs-usb.md diff --git a/en/application-dev/reference/apis/js-apis-logs.md b/en/application-dev/reference/apis/js-apis-logs.md index fa73f169b2..cfe6c2198b 100644 --- a/en/application-dev/reference/apis/js-apis-logs.md +++ b/en/application-dev/reference/apis/js-apis-logs.md @@ -12,6 +12,8 @@ debug(message: string, ...arguments: any[]): void Prints debugging information in formatted output mode. +Since API version 9, this API is supported in ArkTS widgets. + **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** @@ -19,9 +21,10 @@ Prints debugging information in formatted output mode. | Name | Type | Mandatory | Description | | ------- | ------ | ---- | ----------- | | message | string | Yes | Text to be printed.| -| arguments | any | No | Arguments in the message or other information to be printed.| +| arguments | any[] | No | Arguments in the message or other information to be printed.| **Example** + ```js const number = 5; console.debug('count: %d', number); // Print the debugging information with arguments in the message replaced. @@ -38,6 +41,8 @@ log(message: string, ...arguments: any[]): void Prints log information in formatted output mode. +Since API version 9, this API is supported in ArkTS widgets. + **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** @@ -45,9 +50,10 @@ Prints log information in formatted output mode. | Name | Type | Mandatory | Description | | ------- | ------ | ---- | ----------- | | message | string | Yes | Text to be printed.| -| arguments | any | No |Arguments in the message or other information to be printed.| +| arguments | any[] | No |Arguments in the message or other information to be printed.| **Example** + ```js const number = 5; console.log('count: %d', number); // Print the log information with arguments in the message replaced. @@ -64,6 +70,8 @@ info(message: string, ...arguments: any[]): void Prints log information in formatted output mode. This API is the alias of **console.log ()**. +Since API version 9, this API is supported in ArkTS widgets. + **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** @@ -71,9 +79,10 @@ Prints log information in formatted output mode. This API is the alias of **cons | Name | Type | Mandatory | Description | | ------- | ------ | ---- | ----------- | | message | string | Yes | Text to be printed.| -| arguments | any | No | Arguments in the message or other information to be printed.| +| arguments | any[] | No | Arguments in the message or other information to be printed.| **Example** + ```js const number = 5; console.info('count: %d', number); // Print the log information with arguments in the message replaced. @@ -90,6 +99,8 @@ warn(message: string, ...arguments: any[]): void Prints warning information in formatted output mode. +Since API version 9, this API is supported in ArkTS widgets. + **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** @@ -97,9 +108,10 @@ Prints warning information in formatted output mode. | Name | Type | Mandatory | Description | | ------- | ------ | ---- | ----------- | | message | string | Yes | Warning information to be printed.| -| arguments | any | No | Arguments in the message or other information to be printed.| +| arguments | any[] | No | Arguments in the message or other information to be printed.| **Example** + ```js const str = "name should be string"; console.warn('warn: %d', str); // Print the warning information with arguments in the message replaced. @@ -116,6 +128,8 @@ error(message: string, ...arguments: any[]): void Prints error information in formatted output mode. +Since API version 9, this API is supported in ArkTS widgets. + **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** @@ -123,10 +137,11 @@ Prints error information in formatted output mode. | Name | Type | Mandatory | Description | | ------- | ------ | ---- | ----------- | | message | string | Yes | Error information to be printed.| -| arguments | any | No | Arguments in the message or other information to be printed.| +| arguments | any[] | No | Arguments in the message or other information to be printed.| **Example** + ```js const str = "value is not defined"; console.error('error: %d', str); // Print the error information with arguments in the message replaced. @@ -153,6 +168,7 @@ Prints assertion information. | arguments | Object | No | Other information to be printed when **value** is **false**. If this parameter is left blank, other information is not printed.| **Example** + ```js console.assert(true, 'does nothing'); // Do not print error information as value is true. console.assert(2% 1 == 0,'does nothing'); // Do not print error information as value is true. @@ -180,6 +196,7 @@ Maintains an internal counter. When this counter is invoked, its label name and **Example** + ```js console.count() // default: 1 @@ -210,6 +227,7 @@ Resets a counter based on the specified label name. | label | string | No | Counter label name. The default value is **default**.| **Example** + ```js console.count('abc'); // abc: 1 @@ -234,6 +252,7 @@ Prints content of the specified object. **Example** + ```js let a = { foo: { bar: { baz: true } }}; console.dir(a); @@ -258,6 +277,7 @@ Displays an interactive tree of the descendant elements of the specified XML ele | arguments | Object | Yes | Information to be printed.| **Example** + ```js const number = 5; console.dirxml('count: %d', number); @@ -284,6 +304,7 @@ If the information to be printed is provided, the information is printed without | arguments | Object | No | Information to be printed.| **Example** + ```js console.log("outter"); // outter @@ -313,6 +334,7 @@ Creates a new inline group in collapsed mode. The usage and function of this API **Example** + ```js console.groupCollapsed("outter"); // outter @@ -335,6 +357,7 @@ Reduces the indentation of subsequent lines by two spaces. **Example** + ```js console.log("outter"); // outter @@ -362,6 +385,7 @@ Prints data in a table. | tableData | Object | No | Data to be printed in a table. If this parameter is left blank, no information is printed.| **Example** + ```js console.table([1, 2, 3]); // ┌─────────┬────────┐ @@ -382,6 +406,7 @@ console.table({ a: [1, 2, 3, 4, 5], b: 5, c: { e: 5 } }); // │ c │ │ │ │ │ │ 5 │ │ // └─────────┴───┴───┴───┴───┴───┴───┴────────┘ ``` + ## console.time10+ time(label?: string): void @@ -397,6 +422,7 @@ Starts a timer to track the duration of an operation. You can use **console.time | label | string | No | Timer label. The default value is **default**.| **Example** + ```js console.time('abc'); ``` @@ -416,6 +442,7 @@ Stops the timer started by calling **console.time()** and prints the elapsed tim | label | string | No | Timer label. The default value is **default**.| **Example** + ```js console.time('abc'); console.timeEnd('abc'); @@ -438,6 +465,7 @@ Prints the elapsed time and other data parameters for the timer started by **con | arguments | Object | No | Logs to be printed.| **Example** + ```js console.time('timer1'); console.timeLog('timer1', 17); @@ -461,6 +489,7 @@ Creates a stack trace. | arguments | Object | No | Logs to be printed. If this parameter is left blank, only stack information is printed.| **Example** + ```js console.trace(); // Trace: diff --git a/en/release-notes/changelogs/v4.0-beta1/changelogs-geoLocationManager.md b/en/release-notes/changelogs/v4.0-beta1/changelogs-geoLocationManager.md new file mode 100644 index 0000000000..ff154cc676 --- /dev/null +++ b/en/release-notes/changelogs/v4.0-beta1/changelogs-geoLocationManager.md @@ -0,0 +1,18 @@ +# Location Subsystem Changelog + +## cl.location.1 Deletion of the geoLocationManager.requestEnableLocation API in API Version 9 + +When the location function is disabled, your application can call the **geoLocationManager.requestEnableLocation** API to request the user to enable the location function. However, this API is seldom used, and user experience for this API is not very good because the user is not notified of the scenario in which your application uses the location information. + +Therefore, your app shows a popup, asking the user to go to the settings page and enable the location function. In addition, the popup clearly states the scenarios in which the location information will be used, improving user experience. + +**Change Impact** + +Your application cannot use the **geoLocationManager.requestEnableLocation** API in API version 9 to request the user to enable the location function. Instead, you need to implement a popup asking the user to enable the location function for your application. + +**Key API/Component Changes** + +| Class| API Type| Declaration| Change Type| +| -- | -- | -- | -- | +|geoLocationManager| method | function requestEnableLocation(callback: AsyncCallback<boolean>): void; | Deleted from API version 9. | +|geoLocationManager| method | function requestEnableLocation(): Promise<boolean>; | Deleted from API version 9. | diff --git a/en/release-notes/changelogs/v4.0-beta1/changelogs-global.md b/en/release-notes/changelogs/v4.0-beta1/changelogs-global.md new file mode 100644 index 0000000000..d413e1c27a --- /dev/null +++ b/en/release-notes/changelogs/v4.0-beta1/changelogs-global.md @@ -0,0 +1,142 @@ +# Globalization Subsystem Changelog + +## cl.global.1 Runtime Authentication Added for System APIs + +The internationalization component of the globalization subsystem adds runtime authentication for system APIs in certain scenarios. The following changes are made in API version 9 and later: + - Setting the system language, country or region, and area + - Setting the 24-hour format of the system + - Adding and removing the preferred language + - Setting localized numbers + +You need to adapt your application based on the following information. + +**Change Impact** + +APIs involved in the preceding scenarios can be properly called only by system applications that have the **UPDATE_CONFIGURATION** permission. + +**Key API/Component Changes** + + - Involved APIs: + - setSystemLanguage(language: string): void; + - setSystemRegion(region: string): void; + - setSystemLocale(locale: string): void; + - set24HourClock(option: boolean): void; + - addPreferredLanguage(language: string, index?: number): void; + - removePreferredLanguage(index: number): void; + - setUsingLocalDigit(flag: boolean): void; + +**Adaptation Guide** + +Make sure the application trying to call any of the above APIs is a system application. Non-system applications are not allowed to call the APIs. +An exception will be thrown upon lack of a necessary permission or a call request from a non-system application. The exception can be captured via **try-catch**. + +```js +import I18n from '@ohos.i18n' + +try { + I18n.System.setSystemLanguage('zh'); +} catch(error) { + console.error(`call System.setSystemLanguage failed, error code: ${error.code}, message: ${error.message}.`) +} +``` + + +## cl.resourceManager.1 Change in the Meaning of the Return Value for the API Used to Obtain the rawfile Descriptor + +Changed the meaning of the return value for the API used to obtain the rawfile descriptor after the non-decompression feature is added in this version. The change in the meaning of the return value, namely, **descriptor: RawFileDescriptor {fd, offset, length}**, is described as follows: + +**Before change:** + +**fd**: file descriptor for accessing the rawfile. + +**offset**: offset for accessing the rawfile. In this case, the value is **0**. + +**length**: size of the rawfile to access. + +**After change:** + +**fd**: file descriptor for accessing the HAP where the rawfile is located. + +**offset**: offset of the accessed rawfile relative to the HAP. + +**length**: size of the rawfile to access. + +**Change Impact** + +In versions earlier than 4.0.2.2, the rawfile can be accessed only through **fd**. In version 4.0.2.2 or later, the rawfile can be accessed only through **{fd, offset, and length}**. + +**Key API/Component Changes** + + - Involved APIs: + - getRawFd(path: string, callback: AsyncCallback\): void + - getRawFd(path: string): Promise\ + - getRawFileDescriptor(path: string, callback: AsyncCallback\): void + - getRawFileDescriptor(path: string): Promise\ + +**Sample Code** + +The following is an example of calling the **getRawFd** API: +``` +try { + this.context.resourceManager.getRawFd("test.ogg", (error, value) => { + if (error != null) { + console.log(`callback getRawFd failed error code: ${error.code}, message: ${error.message}.`); + } else { + let fileDescriptor = { + fd = value.fd, + offset = value.offset, + length = value.length + } + this.avPlayer.fdSrc(fileDescriptor); // Take the audio player as an example. When calling fdSrc, pass fileDescriptor in addition to fd. + } + }); + } catch (error) { + console.error(`callback getRawFd failed, error code: ${error.code}, message: ${error.message}.`) + }; +``` + + +## cl.resourceManager.2 Addition of getStringSync and getStringByNameSync APIs + +Added the **getStringSync** and **getStringByNameSync** APIs and error codes to obtain and format strings. + +| Bundle Name | API | +| --------------- | ---------------------------------------------------- | +| ohos.resourceManager.d.ts | getStringSync(resId: number, ...args: Array): string; | +| ohos.resourceManager.d.ts | getStringSync(resource: Resource, ...args: Array): string; | +| ohos.resourceManager.d.ts | getStringByNameSync(resName: string, ...args: Array): string; | + +**Change Impact** + +In versions earlier than 4.0.6.2, only the values of string resources can be directly obtained. In 4.0.6.2 or later, the values of string resources can be formatted based on the input arguments for enhanced query. + +The following error codes are added: + +9001007 If the resource obtained by resId formatting error. + +9001008 If the resource obtained by resName formatting error. + +**Sample Code** + +The following uses **getStringSync** as an example. Before the change, only example 1 is supported. After the change, both example 1 and example 2 are supported. +``` +Example 1: +try { + this.context.resourceManager.getStringSync($r('app.string.test').id); +} catch (error) { + console.error(`getStringSync failed, error code: ${error.code}, message: ${error.message}.`) +} +Example 2: +try { + this.context.resourceManager.getStringSync($r('app.string.test').id, "format string", 787, 98.78); +} catch (error) { + console.error(`getStringSync failed, error code: ${error.code}, message: ${error.message}.`) +} +``` + +**Adaptation Guide** +For details, see the API reference. + +[API Reference](../../../application-dev/reference/apis/js-apis-resource-manager.md) + +[Error Codes](../../../application-dev/reference/errorcodes/errorcode-resource-manager.md) diff --git a/en/release-notes/changelogs/v4.0-beta1/changelogs-power.md b/en/release-notes/changelogs/v4.0-beta1/changelogs-power.md new file mode 100644 index 0000000000..b1d535a6fd --- /dev/null +++ b/en/release-notes/changelogs/v4.0-beta1/changelogs-power.md @@ -0,0 +1,82 @@ +# Power Subsystem Changelog + +## cl.powermgr.1 CommonEventBatteryChangedCode API Change + +Changed the **CommonEventBatteryChangedCode** enum class in [@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) as follows: + +- Changed the class name to **CommonEventBatteryChangedKey**. +- Deleted **EXTRA_MAX_CURRENT**, **EXTRA_MAX_VOLTAGE**, and **EXTRA_CHARGE_COUNTER**. +- Changed the enum value type from numeric to string. + +#### **Change Impact** + +The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. + +#### Key API/Component Changes + +Before change: + +| Name | Value | Description | +| -------------------- | ---- | -------------------------------------------------- | +| EXTRA_SOC | 0 | Remaining battery level in percentage. | +| EXTRA_VOLTAGE | 1 | Battery voltage of the device. | +| EXTRA_TEMPERATURE | 2 | Battery temperature of the device. | +| EXTRA_HEALTH_STATE | 3 | Battery health status of the device. | +| EXTRA_PLUGGED_TYPE | 4 | Type of the charger connected to the device. | +| EXTRA_MAX_CURRENT | 5 | Maximum battery current of the device. | +| EXTRA_MAX_VOLTAGE | 6 | Maximum battery voltage of the device. | +| EXTRA_CHARGE_STATE | 7 | Battery charging status of the device. | +| EXTRA_CHARGE_COUNTER | 8 | Number of battery charging times of the device. | +| EXTRA_PRESENT | 9 | Whether the battery is supported by the device or installed.| +| EXTRA_TECHNOLOGY | 10 | Battery technology of the device. | +| EXTRA_CAPACITY_LEVEL | 11 | Battery level of the device. | + +After change: + +| Name | Value | Description | +| -------------------- | --------------- | -------------------------------------------------- | +| EXTRA_SOC | "soc" | Remaining battery level in percentage. | +| EXTRA_CHARGE_STATE | "chargeState" | Battery charging status of the device. | +| EXTRA_HEALTH_STATE | "healthState" | Battery health status of the device. | +| EXTRA_PLUGGED_TYPE | "pluggedType" | Type of the charger connected to the device. | +| EXTRA_VOLTAGE | "voltage" | Battery voltage of the device. | +| EXTRA_TECHNOLOGY | "technology" | Battery technology of the device. | +| EXTRA_TEMPERATURE | "temperature" | Battery temperature of the device. | +| EXTRA_PRESENT | "present" | Whether the battery is supported by the device or installed.| +| EXTRA_CAPACITY_LEVEL | "capacityLevel" | Battery level of the device. | + +#### Adaptation Guide + +For details, see the API reference of the [@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) API. +## cl.powermgr.2 estimatedRemainingChargeTime API Change + +Changed the **estimatedRemainingChargeTime** API in [@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) to a system API. + +#### **Change Impact** + +The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. + +#### Adaptation Guide + +For details, see the API reference of the [@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) API. + +## cl.powermgr.3 System Common Event Behavior Change + +The following common events are provided in the battery information through [@ohos.commonEventManager (common event module)](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-commonEventManager.md): + +- COMMON_EVENT_BATTERY_LOW: common event for low battery level. It includes the remaining battery in percentage. +- COMMON_EVENT_BATTERY_OKAY: common event for normal battery level. It includes the remaining battery in percentage. +- COMMON_EVENT_POWER_CONNECTED: common event for connection to an external power supply. It includes the type of the power supply to which the device is connected. +- COMMON_EVENT_POWER_DISCONNECTED: common event for disconnection from an external power supply. It includes the type of the power supply from which the device is disconnected. +- COMMON_EVENT_CHARGING: common event for starting of battery charging. It includes the battery charging status. +- COMMON_EVENT_DISCHARGING: common event for ending of battery charging. It includes the battery charging status. + +Changed the method of obtaining data from common events from **CommonEventData.data** to **CommonEventData.code**. + +#### **Change Impact** + +The application developed based on earlier versions needs to adapt the method for obtaining common events in the battery information. Otherwise, the original service logic will be affected. + +#### Adaptation Guide + +For details, see the API reference of the [@ohos.commonEventManager (Common Event Manager)](../../../application-dev/reference/apis/js-apis-commonEventManager.md) API. diff --git a/en/release-notes/changelogs/v4.0-beta1/changelogs-startup.md b/en/release-notes/changelogs/v4.0-beta1/changelogs-startup.md new file mode 100644 index 0000000000..506d8dcccc --- /dev/null +++ b/en/release-notes/changelogs/v4.0-beta1/changelogs-startup.md @@ -0,0 +1,15 @@ +# Startup Subsystem JS API Changelog + +## cl.startup.1 Bundle Name Change + +**Change Impact** + +The original bundle name **@ohos.systemParameterV9** will be deleted and cannot be used anymore. Use the new bundle name **@ohos.systemParameterEnhance** instead. + +**Adaptation Guide** + +Change the bundle name from **@ohos.systemParameterV9** to **@ohos.systemParameterEnhance**. The APIs remain unchanged. The following is the sample code: + +```js +import @ohos.systemParameterEnhance +``` diff --git a/en/release-notes/changelogs/v4.0-beta1/changelogs-telephony.md b/en/release-notes/changelogs/v4.0-beta1/changelogs-telephony.md new file mode 100644 index 0000000000..d0666692fa --- /dev/null +++ b/en/release-notes/changelogs/v4.0-beta1/changelogs-telephony.md @@ -0,0 +1,129 @@ +# Telephony Subsystem Changelog + + + +## cl.telephony.radio.1 isNrSupported API Change + + +NR is a proper noun and must be capitalized. + +You need to adapt your application based on the following information. + + + +**Change Impact** + +The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. + + + +**Key API/Component Changes** + +- Involved APIs: + + isNrSupported(): boolean; + isNrSupported(slotId: number): boolean; + +- Before change: + +```js +function isNrSupported(): boolean; +function isNrSupported(slotId: number): boolean; +``` + +- After change: + +```js +function isNRSupported(): boolean; +function isNRSupported(slotId: number): boolean; +``` + + + +**Adaptation Guide** + +Use the new API. The sample code is as follows: + +```js +let result = radio.isNrSupported(); +console.log("Result: "+ result); +``` + + +```js +let slotId = 0; +let result = radio.isNRSupported(slotId); +console.log("Result: "+ result); +``` + + +## cl.telephony.call.2 dial API Change + +Changed the `dial` API to the `dialCall` API in the call module of the telephony subsystem since API version 9. + +You need to adapt your application based on the following information. + + +**Change Impact** + +The `dial` API is deprecated and cannot be used anymore. Use the `dialCall` API instead. Otherwise, relevant functions will be affected. + + +**Key API/Component Changes** + +- Involved APIs: + + dial(phoneNumber: string, callback: AsyncCallback): void; + dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback): void; + dial(phoneNumber: string, options?: DialOptions): Promise; + +- Before change: + +```js +function dial(phoneNumber: string, callback: AsyncCallback): void; +function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback): void; +function dial(phoneNumber: string, options?: DialOptions): Promise; +``` + +- After change: + +```js +function dialCall(phoneNumber: string, callback: AsyncCallback): void; +function dialCall(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback): void; +function dialCall(phoneNumber: string, options?: DialCallOptions): Promise; +``` + + + +**Adaptation Guide** + +The `dial` API is deprecated and cannot be used anymore. Use the `dialCall` API instead. +Use the new API. The sample code is as follows: + +```js +call.dialCall("138xxxxxxxx", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +```js +call.dialCall("138xxxxxxxx", { + accountId: 0, + videoState: 0, + dialScene: 0, + dialType: 0, +}, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +```js +try { + call.dialCall('138xxxxxxxx'); + console.log(`dialCall success, promise: data->${JSON.stringify(data)}`); +} catch (error) { + console.log(`dialCall fail, promise: err->${JSON.stringify(error)}`); +} +``` diff --git a/en/release-notes/changelogs/v4.0-beta1/changelogs-usb.md b/en/release-notes/changelogs/v4.0-beta1/changelogs-usb.md new file mode 100644 index 0000000000..ef356a16b3 --- /dev/null +++ b/en/release-notes/changelogs/v4.0-beta1/changelogs-usb.md @@ -0,0 +1,88 @@ +# USB Subsystem API Changelog + +## cl.usb_manager.1 System API Change + +Runtime authentication is performed for system APIs of the USB manager. An asynchronous API throws an error code via **Promise.reject**. + +If your application is developed based on earlier versions, modify the return values of functions. Otherwise, the original service logic will be affected. + +**Key API/Component Changes** + +| Bundle Name | Original API | New API | +| --------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| ohos.usbV9.d.ts | function setCurrentFunctions(funcs: FunctionType): Promise; | function setCurrentFunctions(funcs: FunctionType): Promise; | +| ohos.usbV9.d.ts | function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise; | function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise; | + +## cl.usb_manager.2 SDK API Deletion + +The **@ohos.usbV9.d.ts** file was deleted in OpenHarmony 4.0.5.5. + +You need to import **@ohos.usbManager** to use USB service APIs. + + ```ts + import usbManager from '@ohos.usbManager'; + ``` + +**Adaptation Guide** + +For details, see the [API Reference](../../../application-dev/reference/apis/js-apis-usbManager.md). + + +## cl.usb_manager.2 Bundle Name Change + +For applications developed based on earlier versions, you need to change the name of the imported bundle. Otherwise, the original service logic will be affected. + +**Key API/Component Changes** + +| Original Bundle | New Bundle | +|------------------ | ------------------- | +| ohos.usbV9.d.ts | ohos.usbManager.d.ts | + +**Adaptation Guide** + +Change **@ohos.usbV9** to **@ohos.usbManager** when importing the bundle. + +## cl.usb_manager.3 API Parameter Type Change + +For applications developed based on earlier versions, you need to modify the parameter type. Otherwise, the original service logic will be affected. + +**Key API/Component Changes** + +| Original Class Name | New Class Name | +|---------------| ------------- | +| interface USBConfig | interface USBConfiguration | + +| Original Namespace | New Namespace | +|---------------| ------------- | +| @namespace usbV9 | @namespace usbManager | + +| Bundle Name | Original API | New API | +| --------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| ohos.usbManager.d.ts | function setConfiguration(pipe: USBDevicePipe, config: USBConfig): number; | function setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): number; | + +**Adaptation Guide** + +When calling **setConfiguration**, change the parameter type from **USBConfig** to **USBConfiguration**. + + +## cl.usb_manager.4 SDK API Deletion + +For applications developed based on earlier versions, you need to change the name of the imported bundle. Otherwise, the original service logic will be affected. + +**Key API/Component Changes** + +The **@ohos.usbV9.d.ts** file is replaced by the **@ohos.usbManager.d.ts** file. + +| New Bundle | Original Bundle | Deleted Bundle | +| -------------------- | ------------- | --------------- | +| ohos.usbManager.d.ts | ohos.usb.d.ts | ohos.usbV9.d.ts | + +You need to import **@ohos.usbManager** to use USB service APIs. + + ```ts + import usbManager from '@ohos.usbManager'; + ``` + +**Adaptation Guide** + +For details, see the [API Reference](../../../application-dev/reference/apis/js-apis-usbManager.md). -- GitLab