diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.3/changelogs-useriam.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.3/changelogs-useriam.md deleted file mode 100644 index e781172a332f8bc19c89d43cfa72c29eb8df44d3..0000000000000000000000000000000000000000 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.3/changelogs-useriam.md +++ /dev/null @@ -1,39 +0,0 @@ -# 用户IAM子系统Changelog - -## cl.useriam.1 API9 GetVesion接口删除 - -为优化用户IAM接口,从当前版本开始做如下变更: - -用户IAM删除GetVersion(API 9)接口。 - -**变更影响** - -对用户IAM GetVersion(API 9)接口的使用有影响,需删除对此接口的调用,否则会调用失败。 - -**关键接口/组件变更** - -| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | -| ---------------------- | ------------------- | ------------------------- | ------------------------ | -| ohos.userIAM.userAuth | function | getVersion() : number | 删除 | - -**适配指导** - -需删除对用户IAM GetVersion(API 9)接口的调用。 - -## cl.useriam.2 API8 GetVesion接口返回值变更 - -为统一用户IAM GetVersion(API 8)接口的返回值。从当前版本开始做如下变更: - -用户IAM GetVersion(API 8)接口的返回值由0变更为1。 - -**变更影响** - -对用户IAM GetVersion(API 8)接口的使用有影响,如应用校验了此接口的返回值,修改后校验不通过。 - -**关键接口/组件变更** - -用户IAM GetVersion(API 8)接口的返回值由0变更为1。 - -**适配指导** - -此接口已废弃,需删除对用户IAM GetVersion(API 8)接口的使用。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-pasteboard.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-pasteboard.md deleted file mode 100644 index 29f562ed9ceb239771cdc78b59ebbf91959877f0..0000000000000000000000000000000000000000 --- a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-pasteboard.md +++ /dev/null @@ -1,66 +0,0 @@ -# 剪贴板子系统ChangeLog - -OpenHarmony 4.0.3.2 版本相较于OpenHarmony 之前的版本,剪贴板子系统的API变更如下。 - -## cl.pasteboard.1 convertToTextV9接口变更 - -接口convertToTextV9由于命名规范和接口返回方式问题,名称变更为toPlainText(),返回方式改为同步方式。 - -**变更影响** - -4.0.3.3版本之前使用接口convertToTextV9开发的应用,在4.0.3.3版本及后续版本中无法继续正常使用。 - -**关键的接口/组件变更** - -- 涉及接口 - - function convertToTextV9 - -- 变更前: - - ```ts - convertToTextV9(callback: AsyncCallback): void; - convertToTextV9(): Promise; - ``` - -- 变更后: - - ```ts - toPlainText(): string; - ``` -变更前: - -**适配指导** - -请使用toPlainText替换convertToTextV9,并注意接口返回方式。 - -## cl.pasteboard.2 ShareOption属性名称变更,删除了未支持的属性 - -ShareOption枚举命名从**大驼峰**改成了**全大写**。 - -**变更影响** - -4.0.3.3版本之前使用InApp/LocalDevice/CrossDevice类型开发的应用,在4.0.3.3版本及后续版本中无法继续正常使用。 - -**关键接口/组件变更** - -ShareOption9+ - -变更前: -| 名称 | 值 | 说明 | -| ---- |---|-------------------| -| InApp | 0 | 表示仅允许同应用内粘贴。 | -| LocalDevice | 1 | 表示允许在此设备中任何应用内粘贴。 | -| CrossDevice | 2 | 表示允许跨设备在任何应用内粘贴。 | - - -变更后: -| 名称 | 值 | 说明 | -| ---- |---|-------------------| -| INAPP | 0 | 表示仅允许同应用内粘贴。 | -| LOCALDEVICE | 1 | 表示允许在此设备中任何应用内粘贴。 | -| CROSSDEVICE | 2 | 表示允许跨设备在任何应用内粘贴。 | - -**适配指导** - -按新的语义进行适配。 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-account_os_account.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-account_os_account.md deleted file mode 100644 index ab3394f4e13afe53c829846576a323b719b69dec..0000000000000000000000000000000000000000 --- a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-account_os_account.md +++ /dev/null @@ -1,391 +0,0 @@ -# 帐号子系统ChangeLog - -OpenHarmony4.0.3.2版本相较于OpenHarmony之前的版本,帐号模块的API变更如下。 - -## cl.account_os_account.1 应用帐号isAccountRemovable命名变更 - -类Authenticator中的成员函数isAccountRemovable由于命名不统一问题,名称变更为checkAccountRemovable。 - -**变更影响** - -类Authenticator中的成员函数isAccountRemovable,在4.0.3.2版本及后续版本中无法继续正常使用,由checkAccountRemovable代替。 - -**关键的接口/组件变更** - -- 涉及接口 - ```ts - class Authenticator { - ... - isAccountRemovable - ... - } - ``` -- 变更前: - - ```ts - class Authenticator { - ... - /** - * Checks whether the specified account can be removed. - * @param name Indicates the account name. - * @param callback Indicates the authenticator callback. - * @returns void. - * @since 9 - */ - isAccountRemovable(name: string, callback: AuthCallback): void; - ... - } - ``` - -- 变更后: - - ```ts - class Authenticator { - ... - /** - * Checks whether the specified account can be removed. - * @param name Indicates the account name. - * @param callback Indicates the authenticator callback. - * @returns void. - * @since 9 - */ - checkAccountRemovable(name: string, callback: AuthCallback): void; - ... - } - ``` - -## cl.account_os_account.2 系统帐号checkConstraintEnabled命名变更 - -checkConstraintEnabled由于命名不统一问题,名称变更为checkOsAccountConstraintEnabled。 - -**变更影响** - -checkConstraintEnabled接口,在4.0.3.2版本及后续版本中无法继续正常使用,由checkOsAccountConstraintEnabled代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - checkConstraintEnabled - ... -} -``` - -- 变更前: - - ```ts - checkConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; - checkConstraintEnabled(localId: number, constraint: string): Promise; - ``` - -- 变更后: - - ```ts - checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; - checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise; - ``` - -## cl.account_os_account.3 系统帐号checkOsAccountConstraintEnabled权限场景变更 - -checkOsAccountConstraintEnabled接口的权限管控新增可选权限:ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS。 - -**变更影响** - -在4.0.3.2版本及后续版本中,应用申请ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS权限亦可调用checkOsAccountConstraintEnabled, -切此前版本申请ohos.permission.MANAGE_LOCAL_ACCOUNTS权限的不影响使用 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - checkOsAccountConstraintEnabled - ... -} -``` - -- 变更前: - - ```ts - ... - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS - ... - checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; - checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise; - ``` - -- 变更后: - - ```ts - ... - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - ... - checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; - checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise; - ``` - -## cl.account_os_account.4 系统帐号queryOsAccountLocalIdFromProcessd命名变更 - -queryOsAccountLocalIdFromProcess由于命名不统一问题,名称变更为getOsAccountLocalId。 - -**变更影响** - -queryOsAccountLocalIdFromProcess接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalId代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - queryOsAccountLocalIdFromProcess - ... -} -``` -- 变更前: - - ```ts - queryOsAccountLocalIdFromProcess(callback: AsyncCallback): void; - queryOsAccountLocalIdFromProcess(): Promise; - ``` - -- 变更后: - - ```ts - getOsAccountLocalId(callback: AsyncCallback): void; - getOsAccountLocalId(): Promise; - ``` - -## cl.account_os_account.5 系统帐号queryOsAccountLocalIdFromUid命名变更 - -queryOsAccountLocalIdFromUid由于命名不统一问题,名称变更为getOsAccountLocalIdForUid。 - -**变更影响** - -queryOsAccountLocalIdFromUid接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForUid代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - queryOsAccountLocalIdFromUid - ... -} -``` - -- 变更前: - - ```ts - queryOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback): void; - queryOsAccountLocalIdFromUid(uid: number): Promise; - ``` - -- 变更后: - - ```ts - getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback): void; - getOsAccountLocalIdForUid(uid: number): Promise; - ``` - -## cl.account_os_account.6 系统帐号queryOsAccountLocalIdFromDomain命名变更 - -queryOsAccountLocalIdFromDomain由于命名不统一问题,名称变更为getOsAccountLocalIdForDomain。 - -**变更影响** - -queryOsAccountLocalIdFromDomain接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForDomain代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - queryOsAccountLocalIdFromDomain - ... -} -``` - -- 变更前: - - ```ts - queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback): void; - queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise; - ``` - -- 变更后: - - ```ts - getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback): void; - getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise; - ``` - -## cl.account_os_account.7 系统帐号getActivatedOsAccountIds命名变更 - -getActivatedOsAccountIds由于命名不统一问题,名称变更为getActivatedOsAccountLocalIds。 - -**变更影响** - -getActivatedOsAccountIds接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getActivatedOsAccountLocalIds代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - getActivatedOsAccountIds - ... -} -``` - -- 变更前: - - ```ts - getActivatedOsAccountIds(callback: AsyncCallback>): void; - getActivatedOsAccountIds(): Promise>; - ``` - -- 变更后: - - ```ts - getActivatedOsAccountLocalIds(callback: AsyncCallback>): void; - getActivatedOsAccountLocalIds(): Promise>; - ``` - -## cl.account_os_account.8 系统帐号queryOsAccountLocalIdBySerialNumber命名变更 - -queryOsAccountLocalIdBySerialNumber由于命名不统一问题,名称变更为getOsAccountLocalIdForSerialNumber。 - -**变更影响** - -queryOsAccountLocalIdBySerialNumber接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForSerialNumber代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - queryOsAccountLocalIdBySerialNumber - ... -} -``` - -- 变更前: - - ```ts - queryOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback): void; - queryOsAccountLocalIdBySerialNumber(serialNumber: number): Promise; - ``` - -- 变更后: - - ```ts - getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback): void; - getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise; - ``` - -## cl.account_os_account.9 系统帐号querySerialNumberByOsAccountLocalId命名变更 - -querySerialNumberByOsAccountLocalId由于命名不统一问题,名称变更为getSerialNumberForOsAccountLocalId。 - -**变更影响** - -querySerialNumberByOsAccountLocalId接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getSerialNumberForOsAccountLocalId代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - querySerialNumberByOsAccountLocalId - ... -} -``` - -- 变更前: - - ```ts - querySerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback): void; - querySerialNumberByOsAccountLocalId(localId: number): Promise; - ``` - -- 变更后: - - ```ts - getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback): void; - getSerialNumberForOsAccountLocalId(localId: number): Promise; - ``` - -## cl.account_os_account.10 系统帐号getBundleIdFromUid命名变更 - -getBundleIdFromUid由于命名不统一问题,名称变更为getBundleIdForUid。 - -**变更影响** - -getBundleIdFromUid接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getBundleIdForUid代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - getBundleIdFromUid - ... -} -``` - -- 变更前: - - ```ts - getBundleIdFromUid(uid: number, callback: AsyncCallback): void; - getBundleIdFromUid(uid: number): Promise; - ``` - -- 变更后: - - ```ts - getBundleIdForUid(uid: number, callback: AsyncCallback): void; - getBundleIdForUid(uid: number): Promise; - ``` - -## cl.account_os_account.11 系统帐号queryOsAccountConstraintSourceTypes命名变更 - -queryOsAccountConstraintSourceTypes由于命名不统一问题,名称变更为getOsAccountConstraintSourceTypes。 - -**变更影响** - -queryOsAccountConstraintSourceTypes接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountConstraintSourceTypes代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - queryOsAccountConstraintSourceTypes - ... -} -``` - -- 变更前: - - ```ts - queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback>): void; - queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise>; - ``` - -- 变更后: - - ```ts - getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback>): void; - getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise>; - ``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/Readme.md b/zh-cn/release-notes/changelogs/v3.2-beta4/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..5d4b22da0f35a9f9b96f87b4af34eab2e4c1830c --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/Readme.md @@ -0,0 +1,29 @@ +# Readme + +- [元能力](changelogs-ability.md) +- [帐号](changelogs-account_os_account.md) +- [ArkUI](changelogs-arkui.md) +- [多媒体-相机](changelogs-camera.md) +- [设备管理](changelogs-device-manager.md) +- [USB](changelogs-device-usb.md) +- [分布式调度](changelogs-dmsfwk.md) +- [分布式软总线](changelogs-dsoftbus.md) +- [定制管理](changelogs-enterprise_device_management.md) +- [文件管理](changelogs-filemanagement.md) +- [位置服务](changelogs-geolocation.md) +- [全球化](changelogs-global.md) +- [输入法框架](changelogs-inputmethod-framworks.md) +- [多媒体](changelogs-multimedia.md) +- [多模输入](changelogs-multimodalinput.md) +- [事件通知](changelogs-notification.md) +- [电源管理](changelogs-power.md) +- [上传下载](changelogs-request.md) +- [资源管理](changelogs-resource-manager.md) +- [资源调度](changelogs-resourceschedule.md) +- [电话服务](changelogs-telephony.md) +- [测试](changelogs-testfwk_arkxtest.md) +- [主题](changelogs-theme.md) +- [用户IAM](changelogs-useriam.md) +- [元能力-WantAgent](changelogs-wantAgent.md) +- [Web](changelogs-web.md) +- [基础通信-WIFI](changelogs-wifi.md) diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-x-x.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-x-x.md new file mode 100644 index 0000000000000000000000000000000000000000..b20dbfc1fc13ba0dc94a8044119ac0ae2473cfb7 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-x-x.md @@ -0,0 +1,31 @@ +# xxx子系统ChangeLog + +相比最近一个发布版本(包括不限于LTS、Release、Beta、monthly版本)发生了影响契约兼容性(契约兼容:也称语义兼容,指版本演进后,开发者原有程序行为不发生变化)的变更(包括不限于接口名、参数、返回值、所需要的权限、调用顺序、枚举值、配置参数、路径等),则需要在ChangeLog中对变更进行阐述。 + +## cl.subsystemname.x xxx功能变更, 例:DeviceType属性变更、相机权限变更(尽量概括,不要超过15个字) + +每个变更标题前需要附加编号:cl.subsystemname.x。cl为ChangeLog首字母缩写,subsystemname请填写子系统英文标准名称,x表示变更序号(从低到高逐位增加,起始为1)。 +以功能维度对变更点进行概括描述。例如:xxx功能的xxx、xxx等发生了xxx变化,开发者需要根据以下说明对应用进行适配。 +如果有此变更有对应的需求或设计文档,可以在描述中附上对应的设计文档编号。 + +**变更影响** + +是否影响已发布的接口或者接口行为发生变更,影响的是JS接口还是Native接口。 +是否影响在此前版本已开发的应用,即应用是否需要进行适配动才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + +列举此功能变更涉及的接口/组件变更。 + +**适配指导(可选,不涉及则可以删除)** + +提供指导,帮助开发者针对相关变更进行适配,使应用可以与新版本兼容。 +例: +在xxx文件中将xxx参数修改为xxx。 + +``` +sample code +``` + + + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-ability.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-ability.md new file mode 100644 index 0000000000000000000000000000000000000000..2c6f17521f8bef0ed9b63dceaed6505fb082aa63 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-ability.md @@ -0,0 +1,359 @@ +# 元能力子系统ChangeLog + +## cl.ability.1 应用组件启动规则变更 + +元能力子系统应用组件启动规则在如下场景中存在变更: + + - 应用位于后台启动应用组件 + - 跨应用启动invisible应用组件 + - 跨应用启动FA模型的serviceAbility与dataAbility + - 使用startAbilityByCall接口 + +开发者需要根据以下说明对应用进行适配。 + + +**变更影响** + +若未适配新规则,在上述场景下将无法启动应用组件 +> **注意,启动应用组件是指一切启动或连接Ability的行为:** +
1. 启动Ability,如使用startAbility、startServiceExtensionAbility、startAbilityByCall等接口。 +
2. 连接Ability,如使用connectAbility、connectServiceExtensionAbility、acquireDataAbilityHelper、createDataShareHelper等接口。 + +**关键的接口/组件变更** + + - 涉及的应用组件 + - Stage模型 + - Ability + - ServiceExtension + - DataShareExtension + - FA模型 + - PageAbility + - ServiceAbility + - DataAbility + - 涉及接口 + - Stage模型 + - startAbility(want: Want, callback: AsyncCallback): void; + - startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + - startAbility(want: Want, options?: StartOptions): Promise; + - startAbilityByCall(want: Want): Promise; + - startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + - startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + - startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; + - startAbilityForResult(want: Want, callback: AsyncCallback): void; + - startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback): void; + - startAbilityForResult(want: Want, options?: StartOptions): Promise; + - startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + - startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + - startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; + - startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + - startServiceExtensionAbility(want: Want): Promise; + - startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + - startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; + - stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + - stopServiceExtensionAbility(want: Want): Promise; + - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; + - connectAbility(want: Want, options: ConnectOptions): number; + - connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + - createDataShareHelper(context: Context, uri: string, callback: AsyncCallback): void + - FA模型 + - startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; + - startAbility(parameter: StartAbilityParameter): Promise; + - startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback): void; + - startAbilityForResult(parameter: StartAbilityParameter): Promise; + - acquireDataAbilityHelper(uri: string): DataAbilityHelper; + - connectAbility(request: Want, options:ConnectOptions ): number; + +**适配指导** + +不同场景下的启动规则说明如下: + - **应用后台启动应用组件** + - OpenHarmony 3.2-beta3 版本规则: + - 应用位于后台时,启动应用组件不受任何限制。 + - OpenHarmony 3.2-beta4 版本新规则: + - 当应用位于后台时,启动应用组件需鉴权,需申请的权限如下: + - ```json + { + "name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "grantMode": "system_grant", + "availableLevel": "system_basic", + "provisionEnable": true, + "distributedSceneEnable": false + } + ``` + > **注:** +
1. 即使启动同应用的组件,也受该规则限制。 +
2. 对于API8以及之前的SDK,启动serviceAbility和dataAbility不受此规则限制。 + + - **跨应用启动invisible应用组件** + - OpenHarmony 3.2-beta3 版本规则: + - 对于APL为normal的应用,无法跨应用启动invisible的应用组件 + - OpenHarmony 3.2-beta4 版本新规则: + - 所有应用,若需要跨应用启动invisible的应用组件,需鉴权,需申请的权限如下: + - ```json + { + "name": "ohos.permission.START_INVISIBLE_ABILITY", + "grantMode": "system_grant", + "availableLevel": "system_core", + "provisionEnable": true, + "distributedSceneEnable": false + } + ``` + + - **跨应用启动FA模型的serviceAbility与dataAbility** + + - OpenHarmony 3.2-beta3 版本规则: + - 可任意跨应用启动serviceAbility与dataAbility + - OpenHarmony 3.2-beta4 版本新规则: + - serviceAbility与dataAbility的提供方应用需配置关联启动,否则无法被跨应用拉起。(普通应用无法配置关联启动) + + + - **startAbilityByCall接口** + - OpenHarmony 3.2-beta3 版本规则: + - 可任意进行Call调用 + - OpenHarmony 3.2-beta4 版本新规则: + - 不支持同应用startAbilityByCall调用 + - 跨应用startAbilityByCall调用需鉴权,需申请的权限如下: + + - ```json + { + "name": "ohos.permission.ABILITY_BACKGROUND_COMMUNICATION", + "grantMode": "system_grant", + "availableLevel": "system_basic", + "provisionEnable": true, + "distributedSceneEnable": false + } + ``` + > **注:** +
使用startAbilityByCall接口同时也受上述后台启动、跨应用启动invisible规则的限制。 + +## cl.ability.2 跨设备应用组件启动规则变更(仅支持系统应用) + +元能力子系统跨设备应用组件启动规则在如下场景中存在变更: + + - 应用位于后台启动应用组件 + - 跨应用启动invisible应用组件 + - 跨应用启动FA模型的serviceAbility + +开发者需要根据以下说明对应用进行适配。 + + +**变更影响** + +若未适配新规则,在上述场景下将无法启动应用组件 +> **注意,启动应用组件是指一切启动或连接Ability的行为:** +
1. 启动Ability,如使用startAbility、startAbilityForResult、startAbilityByCall等接口。 +
2. 连接Ability,如使用connectAbility等接口。 + +**关键的接口/组件变更** + + - 涉及的应用组件 + - Stage模型 + - Ability + - ServiceExtension + - FA模型 + - PageAbility + - ServiceAbility + - 涉及接口 + - Stage模型 + - startAbility(want: Want, callback: AsyncCallback): void; + - startAbilityByCall(want: Want): Promise; + - startAbilityForResult(want: Want, callback: AsyncCallback): void; + - connectAbility(want: Want, options: ConnectOptions): number; + - FA模型 + - startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; + - startAbility(parameter: StartAbilityParameter): Promise; + - startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback): void; + - startAbilityForResult(parameter: StartAbilityParameter): Promise; + - connectAbility(request: Want, options:ConnectOptions ): number; + +**适配指导** + +不同场景下的启动规则说明如下: + - **应用后台启动应用组件** + - OpenHarmony 3.2-beta3 版本规则: + - 应用位于后台时,启动应用组件不受任何限制。 + - OpenHarmony 3.2-beta4 版本新规则: + - 当应用位于后台时,启动应用组件需鉴权,需申请的权限如下: + - ```json + { + "name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "grantMode": "system_grant", + "availableLevel": "system_basic", + "provisionEnable": true, + "distributedSceneEnable": false + } + ``` + > **注:** +
1. 即使启动同应用的组件,也受该规则限制。 +
2. 对于API8以及之前的SDK,启动serviceAbility不受此规则限制。 + + - **跨应用启动invisible应用组件** + - OpenHarmony 3.2-beta3 版本规则: + - 无法跨应用启动invisible的应用组件 + - OpenHarmony 3.2-beta4 版本新规则: + - 若需要跨应用启动invisible的应用组件,需鉴权,需申请的权限如下: + - ```json + { + "name": "ohos.permission.START_INVISIBLE_ABILITY", + "grantMode": "system_grant", + "availableLevel": "system_core", + "provisionEnable": true, + "distributedSceneEnable": false + } + ``` + + - **跨应用启动FA模型的serviceAbility** + + - OpenHarmony 3.2-beta3 版本规则: + - 可任意跨应用启动serviceAbility + - OpenHarmony 3.2-beta4 版本新规则: + - serviceAbility的提供方应用需配置关联启动,否则无法被跨应用拉起。(普通应用无法配置关联启动) + - 关联启动配置 + - ```json + { + "bundleName": "", + "app_signature": ["xxxxxxxxxxxxxxxxxxx"], + "associatedWakeUp": true + } + ``` + +## cl.ability.3 API异常处理方式变更 + +元能力部分接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。 + +**变更影响** + +基于此前版本开发的应用,需适配变更接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +为适配统一的API异常处理方式,对元能力相关接口进行废弃(下表中 原接口 列内容,其中的API9接口将被删除,API8及以前的接口将被标注为废弃),并新增对应接口(下表中 新接口 列内容)。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。 + +| 原接口 | 新接口 | +| ----------------------------------------------- | ----------------------------------------------- | +| @ohos.ability.wantConstant.d.ts | @ohos.app.ability.wantConstant.d.ts | +| @ohos.application.Ability.d.ts | @ohos.app.ability.UIAbility.d.ts | +| @ohos.application.AbilityConstant.d.ts | @ohos.app.ability.AbilityConstant.d.ts | +| @ohos.application.abilityDelegatorRegistry.d.ts | @ohos.app.ability.abilityDelegatorRegistry.d.ts | +| @ohos.application.AbilityLifecycleCallback.d.ts | @ohos.app.ability.AbilityLifecycleCallback.d.ts | +| @ohos.application.abilityManager.d.ts | @ohos.app.ability.abilityManager.d.ts | +| @ohos.application.AbilityStage.d.ts | @ohos.app.ability.AbilityStage.d.ts | +| @ohos.application.appManager.d.ts | @ohos.app.ability.appManager.d.ts | +| @ohos.application.Configuration.d.ts | @ohos.app.ability.Configuration.d.ts | +| @ohos.application.ConfigurationConstant.d.ts | @ohos.app.ability.ConfigurationConstant.d.ts | +| @ohos.application.context.d.ts | @ohos.app.ability.common.d.ts | +| @ohos.application.EnvironmentCallback.d.ts | @ohos.app.ability.EnvironmentCallback.d.ts | +| @ohos.application.errorManager.d.ts | @ohos.app.ability.errorManager.d.ts | +| @ohos.application.ExtensionAbility.d.ts | @ohos.app.ability.ExtensionAbility.d.ts | +| @ohos.application.formBindingData.d.ts | @ohos.app.form.formBindingData.d.ts | +| @ohos.application.FormExtension.d.ts | @ohos.app.form.FormExtensionAbility.d.ts | +| @ohos.application.formHost.d.ts | @ohos.app.form.formHost.d.ts | +| @ohos.application.formInfo.d.ts | @ohos.app.form.formInfo.d.ts | +| @ohos.application.formProvider.d.ts | @ohos.app.form.formProvider.d.ts | +| @ohos.application.missionManager.d.ts | @ohos.app.ability.missionManager.d.ts | +| @ohos.application.quickFixManager.d.ts | @ohos.app.ability.quickFixManager.d.ts | +| @ohos.application.ServiceExtensionAbility.d.ts | @ohos.app.ability.ServiceExtensionAbility.d.ts | +| @ohos.application.StartOptions.d.ts | @ohos.app.ability.StartOptions.d.ts | +| @ohos.application.Want.d.ts | @ohos.app.ability.Want.d.ts | +| @ohos.wantAgent.d.ts | @ohos.app.ability.wantAgent.d.ts | + +**适配指导** + +如上所述,仅将老接口平移到了新的namespace中,所以可以通过修改import来解决适配问题: + +如原先接口使用了@ohos.application.missionManager + +```js +import missionManager from '@ohos.application.missionManager'; +``` + +可以通过直接修改import,来切换到新的namespace上: + +```js +import missionManager from '@ohos.app.ability.missionManager'; +``` + +此外还需要适配异常处理,具体参考新接口的接口文档。 + +## cl.ability.4 接口变更 + +对元能力部分接口名进行了变更。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ----------------------------------------- | ----------------------- | ------------------------------------------------------------ | -------- | +| @ohos.application.Ability | Caller | onRelease(callback: OnReleaseCallBack): **void**; | 废弃 | +| @ohos.app.ability.UIAbility | Caller | on(**type**: "release", callback: OnReleaseCallBack): **void**; | 新增 | +| @ohos.application.Ability | Ability | dump(params: Array<**string**>): Array<**string**>; | 废弃 | +| @ohos.app.ability.UIAbility | UIAbility | onDump(params: Array<**string**>): Array<**string**>; | 新增 | +| @ohos.application.appManager | appManager | **function** registerApplicationStateObserver(observer: ApplicationStateObserver): **number**; | 废弃 | +| @ohos.application.appManager | appManager | **function** registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array<**string**>): **number**; | 废弃 | +| @ohos.application.appManager | appManager | **function** unregisterApplicationStateObserver(observerId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.application.appManager | appManager | **function** unregisterApplicationStateObserver(observerId: **number**): Promise<**void**>; | 废弃 | +| @ohos.app.ability.appManager | appManager | **function** on(**type**: "applicationState", observer: ApplicationStateObserver): **number**; | 新增 | +| @ohos.app.ability.appManager | appManager | **function** on(**type**: "applicationState", observer: ApplicationStateObserver, bundleNameList: Array<**string**>): **number**; | 新增 | +| @ohos.app.ability.appManager | appManager | **function** off(**type**: "applicationState", observerId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.app.ability.appManager | appManager | **function** off(**type**: "applicationState", observerId: **number**): Promise<**void**>; | 新增 | +| @ohos.application.errorManager | errorManager | **function** registerErrorObserver(observer: ErrorObserver): **number**; | 废弃 | +| @ohos.application.errorManager | errorManager | **function** unregisterErrorObserver(observerId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.application.errorManager | errorManager | **function** unregisterErrorObserver(observerId: **number**): Promise<**void**>; | 废弃 | +| @ohos.app.ability.errorManager | errorManager | **function** on(**type**: "error", observer: ErrorObserver): **number**; | 新增 | +| @ohos.app.ability.errorManager | errorManager | **function** off(**type**: "error", observerId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.app.ability.errorManager | errorManager | **function** off(**type**: "error", observerId: **number**): Promise<**void**>; | 新增 | +| @ohos.application.missionManager | missionManager | **function** registerMissionListener(listener: MissionListener): **number**; | 废弃 | +| @ohos.application.missionManager | missionManager | **function** unregisterMissionListener(listenerId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.application.missionManager | missionManager | **function** unregisterMissionListener(listenerId: **number**): Promise<**void**>; | 废弃 | +| @ohos.app.ability.missionManager | missionManager | **function** on(**type**: "mission", listener: MissionListener): **number**; | 新增 | +| @ohos.app.ability.missionManager | missionManager | **function** off(**type**: "mission", listenerId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.app.ability.missionManager | missionManager | **function** off(**type**: "mission", listenerId: **number**): Promise<**void**>; | 新增 | +| @ohos.application.FormExtension | FormExtension | onCreate(want: Want): formBindingData.FormBindingData; | 废弃 | +| @ohos.application.FormExtension | FormExtension | onCastToNormal(formId: **string**): **void**; | 废弃 | +| @ohos.application.FormExtension | FormExtension | onUpdate(formId: **string**): **void**; | 废弃 | +| @ohos.application.FormExtension | FormExtension | onVisibilityChange(newStatus: { [key: **string**]: **number** }): **void**; | 废弃 | +| @ohos.application.FormExtension | FormExtension | onEvent(formId: **string**, message: **string**): **void**; | 废弃 | +| @ohos.application.FormExtension | FormExtension | onDestroy(formId: **string**): **void**; | 废弃 | +| @ohos.application.FormExtension | FormExtension | onShare?(formId: **string**): {[key: **string**]: **any**}; | 废弃 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onAddForm(want: Want): formBindingData.FormBindingData; | 新增 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onCastToNormalForm(formId: **string**): **void**; | 新增 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onUpdateForm(formId: **string**): **void**; | 新增 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onChangeFormVisibility(newStatus: { [key: **string**]: **number** }): **void**; | 新增 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onFormEvent(formId: **string**, message: **string**): **void**; | 新增 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onRemoveForm(formId: **string**): **void**; | 新增 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onShareForm?(formId: **string**): {[key: **string**]: **any**}; | 新增 | +| @ohos.application.formHost.d.ts | formHost | **function** castTempForm(formId: **string**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.application.formHost.d.ts | formHost | **function** castTempForm(formId: **string**): Promise<**void**>; | 废弃 | +| @ohos.app.form.formHost.d.ts | formHost | **function** castToNormalForm(formId: **string**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.app.form.formHost.d.ts | formHost | **function** castToNormalForm(formId: **string**): Promise<**void**>; | 新增 | +| @ohos.application.ServiceExtensionAbility | ServiceExtensionAbility | dump(params: Array<**string**>): Array<**string**>; | 废弃 | +| @ohos.app.ability.ServiceExtensionAbility | ServiceExtensionAbility | onDump(params: Array<**string**>): Array<**string**>; | 新增 | +| application/AbilityContext | AbilityContext | connectAbility(want: Want, options: ConnectOptions): **number**; | 废弃 | +| application/AbilityContext | AbilityContext | connectAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 废弃 | +| application/AbilityContext | AbilityContext | disconnectAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| application/AbilityContext | AbilityContext | disconnectAbility(connection: **number**): Promise<**void**>; | 废弃 | +| application/UIAbilityContext | UIAbilityContext | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 新增 | +| application/UIAbilityContext | UIAbilityContext | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 新增 | +| application/UIAbilityContext | UIAbilityContext | disconnectServiceExtensionAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| application/UIAbilityContext | UIAbilityContext | disconnectServiceExtensionAbility(connection: **number**): Promise<**void**>; | 新增 | +| application/ApplicationContext | ApplicationContext | registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): **number**; | 废弃 | +| application/ApplicationContext | ApplicationContext | unregisterAbilityLifecycleCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| application/ApplicationContext | ApplicationContext | unregisterAbilityLifecycleCallback(callbackId: **number**): Promise<**void**>; | 废弃 | +| application/ApplicationContext | ApplicationContext | registerEnvironmentCallback(callback: EnvironmentCallback): **number**; | 废弃 | +| application/ApplicationContext | ApplicationContext | unregisterEnvironmentCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| application/ApplicationContext | ApplicationContext | unregisterEnvironmentCallback(callbackId: **number**): Promise<**void**>; | 废弃 | +| application/ApplicationContext | ApplicationContext | on(**type**: "abilityLifecycle", callback: AbilityLifecycleCallback): **number**; | 新增 | +| application/ApplicationContext | ApplicationContext | off(**type**: "abilityLifecycle", callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| application/ApplicationContext | ApplicationContext | off(**type**: "abilityLifecycle", callbackId: **number**): Promise<**void**>; | 新增 | +| application/ApplicationContext | ApplicationContext | on(**type**: "environment", callback: EnvironmentCallback): **number**; | 新增 | +| application/ApplicationContext | ApplicationContext | off(**type**: "environment", callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| application/ApplicationContext | ApplicationContext | off(**type**: "environment", callbackId: **number**): Promise<**void**>; | 新增 | +| application/ServiceExtensionContext | ServiceExtensionContext | connectAbility(want: Want, options: ConnectOptions): **number**; | 废弃 | +| application/ServiceExtensionContext | ServiceExtensionContext | connectAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 废弃 | +| application/ServiceExtensionContext | ServiceExtensionContext | disconnectAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| application/ServiceExtensionContext | ServiceExtensionContext | disconnectAbility(connection: **number**): Promise<**void**>; | 废弃 | +| application/ServiceExtensionContext | ServiceExtensionContext | connectServiceExtensionAbility(want: Want, options: ConnectOptions): **number**; | 新增 | +| application/ServiceExtensionContext | ServiceExtensionContext | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 新增 | +| application/ServiceExtensionContext | ServiceExtensionContext | disconnectServiceExtensionAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| application/ServiceExtensionContext | ServiceExtensionContext | disconnectServiceExtensionAbility(connection: **number**): Promise<**void**>; | 新增 | + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-account_os_account.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-account_os_account.md new file mode 100644 index 0000000000000000000000000000000000000000..e59049fbac5248afaa1d120c47ea574dc4da2fa4 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-account_os_account.md @@ -0,0 +1,235 @@ +# 帐号子系统changeLog + +## cl.account_os_account.1 变更错误码定义及其返回方式 + +针对帐号子系统API存在错误码定义不统一和抛出方式不符合OpenHarmony错误码规范的问题,从API9开始作以下变更: + +- 新增统一的错误码定义: + - [帐号公共错误码](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-account.md) + - [应用帐号错误码](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-app-account.md) + +- 按以下方式返回错误码: + - 异步接口:错误信息通过AsyncCallback或Promise的error对象返回。其中,参数类型和数量错误信息,通过抛出异常的方式返回。 + - 同步接口:错误信息通过抛出异常的方式返回。 + +**变更影响** + +基于此前版本开发的应用,需适配变更后的新错误码和错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下接口涉及新错误码和错误信息返回方式变更: + - class AccountManager + - activateOsAccount(localId: number, callback: AsyncCallback<void>): void; + - removeOsAccount(localId: number, callback: AsyncCallback<void>): void; + - setOsAccountConstraints(localId: number, constraints: Array<string>, enable: boolean, callback: AsyncCallback<void>): void; + - setOsAccountName(localId: number, localName: string, callback: AsyncCallback<void>): void; + - queryMaxOsAccountNumber(callback: AsyncCallback<number>): void; + - queryAllCreatedOsAccounts(callback: AsyncCallback<Array<OsAccountInfo>>): void; + - createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback<OsAccountInfo>): void; + - createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback<OsAccountInfo>): void; + - queryOsAccountById(localId: number, callback: AsyncCallback<OsAccountInfo>): void; + - getOsAccountProfilePhoto(localId: number, callback: AsyncCallback<string>): void; + - setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback<void>): void; + - on(type: 'activate' | 'activating', name: string, callback: Callback<number>): void; + - off(type: 'activate' | 'activating', name: string, callback?: Callback<number>): void; + - isMainOsAccount(callback: AsyncCallback<boolean>): void; + - queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>): void; + - class UserAuth + - constructor(); + - getVersion(): number; + - getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number; + - getProperty(request: GetPropertyRequest, callback: AsyncCallback<ExecutorProperty>): void; + - setProperty(request: SetPropertyRequest, callback: AsyncCallback<number>): void; + - auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array; + - authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array; + - cancelAuth(contextID: Uint8Array): number; + - class PINAuth + - constructor(); + - registerInputer(inputer: IInputer): boolean; + - unregisterInputer(authType: AuthType): void; + - class UserIdentityManager + - constructor(); + - openSession(callback: AsyncCallback<Uint8Array>): void; + - addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; + - updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; + - closeSession(): void; + - cancel(challenge: Uint8Array): number; + - delUser(token: Uint8Array, callback: IIdmCallback): void; + - delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): void; + - getAuthInfo(callback: AsyncCallback<Array<EnrolledCredInfo>>): void; + - interface IInputData + - onSetData: (authSubType: AuthSubType, data: Uint8Array) => void; + +**适配指导** + +异步接口的错误信息处理逻辑以activateOsAccount为例,示例代码如下: + +```ts +import account_osAccount from "@ohos.account.osAccount" +let accountMgr = account_osAccount.getAccountManager() +let callbackFunc = (err) => { + if (err != null) { // handle the bussiness error + console.log("account_osAccount failed, error: " + JSON.stringify(err)); + } else { + console.log("account_osAccount successfully"); + } +} +try { + accountMgr.activateOsAccount("100", callbackFunc); +} catch (err) { // handle the parameter type error + console.log("account_osAccount failed for incorrect parameter type, error: " + JSON.stringify(err)); +} +try { + accountMgr.activateOsAccount(); +} catch (err) { // handle the parameter number error + console.log("account_osAccount failed for incorrect parameter number, error: " + JSON.stringify(err)); +} +``` + +同步接口的错误信息处理以registerInputer为例,示例代码如下: + +```ts +import account_osAccount from "@ohos.account.osAccount" +let pinAuth = new account_osAccount.PINAuth() +try { + pinAuth.registerInputer({}) +} catch (err) { // handle the parameter type error + console.log("account_osAccount failed for incorrect parameter type, error: " + JSON.stringify(err)); +} +try { + pinAuth.registerInputer() +} catch (err) { // handle the parameter number error + console.log("account_osAccount failed for incorrect parameter number, error: " + JSON.stringify(err)); +} +``` + +# 帐号子系统ChangeLog + +## cl.account_os_account.2 帐号SystemAPI错误信息返回方式变更 + +已发布的部分帐号SystemAPI使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9开始作以下变更: + +异步接口:通过AsyncCallback或Promise的error对象返回错误信息。 + +同步接口:通过抛出异常的方式返回错误信息。 + +**变更影响** + +基于此前版本开发的应用,需适配变更接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +变更前: + + - class UserAuth + - setProperty(request: SetPropertyRequest, callback: AsyncCallback<number>): void; + - setProperty(request: SetPropertyRequest): Promise<number>; + - cancelAuth(contextID: Uint8Array): number; + - class PINAuth + - registerInputer(inputer: Inputer): boolean; + - UserIdentityManager + - cancel(challenge: Uint8Array): number; + +变更后: + + - class UserAuth + - setProperty(request: SetPropertyRequest, callback: AsyncCallback<void>): void; + - setProperty(request: SetPropertyRequest): Promise<void>; + - cancelAuth(contextID: Uint8Array): void; + - class PINAuth + - registerInputer(inputer: Inputer): void; + - UserIdentityManager + - cancel(challenge: Uint8Array): void; + +**适配指导** + +异步接口以setProperty为例,示例代码如下: + +``` +import account_osAccount from "@ohos.account.osAccount" +userAuth.setProperty({ + authType: account_osAccount.AuthType.PIN, + key: account_osAccount.SetPropertyType.INIT_ALGORITHM, + setInfo: new Uint8Array([0]) +}, (err) => { + if (err) { + console.log("setProperty failed, error: " + JSON.stringify(err)); + } else { + console.log("setProperty successfully"); + } +}); + +userAuth.setProperty({ + authType: account_osAccount.AuthType.PIN, + key: account_osAccount.SetPropertyType.INIT_ALGORITHM, + setInfo: new Uint8Array([0]) +}).catch((err) => { + if (err) { + console.log("setProperty failed, error: " + JSON.stringify(err)); + } else { + console.log("setProperty successfully"); + } +}); +``` + +同步接口以registerInputer为例,示例代码如下: + +``` +import account_osAccount from "@ohos.account.osAccount" +let pinAuth = new account_osAccount.PINAuth() +let inputer = { + onGetData: (authType, passwordRecipient) => { + let password = new Uint8Array([0]); + passwordRecipient.onSetData(authType, password); + } +} +try { + pinAuth.registerInputer(inputer); +} catch (err) { + console.log("registerInputer failed, error: " + JSON.stringify(err)); +} +``` + +## cl.account_os_account.3 应用帐号鉴权服务ACTION定义变更 + +**变更影响** + +基于此前版本开发的应用,需适配修改应用配置文件(FA模型为config.json或Stage模型为module.json5)中的ACTION才能正常对外提供应用鉴权服务。 + +**关键接口/组件变更** + +涉及的常量: + +@ohos.ability.wantConstant.ACTION_APP_ACCOUNT_AUTH + +变更前: + +ACTION_APP_ACCOUNT_AUTH = "account.appAccount.action.auth" + +变更后: + +ACTION_APP_ACCOUNT_AUTH = "ohos.appAccount.action.auth" + +**适配指导** + +提供应用帐号鉴权服务的三方应用,需要在相关ServiceAbility的配置文件(FA模型为config.json或Stage模型为module.json5)中适配变更后的应用帐号认证ACTION,示例如下: + +``` +"abilities": [ + { + "name": "ServiceAbility", + "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", + ... + "visible": true, + "skills": { + { + "actions": [ + "ohos.appAccount.action.auth" + ] + } + } + }] +} + +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-arkui.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-arkui.md new file mode 100644 index 0000000000000000000000000000000000000000..4ce56f7346c9f1f0c92dc1037eb9eb1845e7a6e5 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-arkui.md @@ -0,0 +1,126 @@ +# arkui子系统ChangeLog + +## cl.arkui.1 xcomponent组件接口变更 + +arkui子系统xcomponent组件接口存在变更: + + - 去除getXComponentSurfaceId和setXComponentSurfaceSize接口的@systemapi标签 + - 指定getXComponentSurfaceId,getXComponentContext和setXComponentSurfaceSize接口的返回值类型 + +开发者需要根据以下说明对应用进行适配。 + + +**变更影响** + +影响已发布的JS接口,应用需要进行适配才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + + - getXComponentSurfaceId:改为public接口,指定返回值类型为string + - setXComponentSurfaceSize:改为public接口,指定返回值类型为void + - getXComponentContext:指定返回值类型为Object + +**适配指导** + +不同场景下的启动规则说明如下: +开发者适配内容: + + - **getXComponentSurfaceId** + - OpenHarmony 3.2-beta3 版本规则: + - 系统接口systemapi。 + - 未指定返回值 + - OpenHarmony 3.2-Beta4 版本新规则: + - 公共接口。 + - 指定返回值类型为string + - 开发者需要按照string类型处理返回值 + - **setXComponentSurfaceSize** + - OpenHarmony 3.2-beta3 版本规则: + - 系统接口systemapi。 + - 未指定返回值 + - OpenHarmony 3.2-Beta4 版本新规则: + - 公共接口。 + - 指定返回值类型为void + - 开发者需要按照void类型处理返回值 + - **getXComponentContext** + - OpenHarmony 3.2-beta3 版本规则: + - 未指定返回值 + - OpenHarmony 3.2-Beta4 版本新规则: + - 指定返回值类型为Object + - 开发者需要按照Object类型处理返回值 + +## cl.arkui.2 弹窗类组件接口样式变更 + +ArkUI子系统alertDialog, actionSheet, customDialog组件及prompt, promptAction接口存在样式变更: + + - promptAction.showDialog, promptAction.showActionMenu, alertDialog, actionSheet, customDialog更新弹窗底板模糊效果 + +**变更影响** + +默认弹窗底板模糊效果 + +**关键的接口/组件变更** + +涉及接口: promptAction.showDialog, promptAction.showActionMenu; +涉及组件: alertDialog, actionSheet, customDialog + +**适配指导** + +无需适配 + +## cl.arkui.3 自定义组件成员变量初始化的方式与约束校验场景补全 + +[自定义组件成员变量初始化规则](../../../application-dev/quick-start/arkts-restrictions-and-extensions.md#自定义组件成员变量初始化的方式与约束)请参考文档,此版本修复了某些遗漏场景的校验。 + + +**变更影响** + +如果未按照文档规范,进行自定义组件成员变量初始化赋值,编译报错。 + +**关键的接口/组件变更** + +不涉及。 + +**适配指导** + +按文档提示修改。 + +## cl.arkui.4 自定义父子组件成员变量赋值约束校验场景补全 + +[自定义父子组件成员变量赋值规则](../../../application-dev/quick-start/arkts-restrictions-and-extensions.md#自定义组件成员变量初始化的方式与约束)请参考文档,此版本修复了某些遗漏场景的校验。 + + +**变更影响** + +如果自定义父子组件成员变量初始化未按照文档规范,编译报错。 + +**关键的接口/组件变更** + +不涉及。 + +**适配指导** + +按文档提示修改,使用其它装饰器变量或常规变量赋值。 + +## cl.arkui.5 单一子组件校验补全 + +对 'Button', 'FlowItem','GridItem','GridCol','ListItem','Navigator','Refresh','RichText','ScrollBar','StepperItem','TabContent'等只支持一个子组件的开启校验。 + + +**变更影响** + +如果上述组件内有超过一个子组件,编译报错。 + +**关键的接口/组件变更** + +```js +RichText('RichText') { + Text('Text1') + Text('Text2') +} +/* ArkTS:ERROR File: /root/newOH/developtools/ace-ets2bundle/compiler/sample/pages/home.ets:25:7 + The component 'RichText' can only have a single child component. */ +``` + +**适配指导** + +按报错提示修改,指定组件内只能有一个子组件。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-camera.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-camera.md new file mode 100644 index 0000000000000000000000000000000000000000..b7b5b8c3c884f8d23e6bd4bb2faf319702d88a29 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-camera.md @@ -0,0 +1,781 @@ +# 媒体子系统JS API变更Changelog + +## camera接口变更 +基于以下原因新增部分功能接口以及废弃部分接口: +1. 提升开发者使用相机接口的便利。 +2. 帮助开发者快速掌握相机开发接口,快速投入到开发当中。 +3. 易于后续版本中框架功能的扩展,降低框架模块之间的耦合度。 + +具体参考下方变更内容,开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ---------------------- | ----------------------- | ------------------------------------------------------------ | -------- | +| ohos.multimedia.camera | Profile | readonly format:CameraFormat; | 新增 | +| ohos.multimedia.camera | Profile | readonly size: Size; | 新增 | +| ohos.multimedia.camera | FrameRateRange | readonly min: number; | 新增 | +| ohos.multimedia.camera | FrameRateRange | readonly max: number; | 新增 | +| ohos.multimedia.camera | VideoProfile | readonly frameRateRange: FrameRateRange; | 新增 | +| ohos.multimedia.camera | CameraOutputCapability | readonly previewProfiles: Array; | 新增 | +| ohos.multimedia.camera | CameraOutputCapability | readonly photoProfiles: Array; | 新增 | +| ohos.multimedia.camera | CameraOutputCapability | readonly videoProfiles: Array; | 新增 | +| ohos.multimedia.camera | CameraOutputCapability | readonly supportedMetadataObjectTypes: Array; | 新增 | +| ohos.multimedia.camera | CameraManager | getSupportedCameras(callback: AsyncCallback>): void;
getSupportedCameras(): Promise>; | 新增 | +| ohos.multimedia.camera | CameraManager | getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void;
getSupportedOutputCapability(camera: CameraDevice): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | isCameraMuted(): boolean; | 新增 | +| ohos.multimedia.camera | CameraManager | isCameraMuteSupported(): boolean; | 新增 | +| ohos.multimedia.camera | CameraManager | muteCamera(mute: boolean): void; | 新增 | +| ohos.multimedia.camera | CameraManager | createCameraInput(camera: CameraDevice, callback: AsyncCallback): void;
createCameraInput(camera: CameraDevice): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPreviewOutput(profile: Profile, surfaceId: string): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPhotoOutput(profile: Profile, surfaceId: string): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void;
createVideoOutput(profile: VideoProfile, surfaceId: string): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void;
createMetadataOutput(metadataObjectTypes: Array): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | createCaptureSession(callback: AsyncCallback): void;
createCaptureSession(): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | on(type: 'cameraMute', callback: AsyncCallback): void; | 新增 | +| ohos.multimedia.camera | CameraManager | getCameras(callback: AsyncCallback>): void;
getCameras(): Promise>; | 废弃 | +| ohos.multimedia.camera | CameraManager | createCameraInput(cameraId: string, callback: AsyncCallback): void;
createCameraInput(cameraId: string): Promise; | 废弃 | +| ohos.multimedia.camera | CameraManager | createCaptureSession(context: Context, callback: AsyncCallback): void;
createCaptureSession(context: Context): Promise; | 废弃 | +| ohos.multimedia.camera | CameraManager | createPreviewOutput(surfaceId: string, callback: AsyncCallback): void;
createPreviewOutput(surfaceId: string): Promise; | 废弃 | +| ohos.multimedia.camera | CameraManager | CreatePhotoOutput(surfaceId: string, callback: AsyncCallback): void;
CreatePhotoOutput(surfaceId: string): Promise; | 废弃 | +| ohos.multimedia.camera | CameraManager | createVideoOutput(surfaceId: string, callback: AsyncCallback): void;
createVideoOutput(surfaceId: string): Promise; | 废弃 | +| ohos.multimedia.camera | CameraManager | createMetadataOutput(callback: AsyncCallback): void;
createVideoOutput(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraStatusInfo | camera: CameraDevice; | 新增 | +| ohos.multimedia.camera | CameraStatusInfo | camera: Camera; | 废弃 | +| ohos.multimedia.camera | CameraDevice | interface CameraDevice | 新增 | +| ohos.multimedia.camera | Camera | interface Camera | 废弃 | +| ohos.multimedia.camera | CameraInput | open(callback: AsyncCallback): void;
open(): Promise; | 新增 | +| ohos.multimedia.camera | CameraInput | close(callback: AsyncCallback): void;
close(): Promise; | 新增 | +| ohos.multimedia.camera | CameraInput | on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; | 新增 | +| ohos.multimedia.camera | CameraInput | isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void;
isFocusModeSupported(afMode: FocusMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getFocusMode(callback: AsyncCallback): void;
getFocusMode(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setFocusMode(afMode: FocusMode, callback: AsyncCallback): void;
setFocusMode(afMode: FocusMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getZoomRatioRange(callback: AsyncCallback>): void;
getZoomRatioRange(): Promise>; | 废弃 | +| ohos.multimedia.camera | CameraInput | getZoomRatio(callback: AsyncCallback): void;
getZoomRatio(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setZoomRatio(zoomRatio: number, callback: AsyncCallback): void;
setZoomRatio(zoomRatio: number): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getCameraId(callback: AsyncCallback): void;
getCameraId(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getExposurePoint(callback: AsyncCallback): void;
getExposurePoint(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setExposurePoint(exposurePoint: Point, callback: AsyncCallback): void;
setExposurePoint(exposurePoint: Point): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | hasFlash(callback: AsyncCallback): void;
hasFlash(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void;
isFlashModeSupported(flashMode: FlashMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getFlashMode(callback: AsyncCallback): void;
getFlashMode(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void;
setFlashMode(flashMode: FlashMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void;
isExposureModeSupported(aeMode: ExposureMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getExposureMode(callback: AsyncCallback): void;
getExposureMode(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void;
setExposureMode(aeMode: ExposureMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getMeteringPoint(callback: AsyncCallback): void;
getMeteringPoint(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setMeteringPoint(point: Point, callback: AsyncCallback): void;
setMeteringPoint(point: Point): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getExposureBiasRange(callback: AsyncCallback>): void;
getExposureBiasRange(): Promise>; | 废弃 | +| ohos.multimedia.camera | CameraInput | setExposureBias(exposureBias: number, callback: AsyncCallback): void;
setExposureBias(exposureBias: number): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getExposureValue(callback: AsyncCallback): void;
getExposureValue(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void;
isFocusModeSupported(afMode: FocusMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getFocusMode(callback: AsyncCallback): void;
getFocusMode(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setFocusMode(afMode: FocusMode, callback: AsyncCallback): void;
setFocusMode(afMode: FocusMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setFocusPoint(point: Point, callback: AsyncCallback): void;
setFocusPoint(point: Point): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getFocusPoint(callback: AsyncCallback): void;
getFocusPoint(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getFocalLength(callback: AsyncCallback): void;
getFocalLength(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getZoomRatioRange(callback: AsyncCallback>): void;
getZoomRatioRange(): Promise>; | 废弃 | +| ohos.multimedia.camera | CameraInput | getZoomRatio(callback: AsyncCallback): void;
getZoomRatio(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setZoomRatio(zoomRatio: number, callback: AsyncCallback): void;
setZoomRatio(zoomRatio: number): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | on(type: 'focusStateChange', callback: AsyncCallback): void; | 废弃 | +| ohos.multimedia.camera | CameraInput | on(type: 'exposureStateChange', callback: AsyncCallback): void; | 废弃 | +| ohos.multimedia.camera | CameraInput | on(type: 'error', callback: ErrorCallback): void; | 废弃 | +| ohos.multimedia.camera | CameraInputErrorCode | ERROR_NO_PERMISSION = 0 | 新增 | +| ohos.multimedia.camera | CameraInputErrorCode | ERROR_DEVICE_PREEMPTED = 1 | 新增 | +| ohos.multimedia.camera | CameraInputErrorCode | ERROR_DEVICE_DISCONNECTED = 2 | 新增 | +| ohos.multimedia.camera | CameraInputErrorCode | ERROR_DEVICE_IN_USE = 3 | 新增 | +| ohos.multimedia.camera | CameraInputErrorCode | ERROR_DRIVER_ERROR = 4 | 新增 | +| ohos.multimedia.camera | CameraFormat | CAMERA_FORMAT_RGBA_8888 = 3 | 新增 | +| ohos.multimedia.camera | ExposureMode | EXPOSURE_MODE_AUTO = 1 | 新增 | +| ohos.multimedia.camera | ExposureMode | EXPOSURE_MODE_CONTINUOUS_AUTO = 2 | 新增 | +| ohos.multimedia.camera | ExposureMode | EXPOSURE_MODE_AUTO | 废弃 | +| ohos.multimedia.camera | ExposureMode | EXPOSURE_MODE_CONTINUOUS_AUTO | 废弃 | +| ohos.multimedia.camera | VideoStabilizationMode | LOW = 1 | 新增 | +| ohos.multimedia.camera | VideoStabilizationMode | MIDDLE = 2 | 新增 | +| ohos.multimedia.camera | VideoStabilizationMode | HIGH = 3 | 新增 | +| ohos.multimedia.camera | VideoStabilizationMode | AUTO = 4 | 新增 | +| ohos.multimedia.camera | VideoStabilizationMode | LOW | 废弃 | +| ohos.multimedia.camera | VideoStabilizationMode | MIDDLE | 废弃 | +| ohos.multimedia.camera | VideoStabilizationMode | HIGH | 废弃 | +| ohos.multimedia.camera | VideoStabilizationMode | AUTO | 废弃 | +| ohos.multimedia.camera | CaptureSession | addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
addOutput(cameraOutput: CameraOutput): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
removeOutput(cameraOutput: CameraOutput): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback): void;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getActiveVideoStabilizationMode(callback: AsyncCallback): void;
getActiveVideoStabilizationMode(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback): void;
setVideoStabilizationMode(mode: VideoStabilizationMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | on(type: 'focusStateChange', callback: AsyncCallback): void; | 新增 | +| ohos.multimedia.camera | CaptureSession | hasFlash(callback: AsyncCallback): void;
hasFlash(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void;
isFlashModeSupported(flashMode: FlashMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getFlashMode(callback: AsyncCallback): void;
getFlashMode(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void;
setFlashMode(flashMode: FlashMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void;
isExposureModeSupported(aeMode: ExposureMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getExposureMode(callback: AsyncCallback): void;
getExposureMode(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void;
setExposureMode(aeMode: ExposureMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getMeteringPoint(callback: AsyncCallback): void;
getMeteringPoint(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setMeteringPoint(point: Point, callback: AsyncCallback): void;
setMeteringPoint(point: Point): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getExposureBiasRange(callback: AsyncCallback>): void;
getExposureBiasRange(): Promise>; | 新增 | +| ohos.multimedia.camera | CaptureSession | setExposureBias(exposureBias: number, callback: AsyncCallback): void;
setExposureBias(exposureBias: number): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getExposureValue(callback: AsyncCallback): void;
getExposureValue(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void;
isFocusModeSupported(afMode: FocusMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getFocusMode(callback: AsyncCallback): void;
getFocusMode(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setFocusMode(afMode: FocusMode, callback: AsyncCallback): void;
setFocusMode(afMode: FocusMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setFocusPoint(point: Point, callback: AsyncCallback): void;
setFocusPoint(point: Point): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getFocusPoint(callback: AsyncCallback): void;
getFocusPoint(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getFocalLength(callback: AsyncCallback): void;
getFocalLength(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getZoomRatioRange(callback: AsyncCallback>): void;
getZoomRatioRange(): Promise>; | 新增 | +| ohos.multimedia.camera | CaptureSession | getZoomRatio(callback: AsyncCallback): void;
getZoomRatio(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setZoomRatio(zoomRatio: number, callback: AsyncCallback): void;
setZoomRatio(zoomRatio: number): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | addOutput(previewOutput: PreviewOutput, callback: AsyncCallback): void;
addOutput(previewOutput: PreviewOutput): Promise;
addOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void;
addOutput(photoOutput: PhotoOutput): Promise;
addOutput(videoOutput: VideoOutput, callback: AsyncCallback): void;
addOutput(videoOutput: VideoOutput): Promise; | 废弃 | +| ohos.multimedia.camera | CaptureSession | removeOutput(previewOutput: PreviewOutput, callback: AsyncCallback): void;
removeOutput(previewOutput: PreviewOutput): Promise;
removeOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void;
removeOutput(photoOutput: PhotoOutput): Promise;removeOutput(videoOutput: VideoOutput, callback: AsyncCallback): void;
removeOutput(videoOutput: VideoOutput): Promise;
removeOutput(metadataOutput: MetadataOutput, callback: AsyncCallback): void;
removeOutput(metadataOutput: MetadataOutput): Promise; | 废弃 | +| ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_INSUFFICIENT_RESOURCES = 0 | 新增 | +| ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_TIMEOUT = 1 | 新增 | +| ohos.multimedia.camera | CameraOutput | release(callback: AsyncCallback): void;
release(): Promise; | 新增 | +| ohos.multimedia.camera | PreviewOutput | start(callback: AsyncCallback): void;
start(): Promise; | 新增 | +| ohos.multimedia.camera | PreviewOutput | stop(callback: AsyncCallback): void;
stop(): Promise; | 新增 | +| ohos.multimedia.camera | PreviewOutput | release(callback: AsyncCallback): void;
release(): Promise; | 废弃 | +| ohos.multimedia.camera | PhotoOutput | release(callback: AsyncCallback): void;
release(): Promise; | 废弃 | +| ohos.multimedia.camera | VideoOutput | release(callback: AsyncCallback): void;
release(): Promise; | 废弃 | +| ohos.multimedia.camera | PhotoCaptureSetting | mirror?: boolean; | 新增 | +| ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_DRIVER_ERROR = 0 | 新增 | +| ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_INSUFFICIENT_RESOURCES = 1 | 新增 | +| ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_TIMEOUT = 2 | 新增 | +| ohos.multimedia.camera | VideoOutputErrorCode | ERROR_DRIVER_ERROR = 0 | 新增 | +| ohos.multimedia.camera | MetadataObjectType | FACE_DETECTION = 0 | 新增 | +| ohos.multimedia.camera | MetadataObjectType | FACE = 0 | 废弃 | +| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback): void; | 新增 | +| ohos.multimedia.camera | MetadataOutput | setCapturingMetadataObjectTypes(metadataObjectTypes: Array, callback: AsyncCallback): void;
setCapturingMetadataObjectTypes(metadataObjectTypes: Array): Promise; | 废弃 | +| ohos.multimedia.camera | MetadataOutput | getSupportedMetadataObjectTypes(callback: AsyncCallback>): void;
getSupportedMetadataObjectTypes(): Promise>; | 废弃 | +| ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_UNKNOWN = -1 | 新增 | +| ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_INSUFFICIENT_RESOURCES = 0 | 新增 | +| ohos.multimedia.camera | MetadataOutputError | code: MetadataOutputErrorCode; | 新增 | + +**适配指导** + +除新增接口,和废弃接口之外,开发者需要关注变更的接口的适配: + +从Beta4版本开始,对以下接口进行调整: + +**新增接口** + +1. Profile接口 + + 属性1:readonly format,类型:CameraFormat; + + 属性2:readonly size,类型:Size; + +2. FrameRateRange接口 + + 属性1:readonly min,类型:number; + + 属性2:readonly max,类型:number; + +3. VideoProfile接口,继承自Profile + + 属性:readonly frameRateRange,类型:FrameRateRange; + +4. CameraOutputCapability接口 + + 属性1:readonly previewProfiles,类型:Array; + + 属性2:readonly photoProfiles,类型:Array; + + 属性3:readonly videoProfiles,类型:Array; + + 属性4:readonly supportedMetadataObjectTypes,类型:Array; + +5. CameraManager中新增 + + getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void; + + getSupportedOutputCapability(camera: CameraDevice): Promise; + + 参考代码如下: + + ``` + cameraManager.getSupportedCameras().then((cameras) => { + let cameraDevice = cameras[0]; + cameraManager.getSupportedOutputCapability(cameraDevice, (err, CameraOutputCapability) => { + if (err) { + console.error(`Failed to get the outputCapability. ${err.message}`); + return; + } + console.log('Callback returned with an array of supported outputCapability'); + }) + }) + ``` + + ``` + cameraManager.getSupportedCameras().then((cameras) => { + let cameraDevice = cameras[0]; + cameraManager.getSupportedOutputCapability(cameraDevice).then((cameraoutputcapability) => { + console.log('Promise returned with an array of supported outputCapability'); + }) + }) + ``` + +6. CameraManager中新增isCameraMuted(): boolean; + + 参考代码如下: + + ``` + let ismuted = cameraManager.isCameraMuted(); + ``` + +7. CameraManager中新增isCameraMuteSupported(): boolean; + + 参考代码如下: + + ``` + let ismutesuppotred = cameraManager.isCameraMuteSupported(); + ``` + +8. CameraManager中新增muteCamera(mute: boolean): void; + + 参考代码如下: + + ``` + let mute = true; + cameraManager.muteCamera(mute); + ``` + +9. CameraManager中新增on(type: 'cameraMute', callback: AsyncCallback): void; + + 参考代码如下: + + ``` + cameraManager.on('cameraMute', (err, curMuetd) => { + if (err) { + console.error(`Failed to get cameraMute callback. ${err.message}`); + return; + } + }) + ``` + +10. CameraInput中新增open(callback: AsyncCallback): void;以及open(): Promise; + +参考代码如下: + +``` +cameraInput.open((err) => { + if (err) { + console.error(`Failed to open the camera. ${err.message}`); + return; + } + console.log('Callback returned with camera opened.'); +}) +``` + +``` +cameraInput.open().then(() => { + console.log('Promise returned with camera opened.'); +}) +``` + +11. CameraInput中新增close(callback: AsyncCallback): void;以及close(): Promise; + + 参考代码如下: + + ``` + cameraInput.close((err) => { + if (err) { + console.error(`Failed to close the cameras. ${err.message}`); + return; + } + console.log('Callback returned with camera closed.'); + }) + ``` + + ``` + cameraInput.close().then(() => { + console.log('Promise returned with camera closed.'); + }) + ``` + +12. 枚举CameraInputErrorCode中新增 + + 枚举值名称:ERROR_NO_PERMISSION,值:0; + + 枚举值名称:ERROR_DEVICE_PREEMPTED,值:1; + + 枚举值名称:ERROR_DEVICE_DISCONNECTED,值:2; + + 枚举值名称:ERROR_DEVICE_IN_USE,值:3; + + 枚举值名称:ERROR_DRIVER_ERROR,值:4; + +13. 枚举CameraFormat中新增 + + 枚举值名称:CAMERA_FORMAT_RGBA_8888,值:3; + +14. CaptureSession中新增getMeteringPoint(callback: AsyncCallback): void;以及getMeteringPoint(): Promise; + + 参考代码如下: + + ``` + captureSession.getMeteringPoint((err, exposurePoint) => { + if (err) { + console.log(`Failed to get the current exposure point ${err.message}`); + return ; + } + console.log(`Callback returned with current exposure point: ${exposurePoint}`); + }) + ``` + + ``` + captureSession.getMeteringPoint().then((exposurePoint) => { + console.log(`Promise returned with current exposure point : ${exposurePoint}`); + }) + ``` + +15. CaptureSession中新增setMeteringPoint(point: Point, callback: AsyncCallback): void;以及setMeteringPoint(point: Point): Promise; + + 参考代码如下: + + ``` + const Point1 = {x: 1, y: 1}; + + captureSession.setMeteringPoint(Point1,(err) => { + if (err) { + console.log(`Failed to set the exposure point ${err.message}`); + return ; + } + console.log('Callback returned with the successful execution of setMeteringPoint'); + }) + ``` + + ``` + const Point2 = {x: 2, y: 2}; + + captureSession.setMeteringPoint(Point2).then(() => { + console.log('Promise returned with the successful execution of setMeteringPoint'); + }) + ``` + +16. 枚举CaptureSessionErrorCode中新增 + + 枚举值名称:ERROR_INSUFFICIENT_RESOURCES,值:0; + + 枚举值名称:ERROR_TIMEOUT,值:1; + +17. 新增接口CameraOutput,接口下有release(callback: AsyncCallback): void;以及release(): Promise;方法 + + 参考代码如下:用previewOutput做示例 + + ``` + previewOutput.release((err) => { + if (err) { + console.error(`Failed to release the PreviewOutput instance ${err.message}`); + return; + } + console.log('Callback invoked to indicate that the PreviewOutput instance is released successfully.'); + }); + ``` + + ``` + previewOutput.release().then(() => { + console.log('Promise returned to indicate that the PreviewOutput instance is released successfully.'); + }) + ``` + +18. PreviewOutput中新增start(callback: AsyncCallback): void;以及start(): Promise; + + 参考代码如下 + + ``` + previewOutput.start((err) => { + if (err) { + console.error(`Failed to start the previewOutput. ${err.message}`); + return; + } + console.log('Callback returned with previewOutput started.'); + }) + ``` + + ``` + previewOutput.start().then(() => { + console.log('Promise returned with previewOutput started.'); + }) + ``` + +19. PreviewOutput中新增stop(callback: AsyncCallback): void;以及stop(): Promise; + + 参考代码如下 + + ``` + previewOutput.stop((err) => { + if (err) { + console.error(`Failed to stop the previewOutput. ${err.message}`); + return; + } + console.log('Callback returned with previewOutput stopped.'); + }) + ``` + + ``` + previewOutput.stop().then(() => { + console.log('Callback returned with previewOutput stopped.'); + }) + ``` + +20. PhotoCaptureSetting接口 + + 属性1:mirror?,类型:boolean; + +21. 枚举PhotoOutputErrorCode中新增 + + 枚举值名称:ERROR_DRIVER_ERROR,值:0; + + 枚举值名称:ERROR_INSUFFICIENT_RESOURCES,值:1; + + 枚举值名称:ERROR_TIMEOUT,值:2; + +22. 枚举VideoOutputErrorCode中新增 + + 枚举值名称:ERROR_DRIVER_ERROR,值:0; + +23. MetadataOutput中新增on(type: 'error', callback: ErrorCallback): void; + + 参考代码如下 + + ``` + metadataOutput.on('error', (metadataOutputError) => { + console.log(`Metadata output error code: ${metadataOutputError.code}`); + }) + ``` + +24. MetadataOutputErrorCode枚举 + + 枚举值名称:ERROR_UNKNOWN,值:-1; + + 枚举值名称:ERROR_INSUFFICIENT_RESOURCES,值:0; + +25. MetadataOutputError接口 + + 属性名称:code,值:MetadataOutputErrorCode + +**废弃接口** + +1. CameraInput中废弃接口on(type: 'exposureStateChange', callback: AsyncCallback): void; + +2. previewOutput中废弃接口release(callback: AsyncCallback): void;以及release(): Promise; + +3. metadataOutput中废弃接口 + + setCapturingMetadataObjectTypes(metadataObjectTypes: Array, callback: AsyncCallback): void;
setCapturingMetadataObjectTypes(metadataObjectTypes: Array): Promise; + +4. metadataOutput中废弃接口 + + getSupportedMetadataObjectTypes(callback: AsyncCallback>): void;
getSupportedMetadataObjectTypes(): Promise>; + +5. PreviewOutput中废弃接口release(callback: AsyncCallback): void;以及release(): Promise; + +6. PhotoOutput中废弃接口release(callback: AsyncCallback): void;以及release(): Promise; + +7. VideoOutput中废弃接口release(callback: AsyncCallback): void;以及release(): Promise; + +8. CameraInput中废弃接口getCameraId(callback: AsyncCallback): void;以及getCameraId(): Promise; + +9. CameraInput中废弃接口getExposurePoint(callback: AsyncCallback): void;以及getExposurePoint(): Promise; + +10. CameraInput中废弃接口setExposurePoint(exposurePoint: Point, callback: AsyncCallback): void;以及setExposurePoint(exposurePoint: Point): Promise; + +**接口变更** + +1. CameraManager中接口getCameras返回值由Array变更为Array,接口名由getCameras 更换为 getSupportedCameras,因此旧接口getCameras(callback: AsyncCallback>): void;以及getCameras(): Promise>;变更为getSupportedCameras(callback: AsyncCallback>): void和getSupportedCameras(): Promise>; + + 参考代码如下: + + ``` + cameraManager.getSupportedCameras((err, cameras) => { + if (err) { + console.error(`Failed to get the cameras. ${err.message}`); + return; + } + console.log(`Callback returned with an array of supported cameras: ${cameras.length}`); + }) + ``` + + ``` + cameraManager.getSupportedCameras().then((cameras) => { + console.log(`Promise returned with an array of supported cameras: ${cameras.length}`); + }) + ``` + +2. CameraManager中接口createCameraInput传递参数由原来cameraId: string变更为camera: CameraDevice,因此旧接口createCameraInput(cameraId: string, callback: AsyncCallback): void;以及createCameraInput(cameraId: string): Promise;变更为createCameraInput(camera: CameraDevice, callback: AsyncCallback): void;和createCameraInput(camera: CameraDevice): Promise; + + 参考代码如下: + + ``` + let cameraDevice = cameras[0]; + cameraManager.createCameraInput(cameraDevice, (err, cameraInput) => { + if (err) { + console.error(`Failed to create the CameraInput instance. ${err.message}`); + return; + } + console.log('Callback returned with the CameraInput instance.'); + }) + ``` + + ``` + let cameraDevice = cameras[0]; + cameraManager.createCameraInput(cameraDevice).then((cameraInput) => { + console.log('Promise returned with the CameraInput instance'); + }) + ``` + +3. CameraManager中接口createPreviewOutput新增传递参数profile: Profile,profile参数由getSupportedOutputCapability接口获取,因此旧接口createPreviewOutput(surfaceId: string, callback: AsyncCallback): void;以及createPreviewOutput(surfaceId: string): Promise;变更为createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;createPreviewOutput(profile: Profile, surfaceId: string): Promise; + + 参考代码如下: + + ``` + let profile = cameraoutputcapability.previewProfiles[0]; + cameraManager.createPreviewOutput(profile, surfaceId, (err, previewOutput) => { + if (err) { + console.error(`Failed to gcreate previewOutput. ${err.message}`); + return; + } + console.log('Callback returned with previewOutput created.'); + }) + ``` + + ``` + let profile = cameraoutputcapability.previewProfiles[0]; + cameraManager.createPreviewOutput(profile, surfaceId).then((previewOutput) => { + console.log('Promise returned with previewOutput created.'); + }) + ``` + +4. CameraManager中接口createPhotoOutput新增传递参数profile: Profile,profile参数由getSupportedOutputCapability接口获取,因此旧接口CreatePhotoOutput(surfaceId: string, callback: AsyncCallback): void;以及CreatePhotoOutput(surfaceId: string): Promise;变更为createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;和createPhotoOutput(profile: Profile, surfaceId: string): Promise; + + 参考代码如下: + + ``` + let profile = cameraoutputcapability.photoProfiles[0]; + cameraManager.createPhotoOutput(profile, surfaceId, (err, photoOutput) => { + if (err) { + console.error(`Failed to create photoOutput. ${err.message}`); + return; + } + console.log('Callback returned with photoOutput created.'); + }) + ``` + + ``` + let profile = cameraoutputcapability.photoProfiles[0]; + cameraManager.createPhotoOutput(profile, surfaceId).then((photoOutput) => { + console.log('Promise returned with photoOutput created.'); + }) + ``` + +5. CameraManager中接口createVideoOutput新增传递参数profile: Profile,profile参数由getSupportedOutputCapability接口获取,因此旧接口createVideoOutput(surfaceId: string, callback: AsyncCallback): void;以及createVideoOutput(surfaceId: string): Promise;变更为createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void;和createVideoOutput(profile: VideoProfile, surfaceId: string): Promise; + + 参考代码如下: + + ``` + let profile = cameraoutputcapability.videoProfiles[0]; + cameraManager.createVideoOutput(profile, surfaceId, (err, videoOutput) => { + if (err) { + console.error(`Failed to create videoOutput. ${err.message}`); + return; + } + console.log('Callback returned with an array of supported outputCapability' ); + }) + ``` + + ``` + let profile = cameraoutputcapability.videoProfiles[0]; + cameraManager.createVideoOutput(profile, surfaceId).then((videoOutput) => { + console.log('Promise returned with videoOutput created.'); + }) + ``` + +6. CameraManager中接口createMetadataOutput新增传递参数metadataObjectTypes: Array,metadataObjectTypes参数由getSupportedOutputCapability接口获取,因此旧接口function createMetadataOutput(callback: AsyncCallback): void;以及function createMetadataOutput(): Promise;变更为createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void;和createMetadataOutput(metadataObjectTypes: Array): Promise; + + 参考代码如下: + + ``` + let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes; + cameraManager.createMetadataOutput(metadataObjectTypes, (err, metadataOutput) => { + if (err) { + console.error(`Failed to create metadataOutput. ${err.message}`); + return; + } + console.log('Callback returned with metadataOutput created.'); + }) + ``` + + ``` + let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes; + cameraManager.createMetadataOutput(metadataObjectTypes).then((metadataOutput) => { + console.log('Promise returned with metadataOutput created.'); + }) + ``` + +7. CameraManager中createCaptureSession不需要考虑context属性,因此旧接口createCaptureSession(context: Context, callback: AsyncCallback): void;以及createCaptureSession(context: Context): Promise;改为createCaptureSession(callback: AsyncCallback): void;和createCaptureSession(): Promise; + + 参考代码如下: + + ```typescript + cameraManager.createCaptureSession((err, captureSession) => { + if (err) { + console.error(`Failed to create captureSession. ${err.message}`); + return; + } + console.log('Callback returned with captureSession created.'); + }) + ``` + + ``` + cameraManager.createCaptureSession().then((captureSession) => { + console.log('Promise returned with captureSession created.'); + }) + ``` + +8. CameraStatusInfo接口下属性camera类型由Camera变更为CameraDevice + +9. CameraInput中接口on(type: 'error')新增传递参数camera: CameraDevice,因此旧接口on(type: 'error', callback: ErrorCallback): void;变更为on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; + + 参考代码如下: + + ``` + let cameraDevice = cameras[0]; + cameraInput.on('error', cameraDevice, (cameraInputError) => { + console.log(`Camera input error code: ${cameraInputError.code}`); + }) + ``` + +10. CameraInput中以下接口调整到CaptureSession中 + + hasFlash(callback: AsyncCallback): void;
hasFlash(): Promise;
+ + isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void;
isFlashModeSupported(flashMode: FlashMode): Promise;
+ + getFlashMode(callback: AsyncCallback): void;
getFlashMode(): Promise;
+ + setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void;
setFlashMode(flashMode: FlashMode): Promise;
+ + isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void;
isExposureModeSupported(aeMode: ExposureMode): Promise;
+ + getExposureMode(callback: AsyncCallback): void;
getExposureMode(): Promise;
+ + setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void;
setExposureMode(aeMode: ExposureMode): Promise;
+ + getMeteringPoint(callback: AsyncCallback): void;
getMeteringPoint(): Promise;
+ + setMeteringPoint(point: Point, callback: AsyncCallback): void;
setMeteringPoint(point: Point): Promise;
+ + getExposureBiasRange(callback: AsyncCallback>): void;
getExposureBiasRange(): Promise>;
+ + setExposureBias(exposureBias: number, callback: AsyncCallback): void;
setExposureBias(exposureBias: number): Promise;
+ + getExposureValue(callback: AsyncCallback): void;
getExposureValue(): Promise;
+ + isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void;
isFocusModeSupported(afMode: FocusMode): Promise;
+ + getFocusMode(callback: AsyncCallback): void;
getFocusMode(): Promise;
+ + setFocusMode(afMode: FocusMode, callback: AsyncCallback): void;
setFocusMode(afMode: FocusMode): Promise;
+ + setFocusPoint(point: Point, callback: AsyncCallback): void;
setFocusPoint(point: Point): Promise;
+ + getFocusPoint(callback: AsyncCallback): void;
getFocusPoint(): Promise;
+ + getFocalLength(callback: AsyncCallback): void;
getFocalLength(): Promise;
+ + getZoomRatioRange(callback: AsyncCallback>): void;
getZoomRatioRange(): Promise>;
+ + getZoomRatio(callback: AsyncCallback): void;
getZoomRatio(): Promise;
+ + setZoomRatio(zoomRatio: number, callback: AsyncCallback): void;
setZoomRatio(zoomRatio: number): Promise; + +11. CameraInput中接口on(type: 'focusStateChange', callback: AsyncCallback): void;调整到CaptureSession中,对应接口on(type: 'focusStateChange', callback: AsyncCallback): void; + + 参考代码如下: + + ``` + captureSession.on('focusStateChange', (focusState) => { + console.log(`Focus state : ${focusState}`); + }) + ``` + +12. 枚举ExposureMode中 + + 枚举值名称:EXPOSURE_MODE_AUTO,初值由默认变更为1; + + 枚举值名称:EXPOSURE_MODE_CONTINUOUS_AUTO,初值由默认变更为2; + +13. 枚举VideoStabilizationMode中 + + 枚举值名称:LOW,初值由默认变更为1; + + 枚举值名称:MIDDLE,初值由默认变更为2; + + 枚举值名称:HIGH,初值由默认变更为3; + + 枚举值名称:AUTO,初值由默认变更为4; + +14. CaptureSession中接口addOutput参数由原来子类类型(PreviewOutput,PhotoOutput,VideoOutput,MetadataOutput)统一修改为基类类型(CameraOutput),变更后由原来8个接口缩减为2个接口。 + + 改变前接口为: + + addOutput(previewOutput: PreviewOutput, callback: AsyncCallback): void;
addOutput(previewOutput: PreviewOutput): Promise;
addOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void;
addOutput(photoOutput: PhotoOutput): Promise;
addOutput(videoOutput: VideoOutput, callback: AsyncCallback): void;
addOutput(videoOutput: VideoOutput): Promise;
addOutput(metadataOutput: MetadataOutput, callback: AsyncCallback): void;
addOutput(metadataOutput: MetadataOutput): Promise; + + 改变后接口为: + + addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
addOutput(cameraOutput: CameraOutput): Promise; + + 参考代码如下:以PreviewOutput为例 + + ``` + captureSession.addOutput(previewOutput, (err) => { + if (err) { + console.error(`Failed to add output. ${err.message}`); + return; + } + console.log('Callback returned with output added.'); + }) + ``` + + ``` + captureSession.addOutput(previewOutput).then(() => { + console.log('Promise returned with cameraOutput added.'); + }) + ``` + +15. CaptureSession中接口removeOutput参数由原来子类类型(PreviewOutput,PhotoOutput,VideoOutput,MetadataOutput)统一修改为基类类型(CameraOutput),变更后由原来8个接口缩减为2个接口。 + + 改变前接口为: + + removeOutput(previewOutput: PreviewOutput, callback: AsyncCallback): void;
removeOutput(previewOutput: PreviewOutput): Promise;
removeOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void;
removeOutput(photoOutput: PhotoOutput): Promise;
removeOutput(videoOutput: VideoOutput, callback: AsyncCallback): void;
removeOutput(videoOutput: VideoOutput): Promise;
removeOutput(metadataOutput: MetadataOutput, callback: AsyncCallback): void;
removeOutput(metadataOutput: MetadataOutput): Promise; + + 改变后接口为: + + removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
removeOutput(cameraOutput: CameraOutput): Promise; + + 参考代码如下:以PreviewOutput为例 + + ``` + captureSession.removeOutput(previewOutput, (err) => { + if (err) { + console.error(`Failed to remove the CameraOutput instance. ${err.message}`); + return; + } + console.log('Callback invoked to indicate that the CameraOutput instance is removed.'); + }); + ``` + + ``` + captureSession.removeOutput(previewOutput).then(() => { + console.log('Promise returned to indicate that the CameraOutput instance is removed.'); + }) + ``` + +16. 枚举MetadataObjectType中 + + 枚举值名称由FACE变更为FACE_DETECTION; + +17. 接口Camera名称更改为CameraDevice diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-device-manager.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-device-manager.md new file mode 100644 index 0000000000000000000000000000000000000000..fae8ef1cad1a2526e86c85b4be6d64e690e285ce --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-device-manager.md @@ -0,0 +1,106 @@ +# 设备管理changeLog + +## cl.device_manager.1 API错误信息返回方式变更 + +设备管理接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9开始作以下变更: + +异步接口:通过AsyncCallback或Promise的error对象返回错误信息。 + +同步接口:通过抛出异常的方式返回错误信息。 + +**变更影响** + +基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +在以下接口增加错误码处理: + - createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager>): void; + - release(): void; + - getTrustedDeviceListSync(): Array<DeviceInfo> + - getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): void; + - getTrustedDeviceList(): Promise<Array<DeviceInfo>> + - getLocalDeviceInfoSync(): DeviceInfo; + - getLocalDeviceInfo(callback:AsyncCallback<DeviceInfo>): void; + - getLocalDeviceInfo(): Promise<DeviceInfo> + - startDeviceDiscovery(subscribeInfo: SubscribeInfo): void; + - startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void; + - stopDeviceDiscovery(subscribeId: number): void; + - publishDeviceDiscovery(publishInfo: PublishInfo): void; + - unPublishDeviceDiscovery(publishId: number): void; + - authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): void; + - unAuthenticateDevice(deviceInfo: DeviceInfo): void; + - verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, level: number}>): void; + - setUserOperation(operateAction: number, params: string): void; + - on(type: 'uiStateChange', callback: Callback<{ param: string}>): void; + - off(type: 'uiStateChange', callback?: Callback<{ param: string}>): void; + - on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void; + - off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void; + - on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: DeviceInfo }>): void; + - off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: DeviceInfo }>): void; + - on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: number }>): void; + - off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: number }>): void; + - on(type: 'publishSuccess', callback: Callback<{ publishId: number }>): void; + - off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): void; + - on(type: 'publishFail', callback: Callback<{ publishId: number, reason: number }>): void; + - off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: number }>): void; + - on(type: 'serviceDie', callback: () => void): void; + - off(type: 'serviceDie', callback?: () => void): void; + +**适配指导** + +异步接口以getTrustedDeviceList为例,示例代码如下: + +```ts +import account_osAccount from "@ohos.distributedHardware.deviceManager" +dmInstance.getTrustedDeviceList((err, data) => { + console.log("getTrustedDeviceList err: " + JSON.stringify(err)); + console.log('get trusted device info: ' + JSON.stringify(data)); +}); + +try { + dmInstance.getTrustedDeviceList((err, data) => { + if (err) { + console.error("getTrustedDeviceList errCode:" + err.code + ",errMessage:" + err.message); + return; + } + console.log('get trusted device info: ' + JSON.stringify(data)); + }); +} catch (err) { + console.error("getTrustedDeviceList errCode:" + err.code + ",errMessage:" + err.message); +} +``` + +同步接口以startDeviceDiscovery为例,示例代码如下: + +```ts +// 生成发现标识,随机数确保每次调用发现接口的标识不一致 +var subscribeId = Math.floor(Math.random() * 10000 + 1000); +var subscribeInfo = { + "subscribeId": subscribeId, + "mode": 0xAA, // 主动模式 + "medium": 0, // 自动发现类型,同时支持多种发现类型 + "freq": 2, // 高频率 + "isSameAccount": false, + "isWakeRemote": false, + "capability": 1 +}; +dmInstance.startDeviceDiscovery(subscribeInfo); // 当有设备发现时,通过deviceFound回调通知给应用程序 + +// 生成发现标识,随机数确保每次调用发现接口的标识不一致 +var subscribeId = Math.floor(Math.random() * 10000 + 1000); +var subscribeInfo = { + "subscribeId": subscribeId, + "mode": 0xAA, // 主动模式 + "medium": 0, // 自动发现类型,同时支持多种发现类型 + "freq": 2, // 高频率 + "isSameAccount": false, + "isWakeRemote": false, + "capability": 1 +}; +try { + dmInstance.startDeviceDiscovery(subscribeInfo); // 当有设备发现时,通过deviceFound回调通知给应用程序 +} catch (err) { + console.error("startDeviceDiscovery errCode:" + err.code + ",errMessage:" + err.message); +} +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-device-usb.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-device-usb.md new file mode 100644 index 0000000000000000000000000000000000000000..15629e935378b84f4f5aab0bebde0e4523c3ee00 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-device-usb.md @@ -0,0 +1,27 @@ +# USB管理 changeLog + +## cl.usb_manager.1 API错误信息返回方式变更 + +USB管理接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9开始作出变更,选择通过抛出异常的方式返回错误信息。 + +**变更影响** + +基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +USB模块名由@ohos.usb.d.ts 变更为 @ohos.usbV9.d.ts,模块内所有接口均增加错误码处理。 + +**适配指导** + +接口以getDevices为例,示例代码如下: + +```ts +import usbV9 from '@ohos.usbV9' + +try { +usbV9.getDevices(); // 如果给该接口传入不合适的参数,则会抛出异常 +} catch (err) { +console.error("getDevices errCode:" + err.code + ",errMessage:" + err.message); +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-dmsfwk.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-dmsfwk.md new file mode 100644 index 0000000000000000000000000000000000000000..6876e374974e37a027a336788294f9ef6fbf3fdc --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-dmsfwk.md @@ -0,0 +1,122 @@ +# 分布式调度子系统ChangeLog + +## cl.DistributedManagerService.1 continuationManager事件监听接口on/off变更 + +- continuationManager事件监听接口on/off传入的参数事件类型名,命名不符合OpenHarmony的API接口规范。 +- continuationManager.on对于不同的事件接口返回值未进行统一,不符合OpenHarmony的API接口规范。 + +已做出以下变更: + +- continuationManager.on和continuationManager.off的设备选择事件名由原来的"deviceConnect"变更为"deviceSelected",设备取消选择事件名由原来的"deviceDisconnect"变更为"deviceUnselected"。 +- continuationManager.on对于不同事件统一callback返回值类型"Callback<Array<ContinuationResult>>"。 + +**变更影响** + +基于此前版本开发的应用,需适配变更接口,否则会影响原有业务逻辑。 + +**关键的接口/组件变更** + +- 涉及接口 + + continuationManager.on; + continuationManager.off; + +- 变更前: + +```js + function on(type: "deviceConnect", token: number, callback: Callback>): void; + function off(type: "deviceConnect", token: number): void; + function on(type: "deviceDisconnect", token: number, callback: Callback>): void; + function off(type: "deviceDisconnect", token: number): void; +``` + +- 变更后: + +```js + function on(type: "deviceSelected", token: number, callback: Callback>): void; + function off(type: "deviceSelected", token: number): void; + function on(type: "deviceUnselected", token: number, callback: Callback>): void; + function off(type: "deviceUnselected", token: number): void; +``` + +**适配指导** +修改事件名称,示例代码如下: + +continuationManager.on 设备选择事件 + +```ts + let token = 1; + try { + continuationManager.on("deviceSelected", token, (data) => { + console.info('onDeviceSelected len: ' + data.length); + for (let i = 0; i < data.length; i++) { + console.info('onDeviceSelected deviceId: ' + JSON.stringify(data[i].id)); + console.info('onDeviceSelected deviceType: ' + JSON.stringify(data[i].type)); + console.info('onDeviceSelected deviceName: ' + JSON.stringify(data[i].name)); + } + }); + } catch (err) { + console.error('on failed, cause: ' + JSON.stringify(err)); + } +``` + +continuationManager.off 设备选择事件 + +```ts + let token = 1; + try { + continuationManager.off("deviceSelected", token); + } catch (err) { + console.error('off failed, cause: ' + JSON.stringify(err)); + } +``` + +continuationManager.on 设备取消选择事件 + +```ts + let token = 1; + try { + continuationManager.on("deviceUnselected", token, (data) => { + console.info('onDeviceUnselected len: ' + data.length); + for (let i = 0; i < data.length; i++) { + console.info('onDeviceUnselected deviceId: ' + JSON.stringify(data[i].id)); + console.info('onDeviceUnselected deviceType: ' + JSON.stringify(data[i].type)); + console.info('onDeviceUnselected deviceName: ' + JSON.stringify(data[i].name)); + } + console.info('onDeviceUnselected finished.'); + }); + } catch (err) { + console.error('on failed, cause: ' + JSON.stringify(err)); + } +``` + +continuationManager.off 设备取消选择事件 + +```ts + let token = 1; + try { + continuationManager.off("deviceUnselected", token); + } catch (err) { + console.error('off failed, cause: ' + JSON.stringify(err)); + } +``` + +## cl.DistributedManagerService.2 continuationManager接口新增DATASYNC权限校验 + +此前版本continuationManager接口未对调用方进行校验,不符合OpenHarmony的API接口规范。 +已做出以下变更:调用方使用continuationManager前需提前申请"ohos.permission.DISTRIBUTED_DATASYNC"权限。 + +**变更影响** + +基于此前版本开发的应用,需提前申请"ohos.permission.DISTRIBUTED_DATASYNC"权限,否则会影响原有业务逻辑。 + +**关键的接口/组件变更** + +涉及接口 + + - continuationManager.registerContinuation; + - continuationManager.on; + - continuationManager.off; + - continuationManager.unregisterContinuation; + - continuationManager.updateContinuationState; + - continuationManager.startContinuationDeviceManager; \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-dsoftbus.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-dsoftbus.md new file mode 100644 index 0000000000000000000000000000000000000000..e52128d7c3aaf93f56a760fa9cf0e2d95ad6dee4 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-dsoftbus.md @@ -0,0 +1,145 @@ +# 软总线子系统Changelog + +## IPC&RPC API支持异常处理方式和支持传入布尔值与数值选择同步或异步方式发送信息变更 +1. 软总线IPC&RPC部分接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误规范; +2. 支持传入布尔值选择同步或异步方式发送信息。 +#### 变更影响 + +此版本兼容之前的应用开发,不需要适配,后续可调用新增接口支持以下两个变更: +1. 支持异常处理并返回错误码; +2. 提供通过布尔值或通过0与非0数字选择同步或异步发消息。 + +#### 关键接口/组件变更 + +为适配统一的API异常处理方式,对IPC&RPC相关接口进行废弃,并新增对应接口和方法。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。 +| 类名 | 废弃接口 | 新增替换类名 | 新增替代接口 | +| ------------ | ------------ | ------------ | ------------ | +| MessageParcel | static create(): MessageParcel | MessageSequence | static create(): MessageSequence | +| MessageParcel | reclaim(): void | MessageSequence | reclaim(): void | +| MessageParcel | writeRemoteObject(object: IRemoteObject): boolean| MessageSequence |writeRemoteObject(object: IRemoteObject): void| +| MessageParcel | readRemoteObject(): IRemoteObject | MessageSequence | readRemoteObject(): IRemoteObject | +| MessageParcel | writeInterfaceToken(token: string): boolean | MessageSequence | writeInterfaceToken(token: string): void | +| MessageParcel | readInterfaceToken(): string | MessageSequence | readInterfaceToken(): string | +| MessageParcel | getSize(): number | MessageSequence | getSize(): number | +| MessageParcel | getCapacity(): number | MessageSequence | getCapacity(): number| +| MessageParcel | setSize(size: number): boolean | MessageSequence | setCapacity(size: number): void | +| MessageParcel | getReadableBytes(): number | MessageSequence | getReadableBytes(): number | +| MessageParcel | getReadPosition(): number | MessageSequence | getReadPosition(): number | +| MessageParcel | getWritePosition(): number | MessageSequence | getWritePosition(): number | +| MessageParcel | rewindRead(pos: number): boolean | MessageSequence | rewindRead(pos: number): void | +| MessageParcel | rewindWrite(pos: number): boolean | MessageSequence | rewindWrite(pos: number): void | +| MessageParcel | writeNoException(): void | MessageSequence | writeNoException(): void | +| MessageParcel | readException(): void | MessageSequence | readException(): void | +| MessageParcel | writeByte(val: number): boolean | MessageSequence | writeByte(val: number): void | +| MessageParcel | writeShort(val: number): boolean | MessageSequence | writeShort(val: number): void | +| MessageParcel | writeInt(val: number): boolean | MessageSequence | writeInt(val: number): void | +| MessageParcel | writeLong(val: number): boolean | MessageSequence | writeLong(val: number): void | +| MessageParcel | writeFloat(val: number): boolean | MessageSequence | writeFloat(val: number): void | +| MessageParcel | writeDouble(val: number): boolean | MessageSequence | writeDouble(val: number): void | +| MessageParcel | writeBoolean(val: boolean): boolean | MessageSequence | writeBoolean(val: boolean): void | +| MessageParcel | writeChar(val: number): boolean | MessageSequence | writeChar(val: number): void | +| MessageParcel | writeString(val: string): boolean | MessageSequence | writeString(val: string): void | +| MessageParcel | writeSequenceable(val: Sequenceable): boolean | MessageSequence | writeParcelable(val: Parcelable): void | +| MessageParcel | writeByteArray(byteArray: number[]): boolean | MessageSequence | writeByteArray(byteArray: number[]): void | +| MessageParcel | writeShortArray(shortArray: number[]): boolean | MessageSequence | writeShortArray(shortArray: number[]): void | +| MessageParcel | writeIntArray(intArray: number[]): boolean | MessageSequence | writeIntArray(intArray: number[]): void | +| MessageParcel | writeLongArray(longArray: number[]): boolean | MessageSequence | writeLongArray(longArray: number[]): void | +| MessageParcel | writeFloatArray(floatArray: number[]): boolean | MessageSequence | writeFloatArray(floatArray: number[]): void | +| MessageParcel | writeDoubleArray(doubleArray: number[]): boolean | MessageSequence | writeDoubleArray(doubleArray: number[]): void | +| MessageParcel | writeBooleanArray(booleanArray: boolean[]): boolean | MessageSequence | writeBooleanArray(booleanArray: boolean[]): void | +| MessageParcel | writeCharArray(charArray: number[]): boolean | MessageSequence | writeCharArray(charArray: number[]): void | +| MessageParcel | writeStringArray(stringArray: string[]): boolean | MessageSequence | writeStringArray(stringArray: string[]): void | +| MessageParcel | writeSequenceableArray(sequenceableArray: Sequenceable[]): boolean | MessageSequence | writeParcelableArray(sequenceableArray: Parcelable[]): void | +| MessageParcel | writeRemoteObjectArray(objectArray: IRemoteObject[]): boolean | MessageSequence | writeRemoteObjectArray(objectArray: IRemoteObject[]): void | +| MessageParcel | readByte(): number | MessageSequence | readByte(): number | +| MessageParcel | readShort(): number | MessageSequence | readShort(): number | +| MessageParcel | readLong(): number | MessageSequence | readLong(): number | +| MessageParcel | readFloat(): number | MessageSequence | readFloat(): number | +| MessageParcel | readDouble(): number | MessageSequence | readDouble(): number | +| MessageParcel | readBoolean(): boolean | MessageSequence | readBoolean(): boolean | +| MessageParcel | readChar(): number | MessageSequence | readChar(): number | +| MessageParcel | readString(): string | MessageSequence | readString(): string | +| MessageParcel | readSequenceable(dataIn: Sequenceable) : boolean | MessageSequence | readSequenceable(dataIn: Parcelable) : void | +| MessageParcel | readByteArray(dataIn: number[]) : void | MessageSequence | readByteArray(dataIn: number[]) : void | +| MessageParcel | readByteArray(): number[] | MessageSequence | readByteArray(): number[] | +| MessageParcel | readShortArray(dataIn: number[]) : void | MessageSequence | readShortArray(dataIn: number[]) : void | +| MessageParcel | readShortArray(): number[] | MessageSequence | readShortArray(): number[] | +| MessageParcel | readIntArray(dataIn: number[]) : void | MessageSequence | readIntArray(dataIn: number[]) : void | +| MessageParcel | readIntArray() : number[] | MessageSequence | readIntArray() : number[] | +| MessageParcel | readLongArray(dataIn: number[]) : void | MessageSequence | readLongArray(dataIn: number[]) : void | +| MessageParcel | readLongArray(): number[] | MessageSequence | readLongArray(): number[] | +| MessageParcel | readFloatArray(dataIn: number[]) : void | MessageSequence | readFloatArray(dataIn: number[]) : void | +| MessageParcel | readFloatArray(): number[] | MessageSequence | readFloatArray(): number[] | +| MessageParcel | readDoubleArray(dataIn: number[]) : void | MessageSequence | readDoubleArray(dataIn: number[]) : void | +| MessageParcel | readDoubleArray(): number[] | MessageSequence | readDoubleArray(): number[] | +| MessageParcel | readBooleanArray(dataIn: boolean[]) : void | MessageSequence | readBooleanArray(dataIn: boolean[]) : void | +| MessageParcel | readBooleanArray(): boolean[] | MessageSequence | readBooleanArray(): boolean[] | +| MessageParcel | readCharArray(dataIn: number[]) : void | MessageSequence | readCharArray(dataIn: number[]) : void | +| MessageParcel | readCharArray(): number[] | MessageSequence | readCharArray(): number[] | +| MessageParcel | readStringArray(dataIn: string[]) : void | MessageSequence | readStringArray(dataIn: string[]) : void | +| MessageParcel | readStringArray(): string[] | MessageSequence | readStringArray(): string[] | +| MessageParcel | readSequenceableArray(sequenceableArray: Sequenceable[]): void | MessageSequence | readSequenceableArray(sequenceableArray: Parcelable[]): void | +| MessageParcel | readRemoteObjectArray(objects: IRemoteObject[]): void | MessageSequence | readRemoteObjectArray(objects: IRemoteObject[]): void | +| MessageParcel | readRemoteObjectArray(): IRemoteObject[] | MessageSequence | readRemoteObjectArray(): IRemoteObject[] | +| MessageParcel | static closeFileDescriptor(fd: number): void | MessageSequence | static closeFileDescriptor(fd: number): void | +| MessageParcel | static dupFileDescriptor(fd: number) :number | MessageSequence | static dupFileDescriptor(fd: number) :number | +| MessageParcel | containFileDescriptors(): boolean | MessageSequence | containFileDescriptors(): boolean | +| MessageParcel | writeFileDescriptor(fd: number): boolean | MessageSequence | writeFileDescriptor(fd: number): void | +| MessageParcel | readFileDescriptor(): number | MessageSequence | readFileDescriptor(): number | +| MessageParcel | writeAshmem(ashmem: Ashmem): boolean | MessageSequence | writeAshmem(ashmem: Ashmem): void | +| MessageParcel | readAshmem(): Ashmem | MessageSequence | readAshmem(): Ashmem | +| MessageParcel | writeRawData(rawData: number[], size: number): boolean | MessageSequence | writeRawData(rawData: number[], size: number): void | +| MessageParcel | readRawData(size: number): number[] | MessageSequence | readRawData(size: number): number[] | +| Sequenceable | marshalling(dataOut: MessageParcel): boolean | Parcelable | marshalling(dataOut: MessageSequence): boolean | +| Sequenceable | unmarshalling(dataIn: MessageParcel) : boolean | Parcelable | unmarshalling(dataIn: MessageSequence) : boolean | +| SendRequestResult | errCode: number | RequestResult | errCode: number | +| SendRequestResult | code: number | RequestResult | code: number | +| SendRequestResult | data: MessageParcel | RequestResult | data: MessageSequence | +| SendRequestResult | reply: MessageParcel | RequestResult | reply: MessageSequence | +| IRemoteObject | queryLocalInterface(descriptor: string): IRemoteBroker | NA | getLocalInterface(descriptor: string): IRemoteBroker | +| IRemoteObject | getInterfaceDescriptor(): string | NA | getDescriptor(): string | +| IRemoteObject | addDeathRecipient(recipient: DeathRecipient, flags: number): boolean | NA | registerDeathRecipient(recipient: DeathRecipient, flags: number): void | +| IRemoteObject | removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean | NA | unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void | +| IRemoteObject | NA | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise | +| IRemoteObject | sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback): void | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption,callback: AsyncCallback): void | +| MessageOption | NA | NA | isAsync(): boolean | +| MessageOption | NA | NA | setAsync(async: boolean): void | +| MessageOption | NA | NA | constructor(async?: boolean) | +| RemoteObject | queryLocalInterface(descriptor: string): IRemoteBroker | NA | getLocalInterface(descriptor: string): IRemoteBroker | +| RemoteObject | attachLocalInterface(localInterface: IRemoteBroker, descriptor: string): void | NA | modifyLocalInterface(localInterface: IRemoteBroker, descriptor: string): void | +| RemoteObject | getInterfaceDescriptor(): string | NA | getDescriptor(): string | +| RemoteObject | onRemoteRequestEx(code : number, data : MessageParcel, reply: MessageParcel, options : MessageOption): boolean \| Promise | NA | onRemoteMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): boolean \| Promise | +| RemoteObject | sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise | +| RemoteObject | sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback): void | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback): void | +| RemoteProxy | queryLocalInterface(interface: string): IRemoteBroker | NA | getLocalInterface(descriptor: string): IRemoteBroker | +| RemoteProxy | getInterfaceDescriptor(): string | NA | getDescriptor(): string | +| RemoteProxy | addDeathRecipient(recipient: DeathRecipient, flags: number): boolean | NA | registerDeathRecipient(recipient: DeathRecipient, flags: number): void | +| RemoteProxy | removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean | NA | unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void | +| RemoteProxy | NA | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise | +| RemoteProxy | sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback): void | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback): void | +| IPCSkeleton | static flushCommands(object: IRemoteObject): number | NA | static flushCmdBuffer(object: IRemoteObject): void | +| IPCSkeleton | static setCallingIdentity(identity: string): boolean | NA | static restoreCallingIdentity(identity: string): void | +| Ashmem | static createAshmem(name: string, size: number): Ashmem | NA | static create(name: string, size: number): Ashmem | +| Ashmem | static createAshmemFromExisting(ashmem: Ashmem): Ashmem | NA | static create(ashmem: Ashmem): Ashmem | +| Ashmem | mapAshmem(mapType: number): boolean | NA | mapTypedAshmem(mapType: number): void | +| Ashmem | mapReadAndWriteAshmem(): boolean | NA | mapReadWriteAshmem(): void | +| Ashmem | mapReadOnlyAshmem(): boolean | NA | mapReadonlyAshmem(): void | +| Ashmem | setProtection(protectionType: number): boolean | NA | setProtectionType(protectionType: number): void | +| Ashmem | writeToAshmem(buf: number[], size: number, offset: number): boolean | NA | writeAshmem(buf: number[], size: number, offset: number): void | +| Ashmem | readFromAshmem(size: number, offset: number): number[] | NA | readAshmem(size: number, offset: number): number[] | + +#### 适配指导 + +新增的接口以抛异常的方式返回错误码及对应的错误信息,以MessageParcel中的create接口为例,使用示例代码如下: +```js +import rpc from '@ohos.rpc' + +try { + var data = rpc.MessageParcel.create(); + data.reclaim(); +} catch (error) { + console.info("create meassageParcel failed, errorCode = " + error.errCode); + console.info("create meassageParcel failed, errorMessage = " + error.errorMessage); +} +``` +更多接口的示例代码可参考[RPC通信API文档](../../../application-dev/reference/apis/js-apis-rpc.md)。 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-enterprise_device_management.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-enterprise_device_management.md new file mode 100644 index 0000000000000000000000000000000000000000..1a345ef8f67651188c67f4365154d16c5102f1d0 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-enterprise_device_management.md @@ -0,0 +1,157 @@ +# 定制子系统ChangeLog + +## cl.Customization.1 企业设备管理模块名称变更 + +从Opeharmonny 3.2.8.3版本开始,将"@ohos.enterpriseDeviceManager.d.ts"改为"@ohos.enterprise.adminManager.d.ts",开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +在Opeharmonny 3.2.8.3之前版本已开发的应用,需要进行适配动才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + +| 原接口 | 新接口 | +| --------------------------------- | ---------------------------------- | +| @ohos.enterpriseDeviceManager.d.ts | @ohos.enterprise.adminManager.d.ts | + +**适配指导** + +如上所述,仅将老接口平移到了新的namespace中,所以可以通过修改import来解决适配问题: + +如原先接口使用了@ohos.enterpriseDeviceManager: + +```js +import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager'; +``` + +可以通过直接修改import,来切换到新的namespace上: + +```js +import enterpriseDeviceManager from '@ohos.enterprise.adminManager'; +``` + +## cl.Customization.2 enterpriseDeviceManager/DeviceSettingsManager.d.ts模块变更 + +从Opeharmonny 3.2.8.3版本开始,将enterpriseDeviceManager/DeviceSettingsManager.d.ts更改为"ohos.enterprise.dateTimeManager.d.ts"。 + +**变更影响** + +在Opeharmonny 3.2.8.3之前版本已开发的应用,需要进行适配动才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + +| 原接口 | 原接口类型 | 新接口 | 新接口类型 | +| --------------------------------- | --------- | ---------------------------------- | ----- | +| enterpriseDeviceManager/DeviceSettingsManager.d.ts | interface | @ohos.enterprise.dateTimeManager.d.ts | namespace | + +**适配指导** + +若原先使用的enterpriseDeviceManager/DeviceSettingsManager.d.ts的setDateTime接口。 + +```js +import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager' + +let wantTemp = { + bundleName: "bundleName", + abilityName: "abilityName", +}; +enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => { + if (error) { + console.log("error code:" + error.code + " error message:" + error.message); + return; + } + mgr.setDateTime(wantTemp, 1526003846000, (error) => { + if (error) { + console.log("error code:" + error.code + " error message:" + error.message); + } + }); +}); +``` + +需要import新的namespace进行适配。 + +```js +import dateTimeManager from '@ohos.enterprise.dateTimeManager' + +let wantTemp = { + bundleName: "bundleName", + abilityName: "abilityName", +}; +dateTimeManager.setDateTime(wantTemp, 1526003846000, (error) => { + if (error) { + console.log("error code:" + error.code + " error message:" + error.message); + } +}) +``` + +## cl.Customization.3 systemapi变更 + +从Opeharmonny 3.2.8.3版本开始,企业设备管理所有接口变更为systemapi。 + +**变更影响** + +所有接口只允许系统应用调用,非系统应用无法调用接口。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise<**void**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, userId: number, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, userId?: number): Promise<**void**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** disableSuperAdmin(bundleName: String, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** disableSuperAdmin(bundleName: String): Promise<**void**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** isAdminEnabled(admin: Want, callback: AsyncCallback<**boolean**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback<**boolean**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** isAdminEnabled(admin: Want, userId?: number): Promise<**boolean**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** getEnterpriseInfo(admin: Want, callback: AsyncCallback<**EnterpriseInfo**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** getEnterpriseInfo(admin: Want): Promise<**EnterpriseInfo**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise<**void**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** isSuperAdmin(bundleName: String, callback: AsyncCallback<**boolean**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** isSuperAdmin(bundleName: String): Promise<**boolean**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** subscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** subscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>): Promise<**void**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** unsubscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** unsubscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>): Promise<**void**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **interface** EnterpriseInfo | systemapi | +| @ohos.enterprise.adminManager | adminManager | **enum** AdminType | systemapi | +| @ohos.enterprise.adminManager | adminManager | **enum** ManagedEvent | systemapi | +| @ohos.enterprise.dataTimeManager | dateTimeManager | **function** setDateTime(admin: Want, time: number, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.dataTimeManager | dateTimeManager | **function** setDateTime(admin: Want, time: number): Promise<**void**>; | systemapi | + +## cl.Customization.4 接口权限变更 + +从Opeharmonny 3.2.8.3版本开始,部分接口新增权限校验。 + +**变更影响** + +在Opeharmonny 3.2.8.3之前版本已开发的应用,需要持有相应权限,否则无法正常调用接口。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 新增权限 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise<**void**>; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, userId: number, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, userId?: number): Promise<**void**>; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** disableSuperAdmin(bundleName: String, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** disableSuperAdmin(bundleName: String): Promise<**void**>; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCallback<**void**>): void; | ohos.permission.SET_ENTERPRISE_INFO | +| @ohos.enterprise.adminManager | adminManager | **function** setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise<**void**>; | ohos.permission.SET_ENTERPRISE_INFO | +| @ohos.enterprise.adminManager | adminManager | **function** subscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>, callback: AsyncCallback<**void**>): void; | ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT | +| @ohos.enterprise.adminManager | adminManager | **function** subscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>): Promise<**void**>; | ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT | +| @ohos.enterprise.adminManager | adminManager | **function** unsubscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>, callback: AsyncCallback<**void**>): void; | ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT | +| @ohos.enterprise.adminManager | adminManager | **function** unsubscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>): Promise<**void**>; | ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT | +| @ohos.enterprise.dataTimeManager | dateTimeManager | **function** setDateTime(admin: Want, time: number, callback: AsyncCallback<**void**>): void; | ohos.permission.ENTERPRISE_SET_DATETIME | +| @ohos.enterprise.dataTimeManager | dateTimeManager | **function** setDateTime(admin: Want, time: number): Promise<**void**>; | ohos.permission.ENTERPRISE_SET_DATETIME | + +**适配指导** + +调用以上接口,需要申请相应的权限才能正常调用。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-filemanagement.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-filemanagement.md new file mode 100644 index 0000000000000000000000000000000000000000..15cf796c6820cfb09820d43fe3e4c52d7b7f15f9 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-filemanagement.md @@ -0,0 +1,90 @@ +# 文件管理子系统ChangeLog + +## cl.filemanagement.1 fileio相关接口异常处理方式变更 + +file_api部件fileio接口返回值不包含错误码error.code,现进行错误码整改,废弃原有相关接口,新增相关接口。 + +**变更影响** + +基于此前版本开发的应用,需注意废弃接口的迭代更新。新接口在接口规格上进行了微调,需注意新接口使用方法。 + +**关键接口/组件变更** + +为适配统一的API异常处理方式,对fileio相关接口进行废弃,并新增对应接口,原接口位于@ohos.fileio,新接口位于@ohos.file.fs。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致,参数上有微调。 + +| 模块名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------------------------------------------------ | -------- | +| @ohos.fileio | **function** open(path: string, flags?: number, mode?: number, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** openSync(path: string, flags?: number, mode?: number): number; | 废弃 | +| @ohos.file.fs | **function** open(path: string, mode?: number, callback?: AsyncCallback): void \| Promise; | 新增 | +| @ohos.file.fs | **function** openSync(path: string, mode?: number): File; | 新增 | +| @ohos.fileio | **function** read(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** readSync(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }): number; | 废弃 | +| @ohos.file.fs | **function** read(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }, callback?: AsyncCallback): void \| Promise; | 新增 | +| @ohos.file.fs | **function** readSync(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }): number; | 新增 | +| @ohos.fileio | **function** stat(path: string, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** statSync(path: string): Stat; | 废弃 | +| @ohos.fileio | **function** fstat(fd: number, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** fstatSync(fd: number): Stat; | 废弃 | +| @ohos.file.fs | **function** stat(file: string \| number, callback?: AsyncCallback): void \| Promise; | 新增 | +| @ohos.file.fs | **function** statSync(file: string \| number): Stat; | 新增 | +| @ohos.fileio | **function** truncate(path: string, len?: number, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** truncateSync(path: string, len?: number): void; | 废弃 | +| @ohos.fileio | **function** ftruncate(fd: number, len?: number, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** ftruncateSync(fd: number, len?: number): void; | 废弃 | +| @ohos.file.fs | **function** truncate(file: string \| number, len?: number, callback?: AsyncCallback): void \| Promise; | 新增 | +| @ohos.file.fs | **function** truncateSync(file: string \| number, len?: number): void; | 新增 | +| @ohos.fileio | **function** write(fd: number, buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** writeSync(fd: number, buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }): number; | 废弃 | +| @ohos.file.fs | **function** write(fd: number, buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; encoding?: string; }, callback?: AsyncCallback): void \| Promise; | 新增 | +| @ohos.file.fs | **function** writeSync(fd: number, buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; encoding?: string; }): number; | 新增 | + +**适配指导** + +原接口使用的是@ohos.fileio,以以下方式import: + +```js +import fileio from '@ohos.fileio'; +``` + +现新接口使用的是@ohos.file.fs,以以下方式import: + +```js +import fs from '@ohos.file.fs'; +``` + +此外还需要适配异常处理,同步接口异常处理示例代码: +```js +import fs from '@ohos.file.fs' + +try { + let file = fs.openSync(path, fs.OpenMode.READ_ONLY); +} catch (err) { + console.error("openSync errCode:" + err.code + ", errMessage:" + err.message); +} +``` +异步接口promise方法异常处理示例代码: +```js +import fs from '@ohos.file.fs' + +try { + let file = await fs.open(path, fs.OpenMode.READ_ONLY); +} catch (err) { + console.error("open promise errCode:" + err.code + ", errMessage:" + err.message); +} +``` + +异步接口callback方法异常处理示例代码: +```js +import fs from '@ohos.file.fs' + +try { + fs.open(path, fs.OpenMode.READ_ONLY, function(e, file){ //异步线程的错误(如系统调用等)在回调中获取 + if (e) { + console.error("open in async errCode:" + e.code + ", errMessage:" + e.message); + } + }); +} catch (err) { //主线程的错误(如非法参数等)通过try catch获取 + console.error("open callback errCode:" + err.code + ", errMessage:" + err.message); +} +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-geolocation.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-geolocation.md new file mode 100644 index 0000000000000000000000000000000000000000..0831c78d7b4c0688e87bea0294806f43ccb74640 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-geolocation.md @@ -0,0 +1,116 @@ +# 位置服务子系统ChangeLog + +## cl.location.1 系统API和API9接口迁移到新增的@ohos.geoLocationManager.d.ts + +@ohos.geolocation.d.ts接口不支持抛出错误码,而API9和systemApi都需要支持抛出错误码,为了支持该功能,把@ohos.geolocation.d.ts中systemApi和API9所有接口,迁移到新增的@ohos.geoLocationManager.d.ts中,并增加错误码描述。 + +后续需要import @ohos.geoLocationManager才能使用位置服务的系统API和API9接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + + +**变更影响** + +仅对系统API和API9所有接口的使用有影响,需要import @ohos.geoLocationManager才能使用位置服务的系统API和API9接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + +对于其他接口无影响。 + +**关键的接口/组件变更** + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +|geolocation| namespace | declare namespacegeolocation| API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation | interface | export interface ReverseGeocodingMockInfo | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation | interface | export interface LocationMockConfig | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation | interface | export interface CountryCode | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation | enum | export enum CountryCodeType | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation.GeoAddress | field | isFromMock?: Boolean; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation.Location | field | isFromMock?: Boolean; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation.GeoLocationErrorCode | field | NOT_SUPPORTED = 100 | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation.GeoLocationErrorCode | field | QUERY_COUNTRY_CODE_ERROR | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'countryCodeChange', callback: Callback<CountryCode>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'countryCodeChange', callback?: Callback<CountryCode>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCountryCode(callback: AsyncCallback<CountryCode>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCountryCode(): Promise<CountryCode>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback<void>): void; | API9接口变更,该接口删除。 | +|geolocation| method | function enableLocationMock(callback: AsyncCallback<void>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableLocationMock(scenario: LocationRequestScenario): Promise<void>; | API9接口变更,该接口删除。 | +|geolocation| method | function enableLocationMock(): Promise<void>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback<void>): void; | API9接口变更,该接口删除。 | +|geolocation| method | function disableLocationMock(callback: AsyncCallback<void>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableLocationMock(scenario: LocationRequestScenario): Promise<void>; | API9接口变更,该接口删除。 | +|geolocation| method | function disableLocationMock(): Promise<void>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function setMockedLocations(config: LocationMockConfig, callback: AsyncCallback<void>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function setMockedLocations(config: LocationMockConfig): Promise<void>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableReverseGeocodingMock(callback: AsyncCallback<void>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableReverseGeocodingMock(): Promise<void>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableReverseGeocodingMock(callback: AsyncCallback<void>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableReverseGeocodingMock(): Promise<void>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>, callback: AsyncCallback<void>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): Promise<void>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType, callback: AsyncCallback<boolean>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType): Promise<boolean>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback<boolean>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts,callback返回值改为void。 | +|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): Promise<boolean>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts,promise返回值改为void。 | + +**适配指导(可选,不涉及则可以删除)** + +以enableLocation为例,在新版本上需要使用如下方式进行调用: + + ```ts + import geoLocationManager from '@ohos.geoLocationManager'; + try { + geoLocationManager.enableLocation((err, data) => { + if (err) { + console.log('enableLocation: err=' + JSON.stringify(err)); + } + }); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } + ``` + +## cl.location.2 位置服务权限变更 + +从API9开始,增加ohos.permission.APPROXIMATELY_LOCATION,表示模糊位置权限。 + +如果应用开发者使用的API版本大于等于9,则需要同时申请ohos.permission.LOCATION和ohos.permission.APPROXIMATELY_LOCATION,单独申请ohos.permission.LOCATION会失败。 + +**变更影响** + +如果是存量应用(使用的API版本小于9),则无影响。如果使用的API版本大于等于9,位置服务权限申请方式有变更,详情如下: + +应用在使用系统能力前,需要检查是否已经获取用户授权访问设备位置信息。如未获得授权,可以向用户申请需要的位置权限,申请方式请参考下文。 + +系统提供的定位权限有: + +- ohos.permission.LOCATION + +- ohos.permission.APPROXIMATELY_LOCATION + +- ohos.permission.LOCATION_IN_BACKGROUND + +访问设备的位置信息,必须申请权限,并且获得用户授权。 + +API9之前的版本,申请ohos.permission.LOCATION即可。 + +API9及之后的版本,需要申请ohos.permission.APPROXIMATELY_LOCATION或者同时申请ohos.permission.APPROXIMATELY_LOCATION和ohos.permission.LOCATION;无法单独申请ohos.permission.LOCATION。 + +| 使用的API版本 | 申请位置权限 | 申请结果 | 位置的精确度 | +| -------- | -------- | -------- | -------- | +| 小于9 | ohos.permission.LOCATION | 成功 | 获取到精准位置,精准度在米级别。 | +| 大于等于9 | ohos.permission.LOCATION | 失败 | 无法获取位置。 | +| 大于等于9 | ohos.permission.APPROXIMATELY_LOCATION | 成功 | 获取到模糊位置,精确度为5公里。 | +| 大于等于9 | ohos.permission.APPROXIMATELY_LOCATION和ohos.permission.LOCATION | 成功 | 获取到精准位置,精准度在米级别。 | + +如果应用在后台运行时也需要访问设备位置,除需要将应用声明为允许后台运行外,还必须申请ohos.permission.LOCATION_IN_BACKGROUND权限,这样应用在切入后台之后,系统可以继续上报位置信息。 + +开发者可以在应用配置文件中声明所需要的权限,具体可参考[授权申请指导](../../../application-dev/security/accesstoken-guidelines.md)。 + +**关键的接口/组件变更** + +如果是存量应用(使用的API版本小于9),则无影响。 + +如果使用的API版本大于等于9,则在使用@ohos.geolocation和@ohos.geoLocationManager中需要ohos.permission.LOCATION权限的接口时,都需要按照上文所述方式申请对应权限。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-global.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-global.md new file mode 100644 index 0000000000000000000000000000000000000000..43a763edc7a96ede06965ce6a1d432ddecf823d4 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-global.md @@ -0,0 +1,57 @@ +# 全球化子系统ChangeLog + +## cl.global.1 国际化模块接口支持错误码 + +全球化子系统国际化组件在如下场景中提供的接口修改为支持错误码。从API9开始作以下变更: + - 获取国家、语言的本地化显示 + - 获取系统支持的语言列表、语言支持的地区列表 + - 判断语言与地区是否匹配 + - 获取、设置系统语言、系统国家或地区、系统区域 + - 获取、设置系统24小时制 + - 获取、添加、移除系统偏好语言 + - 获取、设置本地化数字 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +上述接口修改为System类的静态方法,调用时需要在模块名后加上类名。 +设置类接口,返回值由boolean类型修改为void类型。例如,setSystemLanguage接口。 +接口调用失败时会根据失败原因抛出相应的错误码。例如,当应用未正确配置权限时,抛出201错误码。 + +**关键的接口/组件变更** + + - 涉及接口 + - getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string; + - getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string; + - getSystemLanguages(): Array; + - getSystemCountries(language: string): Array; + - isSuggested(language: string, region?: string): boolean; + - getSystemLanguage(): string; + - setSystemLanguage(language: string): void; + - getSystemRegion(): string; + - setSystemRegion(region: string): void; + - getSystemLocale(): string; + - setSystemLocale(locale: string): void; + - is24HourClock(): boolean; + - set24HourClock(option: boolean): void; + - addPreferredLanguage(language: string, index?: number): void; + - removePreferredLanguage(index: number): void; + - getPreferredLanguageList(): Array; + - getFirstPreferredLanguage(): string; + - getAppPreferredLanguage(): string; + - setUsingLocalDigit(flag: boolean): void; + - getUsingLocalDigit(): boolean; + +**适配指导** + +使用try-catch块捕获接口抛出的日常。 +``` +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}.`) +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-inputmethod-framworks.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-inputmethod-framworks.md new file mode 100644 index 0000000000000000000000000000000000000000..2f2096bfbc50c7558cc65e95d22d93fae5b0eaf7 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-inputmethod-framworks.md @@ -0,0 +1,196 @@ +# 输入法框架changeLog + +## cl.inputmethod_frameworks.1 API错误信息返回方式变更 + +下列模块内部接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。在API9进行变更。 + + - 输入法框架模块:系统接口,@ohos.inputmethod.d.ts + + - 输入法服务模块:系统接口,@ohos.inputmethodengine.d.ts + + - 输入法ExtentionAbility模块:系统接口,@ohos.inputmethodextensionability.d.ts + + - 输入法ExtentionContext模块:系统接口,@ohos.inputmethodextensioncontext.d.ts + + - 输入法子类型模块:系统接口,@ohos.inputMethodSubtype.d.ts + +异步接口:通过AsyncCallback或Promise的error对象返回错误信息。 + +同步接口:通过抛出异常的方式返回错误信息。 + +**变更影响** + +基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +在以下接口增加错误码处理: + - getSetting(): InputMethodSetting; + - getController(): InputMethodController; + - switchInputMethod(target: InputMethodProperty, callback: AsyncCallback): void; + - switchInputMethod(target: InputMethodProperty): Promise; + - switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback): void; + - switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise; + - switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype, callback: AsyncCallback): void; + - switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype): Promise; + - listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: AsyncCallback>): void; + - listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise>; + - listCurrentInputMethodSubtype(callback: AsyncCallback>): void; + - listCurrentInputMethodSubtype(): Promise>; + - getInputMethods(enable: boolean, callback: AsyncCallback>): void; + - getInputMethods(enable: boolean): Promise>; + - showOptionalInputMethods(callback: AsyncCallback): void; + - showOptionalInputMethods(): Promise; + - stopInputSession(callback: AsyncCallback): void; + - stopInputSession(): Promise; + - showSoftKeyboard(callback: AsyncCallback): void; + - showSoftKeyboard():Promise; + - hideSoftKeyboard(callback: AsyncCallback): void; + - hideSoftKeyboard():Promise; + - hide(callback: AsyncCallback): void; + - hide(): Promise; + - onCreate(want: Want): void; + - onDestroy(): void; + InputClient 接口下: + - sendKeyFunction(action: number, callback: AsyncCallback): void; + - sendKeyFunction(action: number): Promise; + - deleteForward(length: number, callback: AsyncCallback): void; + - deleteForward(length: number): Promise; + - deleteBackward(length: number, callback: AsyncCallback): void; + - deleteBackward(length: number): Promise; + - insertText(text: string, callback: AsyncCallback): void; + - insertText(text: string): Promise; + - getForward(length: number, callback: AsyncCallback): void; + - getForward(length: number): Promise; + - getBackward(length: number, callback: AsyncCallback): void; + - getBackward(length: number): Promise; + - getEditorAttribute(callback: AsyncCallback): void; + - getEditorAttribute(): Promise; + - moveCursor(direction: number, callback: AsyncCallback): void; + - moveCursor(direction: number): Promise; + InputMethodExtensionAbility 类下: + - onCreate(want: Want): void; + - onDestroy(): void; + +**适配指导** + +异步接口以showOptionalInputMethods为例,示例代码如下: + +callback回调: + +```js +import inputMethod from '@ohos.inputmethod'; +let inputMethodSetting = inputMethod.getSetting(); +try { + inputMethodSetting.showOptionalInputMethods((err, data) => { + if (err !== undefined) { + console.error('Failed to showOptionalInputMethods: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in showing optionalInputMethods.'); + }); +} catch (err) { + console.error('Failed to showOptionalInputMethods: ' + JSON.stringify(err)); +} +``` + +Promise回调: + +```js +import inputMethod from '@ohos.inputmethod'; +let inputMethodSetting = inputMethod.getSetting(); +inputMethodSetting.showOptionalInputMethods().then((data) => { + console.info('Succeeded in showing optionalInputMethods.'); +}).catch((err) => { + console.error('Failed to showOptionalInputMethods: ' + JSON.stringify(err)); +}) +``` + +## cl.inputmethod_frameworks.2 API部分接口废弃 + +以下接口标记废除: + - getInputMethodSetting(): InputMethodSetting; + - getInputMethodController(): InputMethodController; + - listInputMethod(callback: AsyncCallback>): void; + - listInputMethod(): Promise>; + - displayOptionalInputMethod(callback: AsyncCallback): void; + - displayOptionalInputMethod(): Promise; + - stopInput(callback: AsyncCallback): void; + - stopInput(): Promise; + interface InputMethodProperty: + - readonly packageName: string; + - readonly methodId: string; + - getInputMethodEngine(): InputMethodEngine; + - createKeyboardDelegate(): KeyboardDelegate; + - hideKeyboard(callback: AsyncCallback): void; + - hideKeyboard(): Promise; + +替代接口如下: + - getSetting(): InputMethodSetting; + - getController(): InputMethodController; + - getInputMethods(enable: boolean, callback: AsyncCallback>): void; + - getInputMethods(enable: boolean): Promise>; + - showOptionalInputMethods(callback: AsyncCallback): void; + - showOptionalInputMethods(): Promise; + - stopInputSession(callback: AsyncCallback): void; + - stopInputSession(): Promise; + interface InputMethodProperty: + - readonly name: string; + - readonly id: string; + - getInputMethodAbility(): InputMethodAbility; + - getKeyboardDelegate(): KeyboardDelegate; + - hide(callback: AsyncCallback): void; + - hide(): Promise; + +**特别注意:** + 使用getInputMethodAbility()接口获取到InputMethodAbility对象,代替使用getInputMethodEngine()接口获取InputMethodEngine对象。 + 使用InputMethodAbility中的方法,不要再使用InputMethodEngine中的方法。 + 使用InputMethodAbility中的on('inputStart')方法,获取到KeyboardController实例与InputClient实例,不要再使用InputMethodEngine中的on('inputStart')方法去获取TextInputClient实例。 +之前: + +```js +inputMethodEngine.getInputMethodEngine().on('inputStart', (kbController, textClient) => { + let keyboardController = kbController; + let textInputClient = textClient; // 获取到TextInputClient实例 +}); +``` + +之后: +```js +inputMethodEngine.getInputMethodAbility().on('inputStart', (kbController, client) => { + let keyboardController = kbController; + let inputClient = client; // // 获取到InputClient实例 +}); +``` + +## cl.inputmethod_frameworks.3 API部分接口变更 + +变更前: + - listInputMethod(enable: boolean, callback: AsyncCallback>): void; + - listInputMethod(enable: boolean): Promise>; + - terminateSelf(callback: AsyncCallback): void; + - terminateSelf(): Promise; + +变更后: + - getInputMethods(enable: boolean, callback: AsyncCallback>): void; + - getInputMethods(enable: boolean): Promise>; + - destroy(callback: AsyncCallback): void; + - destroy(): Promise; + +删除API9接口: + - startAbility(want: Want, callback: AsyncCallback): void; + - startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + - startAbility(want: Want, options?: StartOptions): Promise; + +其他新增接口: + - on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void; + - off(type: 'imeChange', callback?: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void; + - interface InputMethodProperty: + - readonly label?: string; + - readonly icon?: string; + - readonly iconId?: number; + - extra: object; + + - interface InputMethodAbility: + - on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => void): void; + - off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => void): void; \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-multimedia.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-multimedia.md new file mode 100644 index 0000000000000000000000000000000000000000..9d85704839aa1e97c7f24dda8349d678c08ce1cc --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-multimedia.md @@ -0,0 +1,262 @@ +# 多媒体子系统ChangeLog + +## cl.multimedia.audio.001 getRoutingManager()调用方式变更 + +getRoutingManager()接口的调用方法由异步变为同步。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 +```js +getRoutingManager(callback: AsyncCallback): void; +getRoutingManager(): Promise; +``` +变更后 +```js +getRoutingManager(): AudioRoutingManager; +``` + + +## cl.multimedia.audio.002 getStreamManager()调用方式变更 + +getStreamManager()接口的调用方法由异步变为同步。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 +```js +getStreamManager(callback: AsyncCallback): void; +getStreamManager(): Promise; +``` +变更后 +```js +getStreamManager(): AudioStreamManager; +``` + + +## cl.multimedia.audio.003 原AudioRoutingManager中micStateChange监听注册方式变更 + +原AudioRoutingManager中,on()函数的micStateChange监听注册方式变更。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 + +```js +interface AudioRoutingManager { + on(type: 'micStateChange', callback: Callback): void; +} +``` +变更后 +```js +interface AudioVolumeGroupManager { + on(type: 'micStateChange', callback: Callback): void; +} +``` + + +## cl.multimedia.audio.004 getVolumeGroups()调用方式变更 + +getVolumeGroups()接口的调用方式变更。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 +```js +getVolumeGroups(networkId: string, callback:AsyncCallback): void; +getVolumeGroups(networkId: string): Promise; +``` +变更后 +```js +getVolumeManager(): AudioVolumeManager; +interface AudioVolumeManager{ + getVolumeGroupInfos(networkId: string, callback: AsyncCallback): void; + getVolumeGroupInfos(networkId: string): Promise; +} +``` + + +## cl.multimedia.audio.005 getGroupManager()调用方式变更 + +getGroupManager()接口的调用方式变更。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 +```js +getGroupManager(groupId: number, callback: AsyncCallback): void; +getGroupManager(groupId: number): Promise; +``` +变更后 +```js +getVolumeManager(): AudioVolumeManager; +interface AudioVolumeManager{ + getVolumeGroupManager(groupId: number, callback: AsyncCallback): void; + getVolumeGroupManager(groupId: number): Promise; +} +``` + + +## cl.multimedia.audio.006 枚举FocusType成员名变更 + +枚举FocusType中,成员FOCUS_TYPE_RECORDING重命名为FOCUS_TYPE_DEFAULT。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 +```js +enum FocusType { + FOCUS_TYPE_RECORDING = 0, +} +``` +变更后 +```js +enum InterruptRequestType { + INTERRUPT_REQUEST_TYPE_DEFAULT = 0, +} +``` + + +## cl.multimedia.audio.007 AudioRenderer中interrupt监听注册名称变更 + +AudioRenderer中on()函数的interrupt监听注册名称变更。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 +```js +interface AudioRenderer { + on(type: 'interrupt', callback: Callback): void; +} +``` +变更后 +```js +interface AudioRenderer { + on(type: 'audioInterrupt', callback: Callback): void; +} +``` + + +## cl.multimedia.media.001 VideoRecorder相关接口变更为systemapi + +录制在MR版本会提供正式的AVRecorder(音视频合一)的接口给外部用户使用。 +VideoRecorder相关的api9接口变更为systemapi,当前只提供给系统用户使用,未来等内部用户都切换为AVRecorder之后,废弃VideoRecorder相关接口。 + +**变更影响** + +如果VideoRecorder的调用者非系统用户,会调用失败。 +涉及接口以及枚举如下: +function createVideoRecorder(callback: AsyncCallback): void; +function createVideoRecorder(): Promise; +type VideoRecordState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; +interface VideoRecorder{ + prepare(config: VideoRecorderConfig, callback: AsyncCallback): void; + prepare(config: VideoRecorderConfig): Promise; + getInputSurface(callback: AsyncCallback): void; + getInputSurface(): Promise; + start(callback: AsyncCallback): void; + start(): Promise; + pause(callback: AsyncCallback): void; + pause(): Promise; + resume(callback: AsyncCallback): void; + resume(): Promise; + stop(callback: AsyncCallback): void; + stop(): Promise; + release(callback: AsyncCallback): void; + release(): Promise; + reset(callback: AsyncCallback): void; + reset(): Promise; + on(type: 'error', callback: ErrorCallback): void; + readonly state: VideoRecordState; +} +interface VideoRecorderProfile { + readonly audioBitrate: number; + readonly audioChannels: number; + readonly audioCodec: CodecMimeType; + readonly audioSampleRate: number; + readonly fileFormat: ContainerFormatType; + readonly videoBitrate: number; + readonly videoCodec: CodecMimeType; + readonly videoFrameWidth: number; + readonly videoFrameHeight: number; + readonly videoFrameRate: number; +} +enum AudioSourceType { + AUDIO_SOURCE_TYPE_DEFAULT = 0, + AUDIO_SOURCE_TYPE_MIC = 1, +} +enum VideoSourceType { + VIDEO_SOURCE_TYPE_SURFACE_YUV = 0, + VIDEO_SOURCE_TYPE_SURFACE_ES = 1, +} +enum VideoRecorderConfig { + audioSourceType?: AudioSourceType; + videoSourceType: VideoSourceType; + profile: VideoRecorderProfile; + url: string; + rotation?: number; + location?: Location; +} + +## cl.multimedia.media.002 VideoPlayer中不对外提供多码率选择接口 + +VideoPlayer在API9中不对外提供多码率选择相关接口,相关接口会在MR版本中由AvPlayer提供。 + +**变更影响** + +VideoPlayer多码率场景无法进行码率选择,相关功能由AVPlayer提供 + +**关键的接口/组件变更** + +删除如下接口 +interface VideoPlayer { + selectBitrate(bitrate: number): Promise; + selectBitrate(bitrate: number, callback: AsyncCallback): void; + on(type: 'availableBitratesCollect', callback: (bitrates: Array) => void): void; +} + +## cl.multimedia.media.003 VideoRecorder错误信息变更 + +VideoRecorder原有错误码与整体错误码规则不一致,变更错误码适配规则。 + +**变更影响** + +VideoRecorder返回的错误码发生变更。 + +**关键的接口/组件变更** + +VideoRecorder接口未发生变更,返回的错误码发生变更。 + +**适配指导** + +异常处理具体参考接口文档。 +https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-media.md +https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-media.md diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-multimodalinput.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-multimodalinput.md new file mode 100644 index 0000000000000000000000000000000000000000..faeaff15fcb8a66785cbaf89affa8ab14c9831bd --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-multimodalinput.md @@ -0,0 +1,104 @@ +# 多模输入changeLog + +## cl.multimodalinput.1 API错误信息返回方式变更 + +下列模块内部接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。在API9进行变更。 + - 输入设备管理模块:三方接口,@ohos.multimodalInput.inputDevice.d.ts + + - 组合按键订阅模块:系统接口,@ohos.multimodalInput.inputConsumer.d.ts + + - 键鼠穿越功能模块:系统接口,@ohos.multimodalInput.inputDeviceCooperate.d.ts + + - 按键注入模块:系统接口,@ohos.multimodalInput.inputEventClient.d.ts + + - 输入监听模块:系统接口,@ohos.multimodalInput.inputMonitor.d.ts + + - 鼠标指针管理模块:系统接口和三方接口,@ohos.multimodalInput.pointer.d.ts + +以上模块中的异步接口变更为参数检查错误同步抛出,业务逻辑错误通过AsyncCallback或Promise的error对象抛出,同步接口不作变更。 + +**变更影响** + +基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + + - supportKeys(deviceId: number, keys: Array<KeyCode>, callback: AsyncCallback<Array<boolean>>): void; + - supportKeys(deviceId: number, keys: Array<KeyCode>): Promise<Array<boolean>>; + - getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void; > + - getKeyboardType(deviceId: number): Promise<KeyboardType>; + - setPointerSpeed(speed: number, callback: AsyncCallback<void>): void; + - setPointerSpeed(speed: number): Promise<void>; + - getPointerSpeed(callback: AsyncCallback<number>): void; + - getPointerSpeed(): Promise<number>; + - setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback<void>): void; + - setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise<void>; + - getPointerStyle(windowId: number, callback: AsyncCallback<PointerStyle>): void; + - getPointerStyle(windowId: number): Promise<PointerStyle>; + - setPointerVisible(visible: boolean, callback: AsyncCallback<void>): void; + - setPointerVisible(visible: boolean): Promise<void>; + - isPointerVisible(callback: AsyncCallback<boolean>): void; + - isPointerVisible(): Promise<boolean>; + - on(type:"touch", receiver:TouchEventReceiver):void; + - on(type:"mouse", receiver:Callback<MouseEvent>):void; + - off(type:"touch", receiver?:TouchEventReceiver):void; + - off(type:"mouse", receiver?:Callback<MouseEvent>):void; + - injectEvent({KeyEvent: KeyEvent}): void; + - enable(enable: boolean, callback: AsyncCallback<void>): void; + - enable(enable: boolean): Promise<void>; + - start(sinkDeviceDescriptor: string, srcInputDeviceId: number, callback: AsyncCallback<void>): void; + - start(sinkDeviceDescriptor: string, srcInputDeviceId: number): Promise<void>; + - stop(callback: AsyncCallback<void>): void; + - stop(): Promise<void>; + - getState(deviceDescriptor: string, callback: AsyncCallback<{ state: boolean }>): void; + - getState(deviceDescriptor: string): Promise<{ state: boolean }>; + - on(type: 'cooperation', callback: AsyncCallback<{ deviceDescriptor: string, eventMsg: EventMsg }>): void; + - off(type: 'cooperation', callback?: AsyncCallback<void>): void; + - on(type: "key", keyOptions: KeyOptions, callback: Callback<KeyOptions>): void; + - off(type: "key", keyOptions: KeyOptions, callback?: Callback<KeyOptions>): void; + +以下接口标记废除: + - getDeviceIds(callback: AsyncCallback<Array<number>>): void; + - getDeviceIds(): Promise<Array<number>>; + - getDevice(deviceId: number, callback: AsyncCallback<InputDeviceData>): void; + - getDevice(deviceId: number): Promise<InputDeviceData>; + +替代接口如下: + - getDeviceList(callback: AsyncCallback<Array<number>>): void; + - getDeviceList(): Promise<Array<number>>; + - getDeviceInfo(deviceId: number, callback: AsyncCallback<InputDeviceData>): void; + - getDeviceInfo(deviceId: number): Promise<InputDeviceData>; + +以下接口发生变更 + +变更前: + - supportKeys(deviceId: number, keys: Array<KeyCode>, callback: Callback<Array<boolean>>): void; + - getKeyboardType(deviceId: number, callback: Callback<KeyboardType>): void; + +变更后: + - supportKeys(deviceId: number, keys: Array<KeyCode>, callback: AsyncCallback<Array<boolean>>): void; + - getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void; + +**适配指导** + +以setPointerVisible为例,示例代码如下: + +```ts +import pointer from '@ohos.multimodalInput.pointer'; +pointer.setPointerVisible(true, (error) => { + console.log(`Set pointer visible success`); + }); + +try { + pointer.setPointerVisible(true, (error) => { + if (error) { + console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Set pointer visible success`); + }); +} catch (error) { + console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +} +``` + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-notification.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-notification.md new file mode 100644 index 0000000000000000000000000000000000000000..ae3a495b47b7f50535802f4f64323bee8e5bda8d --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-notification.md @@ -0,0 +1,64 @@ +# 事件通知子系统ChangeLog + +## cl.notification.1 API异常处理方式变更 + +事件通知部分接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。 + +**变更影响** + +基于此前版本开发的应用,需适配变更接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +为适配统一的API异常处理方式,对事件通知相关接口进行废弃(下表中 原接口 列内容),并新增对应接口(下表中 新接口 列内容)。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。 + +| 原接口 | 新接口 | +| ----------------------- | -------------------------------- | +| @ohos.commonEvent.d.ts | @ohos.commonEventManager.d.ts | +| @ohos.notification.d.ts | @ohos.notificationManager.d.ts | +| @ohos.notification.d.ts | @ohos.notificationSubscribe.d.ts | + +**适配指导** + +如上所述,仅将老接口平移到了新的namespace中,所以可以通过修改import来解决适配问题: + +如原先接口使用了@ohos.commonEvent + +```js +import commonEvent from '@ohos.commonEvent'; +``` + +可以通过直接修改import,来切换到新的namespace上: + +```js +import commonEvent from '@ohos.commonEventManager'; +``` + +@ohos.notification拆分成了两个namespace,需要根据接口情况选择需要的新namespace进行适配。 + +此外还需要适配异常处理,具体参考新接口的接口文档。 + +## cl.notification.2 接口变更 + +对事件通知部分接口名进行了变更。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.notification | notification | **function** enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.notification | notification | **function** enableNotification(bundle: BundleOption, enable: boolean): Promise<**void**>; | 废弃 | +| @ohos.notificationManager | notificationManager | **function** setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.notificationManager | notificationManager | **function** setNotificationEnable(bundle: BundleOption, enable: boolean): Promise<**void**>; | 新增 | +| @ohos.notification | notification | **function** enableNotificationSlot(bundle: BundleOption, **type**: SlotType, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.notification | notification | **function** enableNotificationSlot(bundle: BundleOption, **type**: SlotType, enable: boolean): Promise<**void**>; | 废弃 | +| @ohos.notificationManager | notificationManager | **function** setNotificationEnableSlot(bundle: BundleOption, **type**: SlotType, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.notificationManager | notificationManager | **function** setNotificationEnableSlot(bundle: BundleOption, **type**: SlotType, enable: boolean): Promise<**void**>; | 新增 | +| @ohos.notification | notification | **function** enableDistributed(enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.notification | notification | **function** enableDistributed(enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.notificationManager | notificationManager | **function** setDistributedEnable(enable: boolean, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.notificationManager | notificationManager | **function** setDistributedEnable(enable: boolean): Promise<**void**>; | 新增 | +| @ohos.notification | notification | **function** enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.notification | notification | **function** enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise<**void**>; | 废弃 | +| @ohos.notificationManager | notificationManager | **function** setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.notificationManager | notificationManager | **function** setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise<**void**>; | 新增 | \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-power.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-power.md new file mode 100644 index 0000000000000000000000000000000000000000..f981146225f2d667916415d5670f050f57e15b0e --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-power.md @@ -0,0 +1,68 @@ +# 电源子系统ChangeLog + +## cl.powermgr.1 API错误信息返回方式变更 + +下列API使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9进行变更。 + +- 耗电统计:[@ohos.batteryStatistics](../../../application-dev/reference/apis/js-apis-batteryStatistics.md) + - 屏幕亮度:[@ohos.brightness](../../../application-dev/reference/apis/js-apis-brightness.md) + - 系统电源管理:[@ohos.power](../../../application-dev/reference/apis/js-apis-power.md) + - Runninglock锁:[@ohos.runningLock](../../../application-dev/reference/apis/js-apis-runninglock.md) + - 热管理:[@ohos.thermal](../../../application-dev/reference/apis/js-apis-thermal.md) + +异步接口:通过AsyncCallback或Promise的error对象返回错误信息。 + +同步接口:通过抛出异常的方式返回错误信息。 + +#### 变更影响 + +基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。 + +#### 关键的接口/组件变更 + +在以下接口增加错误码处理: + - getBatteryStats(callback: AsyncCallback): void + - getAppPowerValue(uid: number): number + - getAppPowerPercent(uid: number): number + - getHardwareUnitPowerValue(type: ConsumptionType): number + - getHardwareUnitPowerPercent(type: ConsumptionType): number + - setValue(value: number): void + - shutdown(reason: string): void; + - isActive(): boolean + - wakeup(detail: string): void + - suspend(): void + - getPowerMode(): DevicePowerMode + - setPowerMode(mode: DevicePowerMode, callback: AsyncCallback<void>): void + - setPowerMode(mode: DevicePowerMode): Promise<void> + - hold(timeout: number): void + - isHolding(): boolean + - unhold(): void + - isSupported(type: RunningLockType): boolean + - isSupported(type: RunningLockType): boolean + - create(name: string, type: RunningLockType, callback: AsyncCallback<RunningLock>): void + - create(name: string, type: RunningLockType): Promise<RunningLock> + - registerThermalLevelCallback(callback: Callback<ThermalLevel>): void + - unregisterThermalLevelCallback(callback?: Callback<void>): void + - getLevel(): ThermalLevel + +#### 适配指导 + +请参考各接口的API参考。 +## cl.powermgr.2 系统接口变更 + +#### 变更影响 + +基于此前版本开发的应用,需适配新接口名和错误信息返回方式,否则会影响原有业务逻辑。 + +#### 关键的接口/组件变更 + +| 包名 | 旧接口 | 新接口 | +| ----------- | ------------------------------------ | ------------------------------ | +| @ohos.power | shutdownDevice(reason: string): void | shutdown(reason: string): void | +| @ohos.power | rebootDevice(reason: string): void | reboot(reason: string): void | +| @ohos.power | wakeupDevice(detail: string): void | wakeup(detail: string): void | +| @ohos.power | suspendDevice(): void | suspend(): void | + +#### 适配指导 + +请参考系统电源管理[@ohos.power](../../../application-dev/reference/apis/js-apis-power.md)的API参考。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-request.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-request.md new file mode 100644 index 0000000000000000000000000000000000000000..7156bc1a5f85b4094cca72779b5e8917ce5382d4 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-request.md @@ -0,0 +1,106 @@ +# 上传下载子系统ChangeLog + +## cl.request.1 错误码定义及API部分接口名称变更 + +- 新增上传下载接口的[错误码](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-request.md)处理。 +- 错误信息通过AsyncCallback或Promise的error对象返回。其中,参数类型和数量错误信息,通过抛出异常的方式返回。 +- API部分接口需要用新的接口替换,参数不变。 + +**变更影响** + +基于此前版本开发的应用,需适配变更后的新错误码和错误信息返回方式,否则会影响原有业务逻辑。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +|--------------|--------------|-----------------------------------------------------------------------------------------------------------------------|-----------| +| ohos.request | request | EXCEPTION_PERMISSION | 新增 | +| ohos.request | request | EXCEPTION_PARAMCHECK | 新增 | +| ohos.request | request | EXCEPTION_UNSUPPORTED | 新增 | +| ohos.request | request | EXCEPTION_FILEIO | 新增 | +| ohos.request | request | EXCEPTION_FILEPATH | 新增 | +| ohos.request | request | EXCEPTION_SERVICE | 新增 | +| ohos.request | request | EXCEPTION_OTHERS | 新增 | +| ohos.request | request | ERROR_OFFLINE | 新增 | +| ohos.request | request | ERROR_UNSUPPORTED_NETWORK_TYPE | 新增 | +| ohos.request | request | function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback): void; | 新增 | +| ohos.request | request | function downloadFile(context: BaseContext, config: DownloadConfig): Promise; | 新增 | +| ohos.request | request | function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback): void; | 新增 | +| ohos.request | request | function uploadFile(context: BaseContext, config: UploadConfig): Promise; | 新增 | +| ohos.request | DownloadTask | delete(callback: AsyncCallback): void; | 新增 | +| ohos.request | DownloadTask | delete(): Promise; | 新增 | +| ohos.request | DownloadTask | suspend(callback: AsyncCallback): void; | 新增 | +| ohos.request | DownloadTask | suspend(): Promise; | 新增 | +| ohos.request | DownloadTask | restore(callback: AsyncCallback): void; | 新增 | +| ohos.request | DownloadTask | restore(): Promise; | 新增 | +| ohos.request | DownloadTask | getTaskInfo(callback: AsyncCallback): void; | 新增 | +| ohos.request | DownloadTask | getTaskInfo(): Promise; | 新增 | +| ohos.request | DownloadTask | getTaskMimeType(callback: AsyncCallback): void; | 新增 | +| ohos.request | DownloadTask | getTaskMimeType(): Promise; | 新增 | +| ohos.request | UploadTask | delete(callback: AsyncCallback): void; | 新增 | +| ohos.request | UploadTask | delete(): Promise; | 新增 | +| ohos.request | request | function download(config: DownloadConfig, callback: AsyncCallback): void;
代替接口:function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback): void; | 废弃 | +| ohos.request | request | function download(config: DownloadConfig): Promise;
代替接口:function downloadFile(context: BaseContext, config: DownloadConfig): Promise; | 废弃 | +| ohos.request | request | function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback): void;
代替接口:function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback): void; | 废弃 | +| ohos.request | request | function download(context: BaseContext, config: DownloadConfig): Promise;
代替接口:function downloadFile(context: BaseContext, config: DownloadConfig): Promise; | 废弃 | +| ohos.request | request | function upload(config: UploadConfig, callback: AsyncCallback): void;
代替接口:function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback): void; | 废弃 | +| ohos.request | request | function upload(config: UploadConfig): Promise;
代替接口:function uploadFile(context: BaseContext, config: UploadConfig): Promise; | 废弃 | +| ohos.request | request | function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback): void;
代替接口:function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback): void; | 废弃 | +| ohos.request | request | function upload(context: BaseContext, config: UploadConfig): Promise;
代替接口:function uploadFile(context: BaseContext, config: UploadConfig): Promise; | 废弃 | +| ohos.request | DownloadTask | remove(callback: AsyncCallback): void;
代替接口:delete(callback: AsyncCallback): void | 废弃 | +| ohos.request | DownloadTask | remove(): Promise;
代替接口:delete(): Promise; | 废弃 | +| ohos.request | DownloadTask | pause(callback: AsyncCallback): void;
代替接口:suspend(callback: AsyncCallback): void; | 废弃 | +| ohos.request | DownloadTask | pause(): Promise;
代替接口:suspend(): Promise; | 废弃 | +| ohos.request | DownloadTask | resume(callback: AsyncCallback): void;
代替接口:restore(callback: AsyncCallback): void; | 废弃 | +| ohos.request | DownloadTask | resume(): Promise;
代替接口:restore(): Promise; | 废弃 | +| ohos.request | DownloadTask | query(callback: AsyncCallback): void;
代替接口:getTaskInfo(callback: AsyncCallback): void; | 废弃 | +| ohos.request | DownloadTask | query(): Promise;
代替接口:getTaskInfo(): Promise; | 废弃 | +| ohos.request | DownloadTask | queryMimeType(callback: AsyncCallback): void;
代替接口:getTaskMimeType(callback: AsyncCallback): void; | 废弃 | +| ohos.request | DownloadTask | queryMimeType(): Promise;
代替接口:getTaskMimeType(): Promise; | 废弃 | +| ohos.request | UploadTask | remove(callback: AsyncCallback): void;
代替接口:delete(callback: AsyncCallback): void; | 废弃 | +| ohos.request | UploadTask | remove(): Promise;
代替接口:delete(): Promise; | 废弃 | +| system.request | UploadResponse | code | 废弃 | +| system.request | UploadResponse | data | 废弃 | +| system.request | UploadResponse | headers | 废弃 | +| system.request | DownloadResponse | token | 废弃 | +| system.request | OnDownloadCompleteResponse | uri | 废弃 | +| system.request | RequestFile | filename | 废弃 | +| system.request | RequestFile | name | 废弃 | +| system.request | RequestFile | uri | 废弃 | +| system.request | RequestFile | type | 废弃 | +| system.request | RequestData | name | 废弃 | +| system.request | RequestData | value | 废弃 | +| system.request | UploadRequestOptions | url | 废弃 | +| system.request | UploadRequestOptions | data | 废弃 | +| system.request | UploadRequestOptions | files | 废弃 | +| system.request | UploadRequestOptions | header | 废弃 | +| system.request | UploadRequestOptions | description | 废弃 | +| system.request | UploadRequestOptions | success | 废弃 | +| system.request | UploadRequestOptions | fail | 废弃 | +| system.request | UploadRequestOptions | complete | 废弃 | +| system.request | OnDownloadCompleteOptions | token | 废弃 | +| system.request | OnDownloadCompleteOptions | success | 废弃 | +| system.request | OnDownloadCompleteOptions | fail | 废弃 | +| system.request | OnDownloadCompleteOptions | complete | 废弃 | +| system.request | Request | static upload(options: UploadRequestOptions): void; | 废弃 | +| system.request | Request | static download(options: DownloadRequestOptions): void; | 废弃 | +| system.request | Request | static onDownloadComplete(options: OnDownloadCompleteOptions): void; | 废弃 | + + +**适配指导** + +以downloadFile为例,在新版本上需要使用如下方式进行调用: + +```ts +try { + request.downloadFile(globalThis.abilityContext, { url: 'https://xxxx/xxxxx.hap', + filePath: 'xxx/xxxxx.hap'}, (err, data) => { + if (err) { + console.error('Failed to request the download. Cause: ' + JSON.stringify(err)); + return; + } + }); +} catch (err) { + console.log("downloadFile callback fail." + "errCode:" + err.code + ",errMessage:" + err.message); +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-resource-manager.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-resource-manager.md new file mode 100644 index 0000000000000000000000000000000000000000..304f2b27682745110b7f0b355fbf6cbff78487e7 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-resource-manager.md @@ -0,0 +1,66 @@ +# 资源管理changeLog + +## cl.resourceManager.1 资源API9部分多工程接口命名变更 + +资源管理从API9开始提供接口的错误码和错误信息返回,涉及API9提供的部分多工程接口需要适配。从API9开始作以下变更: + +资源API部分多工程接口需要用新的接口替换,参数不变。 + +**变更影响** + +基于此前版本开发的应用,涉及下面多工程接口的JS接口需要替换为新的接口。 + +**关键接口/组件变更** + +| **涉及接口** | **对应替换接口** | +| ---------------- | ------------ | +| getString(resource: Resource,
callback: AsyncCallback\): void; | getStringValue(resource: Resource,
callback: AsyncCallback\): void; | +| getString(resource: Resource): Promise\; | getStringValue(resource: Resource): Promise\; | +| getStringArray(resource: Resource,
callback: AsyncCallback\>): void; | getStringArrayValue(resource: Resource,
callback: AsyncCallback\>): void; | +| getStringArray(resource: Resource): Promise\>; | getStringArrayValue(resource: Resource): Promise\>; | +| getMedia(resource: Resource,
callback: AsyncCallback\): void; | getMediaContent(resource: Resource,
callback: AsyncCallback\): void; | +| getMedia(resource: Resource): Promise\; | getMediaContent(resource: Resource): Promise\; | +| getMediaBase64(resource: Resource,
callback: AsyncCallback\): void; | getMediaContentBase64(resource: Resource,
callback: AsyncCallback\): void; | +| getMediaBase64(resource: Resource): Promise\; | getMediaContentBase64(resource: Resource): Promise\; | +| getPluralString(resource: Resource, num: number,
callback: AsyncCallback): void; | getPluralStringValue(resource: Resource, num: number,
callback: AsyncCallback\): void; | +| getPluralString(resource: Resource, num: number): Promise\; | getPluralStringValue(resource: Resource, num: number): Promise\; | + +**适配指导** + +以getMedia修改为getMediaContent的callback调用为例,其promise方式类似,只需修改函数名,且增加错误码和错误信息返回,其它不变。示例代码如下: + +- 变更前:getMedia(resource: Resource, callback: AsyncCallback): void; +```ts +let resource = { + bundleName: "com.example.myapplication", + moduleName: "entry", + id: $r('app.media.test').id +}; +this.context.resourceManager.getMedia(resource, (error, value) => { + if (error != null) { + console.log("error is " + error); + } else { + let media = value; + } +}); +``` + +- 变更后:getMediaContent(resource: Resource, callback: AsyncCallback): void; +```ts +let resource = { + bundleName: "com.example.myapplication", + moduleName: "entry", + id: $r('app.media.test').id +}; +try { + this.context.resourceManager.getMediaContent(resource, (error, value) => { + if (error != null) { + console.log("error is " + error); + } else { + let media = value; + } + }); +} catch (error) { + console.error(`callback getMediaContent failed, error code: ${error.code}, message: ${error.message}.`) +} +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-resourceschedule.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-resourceschedule.md new file mode 100644 index 0000000000000000000000000000000000000000..2434d2d22974e3b4264b13565b5316a608227e02 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-resourceschedule.md @@ -0,0 +1,316 @@ +# 资源调度子系统ChangeLog + +## cl.resourceschedule.backgroundTaskManager +对资源调度子系统backgroundTaskManager仓原有接口进行整改,原有API8及之前的接口全部废弃,原有API9接口删除,需要使用新的API9接口。新的API9接口符合错误码规范。 + +**变更影响** + +基于OpenHarmony3.2.8.2及之后的SDK版本开发的应用,需适配API9的模块和接口,以及的API异常处理返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下方法、属性、枚举和常量均从API9变更。废弃@ohos.backgroundTaskManager.d.ts文件,新增@ohos.resourceschedule.backgroundTaskManager.d.ts文件,将相关接口变更至对应的文件。 + +| 类名 | 接口类型 | 接口声明 | 说明 | +| -- | -- | -- | -- | +| backgroundTaskManager | namespace | declare namespace backgroundTaskManager | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function resetAllEfficiencyResources(): void; | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function applyEfficiencyResources(request: EfficiencyResourcesRequest): bool; | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts,修改为function applyEfficiencyResources(request: EfficiencyResourcesRequest): void; | +| backgroundTaskManager | method | function stopBackgroundRunning(context: Context): Promise; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function stopBackgroundRunning(context: Context, callback: AsyncCallback): void; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback): void; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function requestSuspendDelay(reason: string, callback: Callback): DelaySuspendInfo; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function getRemainingDelayTime(requestId: number): Promise; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function getRemainingDelayTime(requestId: number, callback: AsyncCallback): void; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function cancelSuspendDelay(requestId: number): void; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | export enum BackgroundMode | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | DATA_TRANSFER = 1 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | AUDIO_PLAYBACK = 2 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | AUDIO_RECORDING = 3 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | LOCATION = 4 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | BLUETOOTH_INTERACTION = 5 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | MULTI_DEVICE_CONNECTION = 6 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | WIFI_INTERACTION = 7 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | VOIP = 8 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | TASK_KEEPING = 9 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.DelaySuspendInfo | interface | interface DelaySuspendInfo | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.DelaySuspendInfo | field | requestId: number | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.DelaySuspendInfo | field | actualDelayTime: number | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | export enum ResourceType | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | CPU = 1 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | COMMON_EVENT = 1 << 1 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | TIMER = 1 << 2 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | WORK_SCHEDULER = 1 << 3 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | BLUETOOTH = 1 << 4 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | GPS = 1 << 5 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | AUDIO = 1 << 6 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | interface | export interface EfficiencyResourcesRequest | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | reason: string | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | isProcess?: bool | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | isPersist?: bool | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | timeOut: number | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | isApply: bool | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | resourceTypes: number | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | + + +**适配指导**
+ +导入backgroundTaskManager模块。 +``` +import bundle form '@ohos.resourceschedule.backgroundTaskManager' +``` +此外还需要适配异常处理,具体参考[backgroundTaskManager接口文档](../../../application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md)。 + +## c2.resourceschedule.usageStatistics +对资源调度子系统deviceUsageStatistics仓原有接口进行整改,原有API8及之前的接口全部废弃,原有API9接口删除,需要使用新的API9接口。新的API9接口符合错误码规范。 + +**变更影响** + +基于OpenHarmony3.2.8.2及之后的SDK版本开发的应用,需适配API9的模块和接口,以及的API异常处理返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下方法、属性、枚举和常量均从API9变更,废弃@ohos.bundleState.d.ts文件,新增@ohos.resourceschedule.usageStatistics.d.ts文件,类名也将从bundleState变更为usageStatistics。 + +| 类名 | 接口类型 | 方法/属性/枚举/常量 | 变更类型 | +| ----------------------------------------- | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| bundleState | method | function isIdleState(bundleName: string, callback: AsyncCallback): void; | 废弃,移动到usageStatistics.isIdleState | +| bundleState | method | function isIdleState(bundleName: string): Promise; | 废弃,移动到usageStatistics.isIdleState | +| bundleState | method | function queryAppUsagePriorityGroup(callback: AsyncCallback): void; | 废弃,修改为function queryAppGroup(callback: AsyncCallback): void; | +| bundleState | method | function queryAppUsagePriorityGroup(): Promise; | 废弃,修改为function queryAppGroup(): Promise; | +| bundleState | method | function queryBundleStateInfos(begin: number, end: number, callback: AsyncCallback): void; | 废弃,修改为function queryBundleStatsInfos(begin: number, end: number, callback: AsyncCallback): void; | +| bundleState | method | function queryBundleStateInfos(begin: number, end: number): Promise; | 废弃, 修改为function queryBundleStatsInfos(begin: number, end: number): Promise; | +| bundleState | method | function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise>; | 废弃,修改为function queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise>; | +| bundleState | method | function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback>): void; | 废弃,修改为function queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback>): void; | +| bundleState | method | function queryBundleActiveStates(begin: number, end: number): Promise>; | 废弃,修改为function queryBundleEvents(begin: number, end: number): Promise>; | +| bundleState | method | function queryBundleActiveStates(begin: number, end: number, callback: AsyncCallback>): void; | 废弃,修改为function queryBundleEvents(begin: number, end: number, callback: AsyncCallback>): void; | +| bundleState | method | function queryCurrentBundleActiveStates(begin: number, end: number): Promise>; | 废弃,修改为function queryCurrentBundleEvents(begin: number, end: number): Promise>; | +| bundleState | method | function queryCurrentBundleActiveStates(begin: number, end: number, callback: AsyncCallback>): void; | 废弃,修改为function queryCurrentBundleEvents(begin: number, end: number, callback: AsyncCallback>): void; | +| bundleState | method | function getRecentlyUsedModules(maxNum?: number): Promise>; | 废弃,修改为两个接口function QueryModuleUsageRecords(maxNum: number): Promise>; function QueryModuleUsageRecords(): Promise>; | +| bundleState | method | function getRecentlyUsedModules(maxNum?: number, callback: AsyncCallback>): void; | 废弃,修改为两个接口function QueryModuleUsageRecords(maxNum: number, callback: AsyncCallback>): void; function QueryModuleUsageRecords(callback: AsyncCallback>): void; | +| bundleState | method | function queryAppUsagePriorityGroup(bundleName? : string): Promise; | 废弃,修改为function queryAppGroup(bundleName: string): Promise; | +| bundleState | method | function queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback): void; | 废弃,修改为function queryAppGroup(bundleName: string, callback: AsyncCallback): void; | +| bundleState | method | function setBundleGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback): void; | 废弃,修改为function setAppGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback): void; | +| bundleState | method | function setBundleGroup(bundleName: string, newGroup: GroupType): Promise; | 废弃,修改为function setAppGroup(bundleName: string, newGroup: GroupType): Promise; | +| bundleState | method | function registerGroupCallBack(callback: Callback, callback: AsyncCallback): void; | 废弃,修改为function registerAppGroupCallBack(callback: Callback, callback: AsyncCallback): void; | +| bundleState | method | function registerGroupCallBack(callback: Callback): Promise; | 废弃,修改为function registerAppGroupCallBack(callback: Callback): Promise; | +| bundleState | method | function unRegisterGroupCallBack(callback: AsyncCallback): void; | 变更,修改为function unregisterAppGroupCallBack(): Promise; | +| bundleState | method | function unRegisterGroupCallBack(): Promise; | 变更,修改为function unregisterAppGroupCallBack(): Promise; | +| bundleState | method | function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback>): void; | 变更,修改为function queryDeviceEventStats(begin: number, end: number, callback: AsyncCallback>): void; | +| bundleState | method | function queryBundleActiveEventStates(begin: number, end: number): Promise>; | 接口从API9变更,修改为function queryDeviceEventStats(begin: number, end: number): Promise>; | +| bundleState | method | function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback>): void; | 接口从API9变更,修改为function queryNotificationEventStats(begin: number, end: number, callback: AsyncCallback>): void; | +| bundleState | method | function queryAppNotificationNumber(begin: number, end: number): Promise>; | 接口从API9变更,修改为function queryNotificationEventStats(begin: number, end: number): Promise>; | +| bundleState.BundleActiveGroupCallbackInfo | interface | interface BundleActiveGroupCallbackInfo | 变更,修改为usageStatistics.AppGroupCallbackInfo | +| bundleState.BundleActiveGroupCallbackInfo | field | bundleName: string | 变更,移动到usageStatistics.AppGroupCallbackInfo | +| bundleState.BundleActiveGroupCallbackInfo | field | changeReason: number | 变更,移动到usageStatistics.AppGroupCallbackInfo | +| bundleState.BundleActiveGroupCallbackInfo | field | userId: number | 变更,移动到usageStatistics.AppGroupCallbackInfo | +| bundleState.BundleActiveGroupCallbackInfo | field | appUsageNewGroup: number | 废弃,修改为appNewGroup | +| bundleState.BundleActiveGroupCallbackInfo | field | appUsageOldGroup: number | 废弃,修改为appOldGroup | +| bundleState.BundleActiveEventState | interface | interface BundleActiveEventState | 废弃,修改为usageStatistics.DeviceEventStats | +| bundleState.BundleActiveEventState | field | count: number | 变更,移动到usageStatistics.DeviceEventStats | +| bundleState.BundleActiveEventState | field | eventId: number | 变更,移动到usageStatistics.DeviceEventStats | +| bundleState.BundleActiveEventState | field | name: string | 变更,移动到usageStatistics.DeviceEventStats | +| bundleState.BundleActiveModuleInfo | interface | interface BundleActiveModuleInfo | 接口从API9变更,修改为usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | formRecords: Array | 变更,修改为formRecords: Array | +| bundleState.BundleActiveModuleInfo | field | lastModuleUsedTime: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | launchedCount: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | abilityIconId?: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | abilityDescriptionId?: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | abilityLableId?: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | descriptionId?: number; | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | labelId?: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | appLabelId?: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | abilityName?: string | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | moduleName: string | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | bundleName: string | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | deviceId?: string | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.GroupType | enum | enum GroupType | 变更,移动到usageStatistics.GroupType | +| bundleState.GroupType | enum | ACTIVE_GROUP_ALIVE | 废弃,修改为ALIVE_GROUP | +| bundleState.GroupType | enum | ACTIVE_GROUP_DAILY | 废弃,修改为DAILY_GROUP | +| bundleState.GroupType | enum | ACTIVE_GROUP_FIXED | 废弃,修改为FIXED_GROUP | +| bundleState.GroupType | enum | ACTIVE_GROUP_RARE | 废弃,修改为RARE_GROUP | +| bundleState.GroupType | enum | ACTIVE_GROUP_LIMIT | 废弃,修改为LIMITED_GROUP | +| bundleState.GroupType | enum | ACTIVE_GROUP_NEVER | 废弃,修改为NEVER_GROUP | +| bundleState.IntervalType | enum | enum IntervalType | 废弃,移动到usageStatistics.IntervalType | +| bundleState.IntervalType | enum | BY_OPTIMIZED | 废弃,移动到usageStatistics.IntervalType | +| bundleState.IntervalType | enum | BY_DAILY | 废弃,移动到usageStatistics.IntervalType | +| bundleState.IntervalType | enum | BY_WEEKLY | 废弃,移动到usageStatistics.IntervalType | +| bundleState.IntervalType | enum | BY_MONTHLY | 废弃,移动到usageStatistics.IntervalType | +| bundleState.IntervalType | enum | BY_ANNUALLY | 废弃,移动到usageStatistics.IntervalType | +| bundleState.BundleActiveInfoResponse | interface | interface BundleActiveInfoResponse | 废弃,修改为usageStatistics.BundleStatsMap | +| bundleState.BundleActiveState | interface | interface BundleActiveState | 废弃,修改为usageStatistics.BundleEvents | +| bundleState.BundleActiveState | field | stateType?: number | 废弃,修改为eventId | +| bundleState.BundleActiveState | field | stateOccurredTime?: number | 废弃,修改为eventOccurredTime | +| bundleState.BundleActiveState | field | nameOfClass?: string | 废弃,移动到usageStatistics.BundleEvents | +| bundleState.BundleActiveState | field | indexOfLink?: string | 废弃,移动到usageStatistics.BundleEvents | +| bundleState.BundleActiveState | field | bundleName?: string | 废弃,移动到usageStatistics.BundleEvents | +| bundleState.BundleActiveState | field | appUsagePriorityGroup?: number | 废弃,修改为appGroup | +| bundleState.BundleStateInfo | interface | interface BundleStateInfo | 废弃,修改为usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | method | merge(toMerge: BundleStateInfo): void | 废弃 | +| bundleState.BundleStateInfo | field | infosEndTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | infosBeginTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | fgAbilityPrevAccessTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | fgAbilityAccessTotalTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | bundleName?: string | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | abilitySeenTotalTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | abilityPrevSeenTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | abilityPrevAccessTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | abilityInFgTotalTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | id: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState | namespace | declare namespace bundleState | 废弃,修改为usageStatistics,移植到ohos.resourceschedule.usageStatistics.d.ts | + + +**适配指导**
+ +导入usageStatistics模块。 +``` +import bundle form '@ohos.resourceschedule.usageStatistics' +``` +此外还需要适配异常处理,具体参考[usageStatistics接口文档](../../../application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md)。 + + +## c3.resourceschedule.workScheduler +对资源调度子系统workScheduler仓原有接口进行整改,原有API9接口变更为新的API9接口。新的API9接口符合错误码规范。 + +**变更影响** + +基于OpenHarmony3.2.8.2及之后的SDK版本开发的应用,需适配API9的模块和接口,以及的API异常处理返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下方法、属性、枚举和常量均从API9变更。废弃@ohos.workScheduler.d.ts文件,新增@ohos.resourceschedule.workScheduler.d.ts文件,将相关接口变更至对应的文件中。 + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +| workScheduler | namespace | declare namespace workScheduler | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | interface | export interface WorkInfo | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | parameters?: {[key: string]: any} | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | idleWaitTime?: number | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isDeepIdle?: boolean | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | repeatCount?: number | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isRepeat?: boolean | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | repeatCycleTime?: number | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | storageRequest?: StorageRequest | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | batteryStatus?: BatteryStatus | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | batteryLevel?: number | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | chargerType?: ChargingType | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isCharging?: boolean | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | networkType?: NetworkType | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isPersisted?: boolean | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | abilityName: string | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | bundleName: string | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | workId: number | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function isLastWorkTimeOut(workId: number): Promise; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function isLastWorkTimeOut(workId: number, callback: AsyncCallback): boolean; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function stopAndClearWorks(): boolean; | 接口API8变更,移植到ohos.resourceschedule.workScheduler.d.ts,修改为function stopAndClearWorks(): boolean; | +| workScheduler | method | function obtainAllWorks(): Promise>; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function obtainAllWorks(callback: AsyncCallback): Array; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function getWorkStatus(workId: number): Promise; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function getWorkStatus(workId: number, callback: AsyncCallback): void; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function stopWork(work: WorkInfo, needCancel?: boolean): boolean; | 接口API8变更,移植到ohos.resourceschedule.workScheduler.d.ts,修改为function stopWork(work: WorkInfo, needCancel?: boolean): void; | +| workScheduler | method | function startWork(work: WorkInfo): boolean; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts,修改为function startWork(work: WorkInfo): void; | +| workScheduler.NetworkType | enum | export enum NetworkType | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_ANY = 0 | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_MOBILE | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_WIFI | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_BLUETOOTH | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_WIFI_P2P | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_ETHERNET | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | export enum ChargingType | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_ANY = 0 | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_AC | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_USB | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_WIRELESS | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | export enum BatteryStatus | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | BATTERY_STATUS_LOW = 0 | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | BATTERY_STATUS_OKAY | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | BATTERY_STATUS_LOW_OR_OKAY | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.StorageRequest | enum | export enum StorageRequest | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_LOW = 0 | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_OKAY | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_LOW_OR_OKAY | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | + + +**适配指导**
+ +导入workScheduler模块。 +``` +import bundle form '@ohos.resourceschedule.workScheduler' +``` +此外还需要适配异常处理,具体参考[workScheduler接口文档](../../../application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md)。 + + +## c4.resourceschedule.reminderAgent +对资源调度子系统提醒代理原有接口进行整改,原有API8及之前的接口全部废弃,原有API9接口删除,需要使用新的API9接口。新的API9接口符合错误码规范。 + +**变更影响** + +基于OpenHarmony3.2.8.2及之后的SDK版本开发的应用,需适配API9的模块和接口,以及的API异常处理返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下方法、属性、枚举和常量均从API9变更,废弃@ohos.reminderAgent.d.ts文件,新增@ohos.reminderAgentManager.d.ts文件,类名也将从reminderAgent变更为reminderAgentManager。 + +| 类名 | 接口类型 | 方法/属性/枚举/常量 | 变更类型 | +| --------------------- | ----------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| reminderAgent | method | publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback): void; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | publishReminder(reminderReq: ReminderRequest): Promise; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | cancelReminder(reminderId: number, callback: AsyncCallback): void; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | cancelReminder(reminderId: number): Promise; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | getValidReminders(callback: AsyncCallback>): void; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | getValidReminders(): Promise>; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | cancelAllReminders(callback: AsyncCallback): void; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | cancelAllReminders(): Promise; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback): void; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | addNotificationSlot(slot: NotificationSlot): Promise; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback): void; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | removeNotificationSlot(slotType: notification.SlotType): Promise; | 废弃,移动到reminderAgentManager | +| reminderAgent.ActionButtonType | enum | ACTION_BUTTON_TYPE_CLOSE | 废弃,移动到reminderAgentManager.ActionButtonType | +| reminderAgent.ActionButtonType | enum | ACTION_BUTTON_TYPE_SNOOZE | 废弃,移动到reminderAgentManager.ActionButtonType | +| reminderAgent.ReminderType | enum | REMINDER_TYPE_TIMER | 废弃,移动到reminderAgentManager.ReminderType | +| reminderAgent.ReminderType | enum | REMINDER_TYPE_CALENDAR | 废弃,移动到reminderAgentManager.ReminderType | +| reminderAgent.ReminderType | enum | REMINDER_TYPE_CALENDAR | 废弃,移动到reminderAgentManager.ReminderType | +| reminderAgent.ActionButton | field | title:string | 废弃,移动到reminderAgentManager.ActionButton | +| reminderAgent.ActionButton | field | type:ActionButtonType | 废弃,移动到reminderAgentManager.ActionButton | +| reminderAgent.WantAgent | field | pkgName:string | 废弃,移动到reminderAgentManager.WantAgent | +| reminderAgent.WantAgent | field | abilityName:string | 废弃,移动到reminderAgentManager.WantAgent | +| reminderAgent.MaxScreenWantAgent | field | pkgName:string | 废弃,移动到reminderAgentManager.MaxScreenWantAgent | +| reminderAgent.MaxScreenWantAgent | field | abilityName:string | 废弃,移动到reminderAgentManager.MaxScreenWantAgent | +| reminderAgent.ReminderRequest | field | reminderType:ReminderType | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | actionButton?:ActionButton | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | wantAgent?:WantAgent | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | maxScreenWantAgent?:MaxScreenWantAgent | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | ringDuration?:number | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | snoozeTimes?:number | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | timeInterval?:number | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | title?:string | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | content?:string | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | expiredContent?:string | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | snoozeContent?:string | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | notificationId?:number | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | slotType?: notification.SlotType | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequestCalendar | field | dateTime:LocalDateTime | 废弃,移动到reminderAgentManager.ReminderRequestCalendar | +| reminderAgent.ReminderRequestCalendar | field | repeatMonths?:Array | 废弃,移动到reminderAgentManager.ReminderRequestCalendar | +| reminderAgent.ReminderRequestCalendar | field | repeatDays?:Array | 废弃,移动到reminderAgentManager.ReminderRequestCalendar | +| reminderAgent.ReminderRequestAlarm | field | hour:number | 废弃,移动到reminderAgentManager.ReminderRequestAlarm | +| reminderAgent.ReminderRequestAlarm | field | minute:number | 废弃,移动到reminderAgentManager.ReminderRequestAlarm | +| reminderAgent.ReminderRequestAlarm | field | daysOfWeek?:Array | 废弃,移动到reminderAgentManager.ReminderRequestAlarm | +| reminderAgent.ReminderRequestTimer | field | triggerTimeInSeconds:number | 废弃,移动到reminderAgentManager.ReminderRequestTimer | +| reminderAgent.LocalDateTime | field | year:number | 废弃,移动到reminderAgentManager.LocalDateTime | +| reminderAgent.LocalDateTime | field | month:number | 废弃,移动到reminderAgentManager.LocalDateTime | +| reminderAgent.LocalDateTime | field | day:number | 废弃,移动到reminderAgentManager.LocalDateTime | +| reminderAgent.LocalDateTime | field | hour:number | 废弃,移动到reminderAgentManager.LocalDateTime | +| reminderAgent.LocalDateTime | field | minute:number | 废弃,移动到reminderAgentManager.LocalDateTime | +| reminderAgent.LocalDateTime | field | second?:number | 废弃,移动到reminderAgentManager.LocalDateTime | + + +**适配指导**
+ +导入reminderAgentManager模块。 +``` +import bundle form '@ohos.reminderAgentManager' +``` +此外还需要适配异常处理,具体参考[reminderAgentManager接口文档](../../../application-dev/reference/apis/js-apis-reminderAgentManager.md)。 + + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-telephony.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-telephony.md new file mode 100644 index 0000000000000000000000000000000000000000..88b25f832e020276df920a43b3fa5543af6bf5b3 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-telephony.md @@ -0,0 +1,65 @@ +# 电话子系统ChangeLog + + + +## cl.telephony.1 sms模块SystemAPI接口入参变更 + +已发布的部分电话子系统sms短信模块SystemAPI传入参数发生变化,不符合OpenHarmony接口规范。从API9开始做出以下变更: + +isImsSmsSupported接口新增一个传入参数slotId,表示卡槽号。 + + + +**变更影响** + +基于此前版本开发的应用,需适配变更js接口的入参,否则会影响原有功能。 + + + +**关键的接口/组件变更** + +- 涉及接口 + + isImsSmsSupported(callback: AsyncCallback): void; + isImsSmsSupported(): Promise; + +- 变更前: + +```js +function isImsSmsSupported(callback: AsyncCallback): void; +function isImsSmsSupported(): Promise; +``` + +- 变更后: + +```js +function isImsSmsSupported(slotId: number, callback: AsyncCallback): void; +function isImsSmsSupported(slotId: number): Promise; +``` + + + +**适配指导** + +新增一个入参,示例代码如下: + +callback方式 + +```js +let slotId = 0; +sms.isImsSmsSupported(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +promise方式 + +```js +let slotId = 0; +let promise = sms.isImsSmsSupported(slotId); +promise.then(data => { + console.log(`isImsSmsSupported success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`isImsSmsSupported failed, promise: err->${JSON.stringify(err)}`); +}); +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-testfwk_arkxtest.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-testfwk_arkxtest.md new file mode 100644 index 0000000000000000000000000000000000000000..b7f1aed3d06ebb4001b5157064eafc3298e4b6a3 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-testfwk_arkxtest.md @@ -0,0 +1,41 @@ +# 测试子系统ChangeLog + +## cl.testfwk_arkxtest.1 On、Driver、Component类接口新增支持异常处理 + +API8原有接口废弃,API9新增替代接口,API9接口支持异常处理,需使用try catch捕获接口抛出的异常。 + +## 变更影响 + +此变更影响@ohos.uitest提供的api9-JS接口。用户此前在测试用例开发中使用了@ohos.uitest-api9接口的,需要进行适配才可以在新版本SDK环境正常编译通过。 + +## 关键的接口/组件变更 + +- 废弃API8原有的`By`类,在API9中使用`On`类代替,`On`类接口新增支持异常处理机制;类内接口名称保持不变,**例外**:`By#key`接口替换为`On.id`。 +- 废弃API8原有的`BY`对象,在API9中使用`ON`对象代替。 +- 废弃API8原有的`UiDriver`类,在API9中使用`Driver`类代替,`Driver`类接口新增支持异常处理机制;类内接口名称保持不变。 +- 废弃API8原有的`UiComponent`类,在API9中使用`Component`类代替,`Component`类接口新增支持异常处理机制;类内接口名称保持不变。 + +## 适配指导 + +### 1.适配接口名称变更 + +可按照如下规则做类名替换: + +- `By-->On` +- `BY-->ON` +- `UiDriver-->Driver` +- `UiComponent-->Component` + +### 2.捕获处理异常 + +使用try-catch处理接口捕获可能抛出的异常,例如: + +```typescript +import {Driver,ON,Component} from '@ohos.uitest' + +try { + let driver = Driver.create(); +} catch (error) { + // error handle; error.code为错误码 +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-theme.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-theme.md new file mode 100644 index 0000000000000000000000000000000000000000..81e0950c0ee16d4a3cd434020e65522e7051879f --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-theme.md @@ -0,0 +1,148 @@ +# 主题框架changeLog + +## cl.theme.1 API9接口支持异常处理 + +下列模块内部接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。在API9进行变更。 + - 壁纸管理服务:@ohos.wallpaper.d.ts + + - 锁屏管理服务:@ohos.screenLock.d.ts + +以上模块中的接口变更为: +同步接口:通过抛出异常的方式返回错误信息。 +异步接口:参数检查错误同步抛出,业务逻辑错误通过AsyncCallback或Promise的error对象抛出。 + +**变更影响** + +基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下标记为壁纸管理服务接口废除: + - getColors(wallpaperType: WallpaperType, callback: AsyncCallback>): void; + - getColors(wallpaperType: WallpaperType): Promise>; + - getId(wallpaperType: WallpaperType, callback: AsyncCallback): void; + - getId(wallpaperType: WallpaperType): Promise; + - getMinHeight(callback: AsyncCallback): void; + - getMinHeight(): Promise; + - getMinWidth(callback: AsyncCallback): void; + - getMinWidth(): Promise; + - isChangePermitted(callback: AsyncCallback): void; + - isChangePermitted(): Promise; + - isOperationAllowed(callback: AsyncCallback): void; + - isOperationAllowed(): Promise; + - reset(wallpaperType: WallpaperType, callback: AsyncCallback): void; + - reset(wallpaperType: WallpaperType): Promise; + - setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + - setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; + - getFile(wallpaperType: WallpaperType, callback: AsyncCallback): void; + - getFile(wallpaperType: WallpaperType): Promise; + - getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback): void; + - getPixelMap(wallpaperType: WallpaperType): Promise; + +壁纸管理服务替代接口如下: + - getColorsSync(wallpaperType: WallpaperType): Array; + - getIdSync(wallpaperType: WallpaperType): number; + - getMinHeightSync(): number; + - getMinWidthSync(): number; + - isChangeAllowed(): boolean; + - isUserChangeAllowed(): boolean; + - restore(wallpaperType: WallpaperType, callback: AsyncCallback): void; + - restore(wallpaperType: WallpaperType): Promise; + - setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + - setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; + - getFileSync(wallpaperType: WallpaperType): number; + - getImage(wallpaperType: WallpaperType, callback: AsyncCallback): void; + - getImage(wallpaperType: WallpaperType): Promise; + +以下标记为壁纸管理服务接口变更: + - on(type: 'colorChange', callback: (colors: Array, wallpaperType: WallpaperType) => void): void + - off(type: 'colorChange', callback?: (colors: Array, wallpaperType: WallpaperType) => void): void + +以下标记为锁屏管理服务接口废除: + - isScreenLocked(callback: AsyncCallback): void; + - isScreenLocked(): Promise; + - isSecureMode(callback: AsyncCallback): void; + - isSecureMode(): Promise; + - unlockScreen(callback: AsyncCallback): void; + - unlockScreen(): Promise; + +锁屏管理服务替代接口如下: + - isLocked(): boolean; + - isSecure(): boolean; + - unlock(callback: AsyncCallback): void; + - unlock():Promise; + +以下标记为锁屏管理服务接口删除: + - lockScreen(callback: AsyncCallback): void; + - lockScreen(): Promise; + +以下标记为锁屏管理服务接口新增: + - lock(callback: AsyncCallback): void; + - lock():Promise; + +以下标记为锁屏管理服务接口变更: + - onSystemEvent(callback: Callback): boolean; + - sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback): void; + - sendScreenLockEvent(event: String, parameter: number): Promise; + +**壁纸管理服务适配指导** + +异步接口以getImage为例,示例代码如下: + +```ts +import pointer from '@ohos.wallpaper'; +try { + wallpaper.getImage(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => { + console.log(`success to getImage: ${JSON.stringify(data)}`); + }).catch((error) => { + console.error(`failed to getImage because: ${JSON.stringify(error)}`); + }); +} catch (err) { + console.error(`failed to getImage because: ${JSON.stringify(err)}`); +} + +``` + +同步接口以getFileSync为例,示例代码如下: + +```ts +import pointer from '@ohos.wallpaper'; +try { + let file = wallpaper.getFileSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM); +} catch (err) { + console.error(`failed to getFileSync because: ${err.message}`); +} +``` + +**锁屏管理服务适配指导** + +异步接口以lock为例,示例代码如下: + +```ts +import screenLock from '@ohos.screenlock'; +try { + screenLock.lock((err, data) => { + if (err) { + console.error(`Failed to lock the screen, because: ${err.message}`); + return; + } + console.info(`lock the screen successfully. result: ${data}`); + }); +} catch (err) { + console.error(`Failed to lock the screen, because: ${err.message}`); +} + +``` + +同步接口以onSystemEvent为例,示例代码如下: + +```ts +import screenLock from '@ohos.screenlock'; +try { + let isSuccess = screenLock.onSystemEvent((event) => { + console.log(`Register the system event which related to screenlock successfully. eventType: ${event.eventType}`) + }); +} catch (err) { + console.error(`Failed to register the system event which related to screenlock, because: ${err.message}`) +} +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-useriam.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-useriam.md new file mode 100644 index 0000000000000000000000000000000000000000..3272693029f4b787c8e1d3560f2a4fa00a49854b --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-useriam.md @@ -0,0 +1,74 @@ +# 用户IAM子系统Changelog + +## cl.useriam.1 API异常处理方式变更 + +用户IAM部分接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9开始作以下变更: + +接口通过抛出异常的方式返回错误信息。 + +**变更影响** + +基于此版本以前开发的应用不受影响,以后的需适配变更接口的错误信息返回方式,否则会影响业务逻辑。 + +**关键接口/组件变更** + +为适配统一的API异常处理方式,对用户IAM相关接口进行废弃(下表中 原接口 列内容),并新增对应接口(下表中 新接口 列内容)。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。 + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ---------------------- | ------------------- | ------------------------- | ------------------------ | +| ohos.userIAM.userAuth | UserAuth | constructor() | 废弃 | +| ohos.userIAM.userAuth | UserAuth | getVersion() : number | 废弃 | +| ohos.userIAM.userAuth | UserAuth | getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel) : number | 废弃 | +| ohos.userIAM.userAuth | UserAuth | auth(challenge: Uint8Array, authType: UserAuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array | 废弃 | +| ohos.userIAM.userAuth | UserAuth | cancelAuth(contextID : Uint8Array) : number | 废弃 | +| ohos.userIAM.userAuth | IUserAuthCallback | onResult: (result : number, extraInfo : AuthResult) => void | 废弃 | +| ohos.userIAM.userAuth | IUserAuthCallback | onAcquireInfo ?: (module : number, acquire : number, extraInfo : any) => void | 废弃 | +| ohos.userIAM.userAuth | AuthResult | AuthResult {
token ?: Uint8Array;
remainTimes ?: number;
freezingTime ?: number;} | 废弃 | +| ohos.userIAM.userAuth | 枚举 | ResultCode {
SUCCESS = 0,
FAIL = 1,
GENERAL_ERROR = 2,
CANCELED = 3,
TIMEOUT = 4,
TYPE_NOT_SUPPORT = 5,
TRUST_LEVEL_NOT_SUPPORT = 6,
BUSY = 7,
INVALID_PARAMETERS = 8,
LOCKED = 9,
NOT_ENROLLED = 10,} | 废弃 | +| ohos.userIAM.userAuth | type | AuthEventKey = "result" | 新增 | +| ohos.userIAM.userAuth | type | EventInfo = AuthResultInfo | 新增 | +| ohos.userIAM.userAuth | AuthResultInfo | AuthResultInfo {
result : number;
token ?: Uint8Array;
remainAttempts ?: number;
lockoutDuration ?: number;} | 新增 | +| ohos.userIAM.userAuth | TipInfo | TipInfo {
module : number;
tip : number;} | 新增 | +| ohos.userIAM.userAuth | AuthInstance | AuthInstance {
on: (name: AuthEventKey, callback: AuthEvent) => void;
off: (name: AuthEventKey) => void;
start: () => void;
cancel: () => void;} | 新增 | +| ohos.userIAM.userAuth | 枚举 | ResultCodeV9 {
SUCCESS = 12500000,
FAIL = 12500001,
GENERAL_ERROR = 12500002,
CANCELED = 12500003,
TIMEOUT = 12500004,
TYPE_NOT_SUPPORT = 12500005,
TRUST_LEVEL_NOT_SUPPORT = 12500006,
BUSY = 12500007,
LOCKED = 12500009,
NOT_ENROLLED = 12500010,} | 新增 | +| ohos.userIAM.userAuth | function | getAuthInstance(challenge : Uint8Array, authType : UserAuthType, authTrustLevel : AuthTrustLevel) : AuthInstance | 新增 | +| ohos.userIAM.userAuth | function | getVersion() : number | 新增 | +| ohos.userIAM.userAuth | function | getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel) : void | 新增 | +| ohos.userIAM.faceAuth | FaceAuthManager | setSurfaceId(surfaceId : string) : ResultCode | 删除 | +| ohos.userIAM.faceAuth | 枚举 | ResultCode {
SUCCESS = 0,
FAIL = 1,} | 删除 | +| ohos.userIAM.faceAuth | FaceAuthManager | setSurfaceId(surfaceId: string) : void | 新增 | + +**适配指导** + +以getVersion接口为例,示例代码如下: + +```js +import userIAM_userAuth from '@ohos.userIAM.userAuth'; + +try { + let version = userIAM_userAuth.getVersion(); + console.info("auth version = " + version); +} catch (error) { + console.info("get version failed, error = " + error); +} +``` + +更多接口的示例代码可参考[用户认证API文档](../../../application-dev/reference/apis/js-apis-useriam-userauth.md)和[人脸认证API文档](../../../application-dev/reference/apis/js-apis-useriam-faceauth.md)。 + +## cl.useriam.2 接口调用权限变更 + +用户IAM部分接口只允许被系统应用调起,需要做系统应用运行时鉴权。从API9开始作以下变更: + +人脸认证模块的setSurfaceId接口增加判别是否为系统应用的逻辑,非系统应用无法调用该接口。 + +**变更影响** + +基于此版本以前开发的应用不受影响,以后的需要持有相应权限,否则无法正常调用接口。 + +**关键接口/组件变更** + +setSurfaceId接口的实现中增加系统应用鉴权处理,非系统应用调用将返回202错误码。 + +**适配指导** + +需要修改[应用签名](https://gitee.com/openharmony/developtools_hapsigner/tree/master/dist)相关文件UnsgnedReleasedProfileTemplate.json,其中的app-feature字段要改为"hos_system_app",才可保证签名所得到的应用是系统应用。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-wantAgent.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-wantAgent.md new file mode 100644 index 0000000000000000000000000000000000000000..44840f55cc2493dad2d9c8ec669d533da1ba8491 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-wantAgent.md @@ -0,0 +1,88 @@ +# wantAgent的JS API变更Changelog + +## cl.url.1.trigger类接口变更 +trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback): void ; + +因部分功能未实现,已对其进行删除,应用可调用下面接口进行替代: + + trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback): void + + **变更影响** + +影响已发布的JS接口,应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + +| OpenHarmony 3.2.8.1版本接口 | OpenHarmony 3.2.9.1 sp8版本接口 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback): void ; | trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback): void | + +**适配指导** + +应用中调用替代的trigger接口可参考下列代码 + +示例: + +```ts +import WantAgent from '@ohos.app.ability.wantAgent'; +//wantAgent对象 +var wantAgent; +// triggerInfo +var triggerInfo = { + code: 0 + } +//WantAgentInfo对象 +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: WantAgent.OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +//getWantAgent回调 +function getWantAgentCallback(err, data) { + if (err == undefined) { + wantAgent = data; + } else { + console.info('getWantAgent failed' + JSON.stringify(wantAgent)); + } + //getUid回调 + function triggerCallback(err, data) { + if(err) { + console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + } else { + console.info('getUid ok!' + JSON.stringify(data)); + } + } + try { + WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); + } catch(err) { + console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + } +} +try{ + WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); +} catch(err){ + console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); +} +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-web.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-web.md new file mode 100644 index 0000000000000000000000000000000000000000..b065436d1d61f79f3ce80fd7ff8858d3dcc778ee --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-web.md @@ -0,0 +1,126 @@ +# web子系统ChangeLog + +## cl.web.1 删除无用错误码 + +web子系统webviewController接口存在变更: + + - 去除forward,backward和backOrForward接口的@throws { BusinessError } 17100007 - Invalid back or forward operation. + - 去除zoom,zoomIn和zoomOut接口的@throws { BusinessError } 17100009 - Cannot zoom in or zoom out. + +开发者需要根据以下说明对应用进行适配。 + + +**变更影响** + +影响已发布的JS接口,应用无需进行适配即可在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + +涉及接口: forward, backward, backOrForward, zoom, zoomIn, zoomOut; +涉及组件: web; + +**适配指导** + +无需适配 + +## cl.web.2 setWebController入参修改 + +已发布的部分web子系统controller迁移至webviewController,老的webController做废弃处理。从API9开始做出以下变更: +setWebController入参由老controller替换为新的webviewController + +**变更影响** + +基于此前版本开发的应用,需适配变更js接口的入参,否则会影响原有功能。 + +**关键的接口/组件变更** + +- 涉及接口 + + setWebController(controller: WebviewController): void; + +- 变更前: + +```js +setWebController(controller: WebController): void; +``` + +- 变更后: + +```js +setWebController(controller: WebviewController): void; +``` + +**适配指导** + +示例代码如下: +变更前: +```js +// xxx.ets +@Entry +@Component +struct WebComponent { + controller:WebController = new WebController() + build() { + Column() { + Web({ src:'www.example.com', controller: this.controller }) + .multiWindowAccess(true) + .onWindowNew((event) => { + console.log("onWindowNew...") + var popController: WebController = new WebController() + event.handler.setWebController(popController) + }) + } + } +} +``` + +变更后: +```js +// xxx.ets +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + build() { + Column() { + Web({ src:'www.example.com', controller: this.controller }) + .multiWindowAccess(true) + .onWindowNew((event) => { + console.log("onWindowNew...") + var popController: web_webview.WebviewController = new web_webview.WebviewController() + event.handler.setWebController(popController) + }) + } + } +} +``` + +## cl.web.3 getUnfilterendLinkUrl接口名修改 + +getUnfilterendLinkUrl接口拼写错误,应改为getUnfilteredLinkUrl + +**变更影响** + +基于此前版本开发的应用,需适配变更js接口名,否则会影响原有功能。 + +**关键的接口/组件变更** + +- 涉及接口 + + getUnfilteredLinkUrl(): string; + +- 变更前: + +```js +getUnfilterendLinkUrl(): string; +``` + +- 变更后: + +```js +getUnfilteredLinkUrl(): string; +``` + +**适配指导** + +基于此前版本开发的应用,需适配变更js接口名,使用新的接口名替换旧的接口名,否则会影响原有功能。 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-wifi.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-wifi.md new file mode 100644 index 0000000000000000000000000000000000000000..1f84833ca57af98d069eeba6c13c993f31cd1e8a --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-wifi.md @@ -0,0 +1,115 @@ +# 基础通信WIFI子系统ChangeLog + + +## cl.wifi.1 系统API和API9接口迁移到新增的@ohos.wifiManager.d.ts +@ohos.wifi.d.ts接口不支持抛出错误码,而API9以及SystemAPI都需要支持错误码抛出,为支持该功能,将@ohos.wifi.d.ts中的所有SystemAPI以及API9接口迁移到新增的@ohos.wifiManager.d.ts当中,并添加错误码描述。 + +后续需要import @ohos.wifiManager.d.ts才能够使用wifi的系统API以及API9接口: + +import wifiManager from '@ohos.wifiManager'; + + +**变更影响** + +仅对系统API以及API9所有接口的使用有影响,需要import @ohos.wifiManager才能使用wifi的系统API和API9接口 + +import wifiManager from '@ohos.wifiManager'; + +对于其他接口无影响 + + +**关键的接口/组件变更** + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +| wifi | namespace | declare namespace wifi | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function enableWifi(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值改为void | +| wifi | method | function disableWifi(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值改为void | +| wifi | method | function scan(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值改为void | +| wifi | method | function getScanResults(): Promise<Array<WifiScanInfo>> | API9接口变更,迁移到@ohos.wifiManager.d.ts,由getScanInfos修改为getScanResults | +| wifi | method | function getScanResults(callback: AsyncCallback<Array<WifiScanInfo>>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,由getScanInfos修改为getScanResults | +| wifi | method | function getScanResultsSync():  Array<[WifiScanInfo]> | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function addCandidateConfig(config: WifiDeviceConfig): Promise<number> | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function removeCandidateConfig(networkId: number): Promise<void> | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function removeCandidateConfig(networkId: number, callback: AsyncCallback<void>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function addUntrustedConfig(config: WifiDeviceConfig): Promise<boolean> | API9接口变更,该接口删除 | +| wifi | method | function addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void | API9接口变更,该接口删除 | +| wifi | method | function removeUntrustedConfig(config: WifiDeviceConfig): Promise<boolean> | API9接口变更,该接口删除 | +| wifi | method | function removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void | API9接口变更,该接口删除 | +| wifi | method | function getCandidateConfigs():  Array<[WifiDeviceConfig]> | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function connectToCandidateConfig(networkId: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function connectToNetwork(networkId: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function connectToDevice(config: WifiDeviceConfig): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function disconnect(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function reassociate(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function reconnect(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function disableNetwork(netId: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function removeAllNetwork(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function removeDevice(id: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function enableHotspot(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function disableHotspot(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function setHotspotConfig(config: HotspotConfig): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function getP2pLocalDevice(): Promise<WifiP2pDevice> | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function getP2pLocalDevice(callback: AsyncCallback<WifiP2pDevice>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function getP2pGroups(): Promise<Array<WifiP2pGroupInfo>> | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function createGroup(config: WifiP2PConfig): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function removeGroup(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function p2pConnect(config: WifiP2PConfig): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function p2pCancelConnect(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function startDiscoverDevices(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function stopDiscoverDevices(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function deletePersistentGroup(netId: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function setDeviceName(devName: string): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | interface | export interface WifiEapConfig | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | enum | export enum EapMethod | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | enum | export enum Phase2Method | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | interface | export interface WifiDeviceConfig | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加eapConfig参数 | +| wifi | interface | export interface IpConfig | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加prefixLength参数 | +| wifi | interface | export interface WifiInfoElem | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | enum | export enum WifiChannelWidth | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | interface | export interface WifiScanInfo | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加centerFrequency0、centerFrequency1、infoElems三个参数 | +| wifi | enum | export enum WifiSecurityType | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加4种加密类型 | +| wifi | interface | export interface WifiLinkedInfo | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加MacType参数 | + + +**适配指导(可选,不涉及则可以删除)** + +以getLinkedInfo为例,在新版本中需要使用如下方式进行调用: + +``` +import wifiManager from '@ohos.wifiManager' + +wifiManager.getLinkedInfo((err, data) => { + if (err) { + console.error("get linked info error"); + return; + } + console.info("get linked info: " + JSON.stringify(data)); +}); + +wifiManager.getLinkedInfo().then(data => { + console.info("get linked info: " + JSON.stringify(data)); +}).catch(error => { + console.info("get linked info error"); +}); + +``` + +## cl.wifiext.1 系统API和API9接口迁移到新增的@ohos.wifiManagerExt.d.ts + +@ohos.wifiext.d.ts接口不支持抛出错误码,而API9以及SystemAPI都需要支持错误码抛出,为支持该功能,将@ohos.wifiext.d.ts中的所有SystemAPI以及API9接口迁移到新增的@ohos.wifiManagerExt.d.ts当中,并添加错误码描述 + +后续需要import @ohos.wifiManagerExt.d.ts才能够使用wifi的系统API以及API9接口: + +import wifiManagerExt from '@ohos.wifiManagerExt'; + + +**变更影响** + +仅对系统API以及API9所有接口的使用有影响,需要import @ohos.wifiManagerExt才能使用wifi的系统API和API9接口,与wifiManager配套使用 + +import wifiManagerExt from '@ohos.wifiManagerExt'; + +对于其他接口无影响 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/Readme.md b/zh-cn/release-notes/changelogs/v3.2-beta5/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..638940eef70649c6c6ba17d3581b3ef6432b3aa7 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/Readme.md @@ -0,0 +1,26 @@ +# Readme + +- [元能力](changelogs-ability.md) +- [帐号](changelogs-account_os_account.md) +- [ArkUI](changelogs-arkui.md) +- [多媒体-相机](changelogs-camera-sync.md) +- [公共基础类库-容器](changelogs-container.md) +- [分布式数据管理](changelogs-distributeddatamgr.md) +- [文件管理](changelogs-filemanagement.md) +- [输入法框架](changelogs-inputmethod-framworks.md) +- [文件管理-媒体库](changelogs-mediaLibrary.md) +- [多媒体](changelogs-multimedia.md) +- [基础通信-NFC](changelogs-nfc.md) +- [事件通知](changelogs-notification.md) +- 位置服务 + - [ohos.geoLocationManager](changelogs-ohos-geoLocationManager.md) + - [ohos.geoLocation](changelogs-ohos-geoLocation.md) + - [system.geolocation](changelogs-system-geolocation.md) +- [上传下载](changelogs-request.md) +- [资源调度](changelogs-resourceschedule.md) +- [安全](changelogs-security.md) +- [电话服务](changelogs-telephony.md) +- [时间服务](changelogs-time.md) +- [公共基础类库-URL](changelogs-url.md) +- [用户IAM](changelogs-useriam.md) +- [窗口](changelogs-window.md) diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelog-x-x.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelog-x-x.md new file mode 100644 index 0000000000000000000000000000000000000000..b20dbfc1fc13ba0dc94a8044119ac0ae2473cfb7 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelog-x-x.md @@ -0,0 +1,31 @@ +# xxx子系统ChangeLog + +相比最近一个发布版本(包括不限于LTS、Release、Beta、monthly版本)发生了影响契约兼容性(契约兼容:也称语义兼容,指版本演进后,开发者原有程序行为不发生变化)的变更(包括不限于接口名、参数、返回值、所需要的权限、调用顺序、枚举值、配置参数、路径等),则需要在ChangeLog中对变更进行阐述。 + +## cl.subsystemname.x xxx功能变更, 例:DeviceType属性变更、相机权限变更(尽量概括,不要超过15个字) + +每个变更标题前需要附加编号:cl.subsystemname.x。cl为ChangeLog首字母缩写,subsystemname请填写子系统英文标准名称,x表示变更序号(从低到高逐位增加,起始为1)。 +以功能维度对变更点进行概括描述。例如:xxx功能的xxx、xxx等发生了xxx变化,开发者需要根据以下说明对应用进行适配。 +如果有此变更有对应的需求或设计文档,可以在描述中附上对应的设计文档编号。 + +**变更影响** + +是否影响已发布的接口或者接口行为发生变更,影响的是JS接口还是Native接口。 +是否影响在此前版本已开发的应用,即应用是否需要进行适配动才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + +列举此功能变更涉及的接口/组件变更。 + +**适配指导(可选,不涉及则可以删除)** + +提供指导,帮助开发者针对相关变更进行适配,使应用可以与新版本兼容。 +例: +在xxx文件中将xxx参数修改为xxx。 + +``` +sample code +``` + + + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ability.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ability.md new file mode 100644 index 0000000000000000000000000000000000000000..a75004fb8d6eeb5eebdd44c5192a204b0d061df3 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ability.md @@ -0,0 +1,175 @@ +# 元能力子系统JS API变更Changelog + +## cl.ability.1 接口迁移 +ability子系统UIAbilityContext的接口requestPermissionsFromUser迁移到security子系统: + +之前权限弹窗应用是基于UIAbility实现的,需要借助于UIAbilityContext的startAbilityForResult接口把授权结果带回给调用方,故把requestPermissionsFromUser接口暂时放在UIAbilityContext中。现在权限弹窗应用切换为基于ServiceExtensionAbility实现,不再需要借助UIAbilityContext的startAbilityForResult接口,因此把requestPermissionsFromUser接口迁移到security子系统。 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| application/UIAbilityContext | UIAbilityContext | requestPermissionsFromUser(permissions: Array, requestCallback: AsyncCallback): void; | 删除 | +| application/UIAbilityContext | UIAbilityContext | requestPermissionsFromUser(permissions: Array): Promise; | 删除 | +| @ohos.abilityAccessCtrl | AtManager | requestPermissionsFromUser(context: Context, permissions: Array, requestCallback: AsyncCallback) : void; | 新增 | +| @ohos.abilityAccessCtrl | AtManager | requestPermissionsFromUser(context: Context, permissions: Array) : Promise; | 新增 | + + +**适配指导** + +应用中调用requestPermissionsFromUser拉起权限弹窗应用可参考下列代码 + +Stage模型下的示例: + +```ts +import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts'; +//UIAbility的onWindowStageCreate生命周期 +onWindowStageCreate() { + let AtManager = abilityAccessCtrl.createAtManager(); + //requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 + AtManager.requestPermissionsFromUser(this.context, ["ohos.permission.MANAGE_DISPOSED_APP_STATUS"]).then((data) => { + console.log("data type:" + typeof(data)); + console.log("data:" + data); + console.log("data permissions:" + data.permissions); + console.log("data result:" + data.authResults); + }).catch((err) => { + console.error('Failed to start ability', err.code); + }) +} +``` + + + +## cl.ability.2 删除标记为废弃的API9接口 + +[元能力异常处理整改](../OpenHarmony_3.2.8.3/changelogs-ability.md)将部分API9接口标记为了废弃,根据OpenHarmony接口规范,需要删除标记为废弃的API9接口。 + +**变更影响** + +基于此前版本开发的应用,需要将被删除的接口替换为新接口,否则会影响应用编译。 + +**关键接口/组件变更** + +接口文件被删除: + +| 被删除接口 | 新接口 | +| ----------------------------------------------- | ----------------------------------------------- | +| @ohos.application.Ability.d.ts | @ohos.app.ability.UIAbility.d.ts | +| @ohos.application.AbilityConstant.d.ts | @ohos.app.ability.AbilityConstant.d.ts | +| @ohos.application.AbilityLifecycleCallback.d.ts | @ohos.app.ability.AbilityLifecycleCallback.d.ts | +| @ohos.application.AbilityStage.d.ts | @ohos.app.ability.AbilityStage.d.ts | +| @ohos.application.EnvironmentCallback.d.ts | @ohos.app.ability.EnvironmentCallback.d.ts | +| @ohos.application.ExtensionAbility.d.ts | @ohos.app.ability.ExtensionAbility.d.ts | +| @ohos.application.FormExtension.d.ts | @ohos.app.form.FormExtensionAbility.d.ts | +| @ohos.application.ServiceExtensionAbility.d.ts | @ohos.app.ability.ServiceExtensionAbility.d.ts | +| @ohos.application.StartOptions.d.ts | @ohos.app.ability.StartOptions.d.ts | +| @ohos.application.context.d.ts | @ohos.app.ability.common.d.ts | +| @ohos.application.errorManager.d.ts | @ohos.app.ability.errorManager.d.ts | + +接口、属性被删除: + +- @ohos.application.Configuration.d.ts + - Configuration 的 direction、screenDensity、displayId、hasPointerDevice 被删除。可以使用 @ohos.app.ability.Configuration.d.ts 的 Configuration替换。 +- @ohos.application.ConfigurationConstant.d.ts + - 枚举 Direction 和 ScreenDensity 被删除。可以使用 @ohos.app.ability.ConfigurationConstant.d.ts 的枚举 Direction 和 ScreenDensity 替换。 +- @ohos.application.abilityManager.d.ts + - 方法 getExtensionRunningInfos 和 getTopAbility 被删除。可以使用 @ohos.app.ability.abilityManager.d.ts 的同名方法替换。 +- @ohos.application.appManager.d.ts + - 枚举 ApplicationState 和 ProcessState 被删除。可以使用 @ohos.app.ability.appManager.d.ts 的枚举 ApplicationState 和 ProcessState 替换。 + - 方法 registerApplicationStateObserver 和 getProcessRunningInformation被删除。可以使用 @ohos.app.ability.appManager.d.ts 的同名方法替换。 +- @ohos.application.formHost.d.ts + - 方法 shareForm 和 notifyFormsPrivacyProtected 被删除。可以使用 @ohos.app.form.formHost.d.ts 的同名方法替换。 +- @ohos.application.formInfo.d.ts + - 枚举 FormType 的 eTS 被删除,可以使用 @ohos.app.form.formInfo.d.ts 的 FormType 中的 eTS 替换。 + - 枚举 FormParam 的 IDENTITY_KEY、BUNDLE_NAME_KEY、ABILITY_NAME_KEY、DEVICE_ID_KEY 被删除,可以使用 @ohos.app.form.formInfo.d.ts 的 FormParam 中的同名枚举替换。 + - 接口 FormInfoFilter 被删除。可以使用 @ohos.app.form.formInfo.d.ts 的 FormInfoFilter 替换。 + - 枚举 FormDimension 被删除。可以使用 @ohos.app.form.formInfo.d.ts 的 FormDimension 替换。 + - 枚举 VisibilityType 被删除。可以使用 @ohos.app.form.formInfo.d.ts 的 VisibilityType 替换。 +- @ohos.wantAgent.d.ts + - 方法 trigger 和 getOperationType 被删除。可以使用 @ohos.app.ability.wantAgent.d.ts 的同名方法替换。 +- application/ApplicationContext.d.ts + - 方法 registerAbilityLifecycleCallback、unregisterAbilityLifecycleCallback、registerEnvironmentCallback、unregisterEnvironmentCallback 被删除。可以使用 on、off 替换。 +- application/ServiceExtensionContext.d.ts + - 方法 connectAbility、connectAbilityWithAccount、disconnectAbility 被删除。可以使用 connectServiceExtensionAbility、connectServiceExtensionAbilityWithAccount、disconnectServiceExtensionAbility 替换。 +- @ohos.application.FormExtension.d.ts + - 生命周期onCreate、onCastToNormal、onUpdate、onVisibilityChange、onEvent、onDestroy、onAcquireFormState、onShare 被删除。可以使用@ohos.app.form.FormExtensionAbility.d.ts的onAddForm、onCastToNormalForm、onUpdateForm、onChangeFormVisibility、onFormEvent、onRemoveForm、onAcquireFormState、onShareForm +- @ohos.application.abilityDelegatorRegistry.d.ts + - 导出类 AbilityDelegator、AbilityDelegatorArgs、AbilityMonitor、ShellCmdResult 被删除。可以使用@ohos.app.ability.abilityDelegatorRegistry.d.ts中的同名导出类替换。 +- @ohos.application.abilityManager.d.ts + - 导出类 AbilityRunningInfo、ExtensionRunningInfo 被删除。可以使用@ohos.app.ability.abilityManager.d.ts中的同名导出类替换。 +- @ohos.application.appManager.d.ts + - 导出类 AbilityStateData、AppStateData、ApplicationStateObserver、ProcessRunningInfo、ProcessRunningInformation 被删除。可以使用@ohos.app.ability.appManager.d.ts中的同名导出类替换。 +- @ohos.application.missionManager.d.ts + - 导出类 MissionInfo、MissionListener、MissionSnapshot 被删除。可以使用@ohos.app.ability.missionManager.d.ts中的同名导出类替换。 +- @ohos.wantAgent.d.ts + - 导出类 TriggerInfo、WantAgentInfo 被删除。可以使用@ohos.app.ability.wantAgent.d.ts中的同名导出类替换。 + + + + + +**适配指导** + +如上所述,仅少数接口修改了接口名的如注册回调函数(registerAbilityLifecycleCallback、unregisterAbilityLifecycleCallback、registerEnvironmentCallback、unregisterEnvironmentCallback)和连接断开 ServiceExtensionAbility(connectAbility、connectAbilityWithAccount、disconnectAbility),卡片生命周期等需要替换成新的接口名。 + +绝大多数接口平移到了新的namespace中,所以可以通过修改import来解决适配问题: + +如原先接口使用了@ohos.application.Ability + +```js +import Ability from '@ohos.application.Ability'; +``` + +可以通过直接修改import,来切换到新的namespace上: + +```js +import Ability from '@ohos.app.ability.UIAbility'; +``` + +此外还需要适配异常处理,具体参考新接口的接口文档。 + +## cl.ability.2 appRecovery接口中RestartFlag属性名称变更,删除了未支持的属性 + +appRecovery接口中RestartFlag枚举命名从特定故障发生后**不重启**改成了特定故障发生后**重启**。 +删除了CPP_CRASH_NO_RESTART。 + +**变更影响** + +3.2.10.6版本之前使用CPP_CRASH_NO_RESTART/JS_CRASH_NO_RESTART/APP_FREEZE_NO_RESTART类型开发的应用,在3.2.10.6版本之后行为会发生变化。 + +**关键接口/组件变更** + +**RestartFlag** 9+ + +变更前: + +| 名称 | 值 | 说明 | +| --------------------- | ------ | -------------------------------- | +| ALWAYS_RESTART | 0 | 总是重启应用。 | +| CPP_CRASH_NO_RESTART | 0x0001 | 发生CPP_CRASH时**不重启**应用。 | +| JS_CRASH_NO_RESTART | 0x0002 | 发生JS_CRASH时**不重启**应用。 | +| APP_FREEZE_NO_RESTART | 0x0004 | 发生APP_FREEZE时**不重启**应用。 | +| NO_RESTART | 0xFFFF | 总是不重启应用。 | + +变更后: + +| 名称 | 值 | 说明 | +| ----------------------- | ------ | ------------------------------ | +| ALWAYS_RESTART | 0 | 总是重启应用。 | +| CPP_CRASH_NO_RESTART | NA | **删除**,不支持该场景的重启。 | +| RESTART_WHEN_JS_CRASH | 0x0001 | 发生JS_CRASH时**重启**应用。 | +| RESTART_WHEN_APP_FREEZE | 0x0002 | 发生APP_FREEZE时**重启**应用。 | +| NO_RESTART | 0xFFFF | 总是不重启应用。 | + +**适配指导** + +按新的语义进行适配。 + + + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-account_os_account.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-account_os_account.md new file mode 100644 index 0000000000000000000000000000000000000000..8b8cad7dbf026cb17c1599e61ebdbae510073a30 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-account_os_account.md @@ -0,0 +1,96 @@ +# 帐号子系统changeLog + +## cl.account_os_account.1 createOsAccountForDomain错误码变更 + +使用createOsAccountForDomain重复创建域帐号时,变更前返回的错误码为12300001,变更后返回的错误码为12300004。 +错误信息由通用系统报错细化为帐号已存在报错。 + +**变更影响** + +基于此前版本开发的应用,需适配变更后的错误码,否则会影响原有业务逻辑。 + +**关键接口/组件变更** +- AccountManager + - createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback<OsAccountInfo>); + - createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise<OsAccountInfo>; + +**适配指导** + +重复创建域帐号的示例代码如下: + +```ts +import account_osAccount from "@ohos.account.osAccount" + +let accountMgr = account_osAccount.getAccountManager(); +let domainInfo = { + accountName: "zhangsan", + domain: "china.example.com" +}; +try { + await accountMgr.createOsAccountForDomain(account_osAccount.OsAccountType.NORMAL, domainInfo); + await accountMgr.createOsAccountForDomain(account_osAccount.OsAccountType.NORMAL, domainInfo); +} catch (err) { + console.log("activateOsAccount err: " + JSON.stringify(err)); // error.code = 12300004; +} +``` + +## cl.account_os_account.2 应用帐号getAllAccounts接口权限场景变更 + +应用使用getAllAccounts接口查询自己可访问的帐号列表时,不需要申请权限ohos.permission.GET_ALL_APP_ACCOUNTS。 + +**变更影响** + +基于此后版本开发的应用,查询自己可访问的帐号列表时,无需申请权限。 + +**关键接口/组件变更** +- AccountManager + - getAllAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void; + - getAllAccounts(): Promise<Array<AppAccountInfo>>; + +**适配指导** + +应用未申请ohos.permission.GET_ALL_APP_ACCOUNTS,查询自己可访问的帐号列表示例代码如下: + +```ts +import account_appAccount from "@ohos.account.appAccount" + +let accountMgr = account_appAccount.createAppAccountManager(); +try { + await accountMgr.addAccount("accessibleAccount_promise_nopermission"); + var data = await accountMgr.getAllAccounts(); + if (data[0].name == "accessibleAccount_promise_nopermission") { + console.log("getAllAccounts successfully"); + } +} catch (err) { + console.log("getAllAccounts err: " + JSON.stringify(err)); +} +``` + +## cl.account_os_account.3 应用帐号getAccountsByOwner接口权限场景变更 + +应用使用getAccountsByOwner接口查询可访问的指定应用的帐号列表时,不需要申请权限ohos.permission.GET_ALL_APP_ACCOUNTS。 + +**变更影响** + +基于此后版本开发的应用,查询指定应用可访问的帐号列表时,无需申请权限。 + +**关键接口/组件变更** +- AccountManager + - getAccountsByOwner(owner: string, callback: AsyncCallback<Array<AppAccountInfo>>): void; + - getAccountsByOwner(owner: string): Promise<Array<AppAccountInfo>>; + +**适配指导** + +应用未申请ohos.permission.GET_ALL_APP_ACCOUNTS,查询指定应用可访问的帐号列表示例代码如下: + +```ts +import account_appAccount from "@ohos.account.appAccount" + +let accountMgr = account_appAccount.createAppAccountManager(); +try { + var ownerName = "com.example.owner"; + var data = await accountMgr.getAllAccounts(ownerName); +} catch (err) { + console.log("getAllAccounts err: " + JSON.stringify(err)); +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-arkui.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-arkui.md new file mode 100644 index 0000000000000000000000000000000000000000..d77b0d5199966674cbbd0db22be3fa7b37038519 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-arkui.md @@ -0,0 +1,332 @@ +# arkui子系统ChangeLog + +## cl.arkui.1 状态变量数据类型声明使用限制 + +1. 所有的状态装饰器变量需要显式声明变量类型,不允许声明any,不支持Date数据类型。 + + 示例: + + ```ts + // xxx.ets + @Entry + @Component + struct DatePickerExample { + // 错误写法: @State isLunar: any = false + @State isLunar: boolean = false + // 错误写法: @State selectedDate: Date = new Date('2021-08-08') + private selectedDate: Date = new Date('2021-08-08') + + build() { + Column() { + Button('切换公历农历') + .margin({ top: 30 }) + .onClick(() => { + this.isLunar = !this.isLunar + }) + DatePicker({ + start: new Date('1970-1-1'), + end: new Date('2100-1-1'), + selected: this.selectedDate + }) + .lunar(this.isLunar) + .onChange((value: DatePickerResult) => { + this.selectedDate.setFullYear(value.year, value.month, value.day) + console.info('select current date is: ' + JSON.stringify(value)) + }) + + }.width('100%') + } + } + ``` + + ![datePicker](../../../application-dev/reference/arkui-ts/figures/datePicker.gif) + +2. @State、@Provide、 @Link和@Consume四种状态变量的数据类型声明只能由简单数据类型或引用数据类型的其中一种构成。 + + 类型定义中的Length、ResourceStr、ResourceColor三个类型是简单数据类型或引用数据类型的组合,所以不能被以上四种状态装饰器变量使用。 + Length、ResourceStr、ResourceColor的定义请看文档[arkui-ts类型定义](../../../application-dev/reference/arkui-ts/ts-types.md)。 + + 示例: + + ```ts + // xxx.ets + @Entry + @Component + struct IndexPage { + // 错误写法: @State message: string | Resource = 'Hello World' + @State message: string = 'Hello World' + // 错误写法: @State message: ResourceStr = $r('app.string.hello') + @State resourceStr: Resource = $r('app.string.hello') + + build() { + Row() { + Column() { + Text(`${this.message}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } + } + ``` + + ![hello](../../../application-dev/quick-start/figures/hello.PNG) + +**变更影响** + +1. 如果状态装饰器变量没有显式声明变量类型,声明any,编译拦截报错; + ```ts + // ArkTS:ERROR Please define an explicit type, not any. + @State isLunar: any = false + ``` +2. 状态装饰器变量声明变量类型为Date,编译拦截报错; + ```ts + // ArkTS:ERROR The @State property 'selectedDate' cannot be a 'Date' object. + @State selectedDate: Date = new Date('2021-08-08') + ``` +3. @State、@Provide、 @Link和@Consume四种状态变量使用框架提供的Length、ResourceStr、ResourceColor, + 编译拦截报错。 + ```ts + /* ArkTS:ERROR The state variable type here is 'ResourceStr', it contains both a simple type and an object type, + which are not allowed to be defined for state variable of a struct.*/ + @State message: ResourceStr = $r('app.string.hello') + ``` + +**关键的接口/组件变更** + +不涉及。 + +**适配指导** + +1. 状态装饰器变量声明具体的变量类型替代any; +2. 使用Date对象的状态装饰器变量,修改为不加状态装饰器修饰的常规变量; +3. 因为Length(string|number|Resource), ResourceStr(string|Resource), ResourceColor(string|number|Color|Resource) + 的三个类型是简单数据类型或引用数据类型的组合,使用@State、@Provide、 @Link和@Consume四种状态变量场景参考以下修改: + ```ts + // 错误写法: + @State message: ResourceStr = $r('app.string.hello') + // 修正后的写法: + @State resourceStr: Resource = $r('app.string.hello') + ``` + + +## cl.arkui.2 自定义组件成员变量初始化的规则与约束 + +通过构造函数方法初始化成员变量,需要遵循如下规则: + +| **从父组件中的变量(右)到子组件中的变量(下)** | **regular** | **@State** | **@Link** | **@Prop** | **@Provide** | **@Consume** | **@ObjectLink** | +|---------------------------------|----------------------------|------------|-----------|-----------|--------------|--------------|------------------| +| **regular** | 支持 | 支持 | 支持 | 支持 | 不支持 | 不支持 | 支持 | +| **@State** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | +| **@Link** | 不支持 | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | +| **@Prop** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | +| **@Provide** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | +| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | +| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | + +| **从父组件中的变量(右)到子组件中的变量(下)** | **@StorageLink** | **@StorageProp** | **@LocalStorageLink** | **@LocalStorageProp** | +|------------------|------------------|------------------|-----------------------|------------------------| +| **regular** | 支持 | 不支持 | 不支持 | 不支持 | +| **@State** | 支持 | 支持 | 支持 | 支持 | +| **@Link** | 支持(1) | 支持(1) | 支持(1) | 支持(1) | +| **@Prop** | 支持 | 支持 | 支持 | 支持 | +| **@Provide** | 支持 | 支持 | 支持 | 支持 | +| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | +| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | + +> **说明** +> +> **支持(1)**:必须使用`$`, 例如 `this.$varA`。 +> **regular**:未加修饰的常规变量。 + +不允许从父组件初始化`@StorageLink`, `@StorageProp`, `@LocalStorageLink`, `@LocalStorageProp`修饰的变量。 + +**变更影响** + +1. 不允许从父组件初始化`@LocalStorageLink`, `@LocalStorageProp`修饰的变量。 + ```ts + @Entry + @Component + struct LocalStorageComponent { + build() { + Column() { + Child({ + /* ArkTS:ERROR Property 'simpleVarName' in the custom component 'Child' cannot + initialize here (forbidden to specify). */ + simpleVarName: 1, + /* ArkTS:ERROR Property 'objectName' in the custom component 'Child' cannot + initialize here (forbidden to specify). */ + objectName: new ClassA("x") + }) + } + } + } + @Component + struct Child { + @LocalStorageLink("storageSimpleProp") simpleVarName: number = 0; + @LocalStorageProp("storageObjectProp") objectName: ClassA = new ClassA("x"); + build() {} + } + ``` +2. 子组件的@ObjectLink变量不支持父组件装饰器变量的直接赋值,其父组件的源必须是数组的项或对象的属性,该数组或对象必现用`@State`、`@Link`、`@Provide`、`@Consume`或`@ObjectLink`装饰器修饰。 + ```ts + let NextID : number = 0; + + @Observed class ClassA { + public id : number; + public c: number; + constructor(c: number) { + this.id = NextID++; + this.c = c; + } + } + + @Component + struct Child { + @ObjectLink varA : ClassA; + build() { + Row() { + Text('ViewA-' + this.varA.id) + } + } + } + + @Component + struct Parent { + @Link linkValue: ClassA + build() { + Column() { + /* ArkTS:ERROR The @Link property 'linkValue' cannot be assigned to + the @ObjectLink property 'varA'.*/ + Child({ varA: this.linkValue }) + } + } + } + ``` + +**关键的接口/组件变更** + +不涉及。 + +**适配指导** +1. 构造子组件时,不对子组件的`@LocalStorageLink`, `@LocalStorageProp`修饰的变量进行。 +如果需要在父组件中修改子组件的`@LocalStorageLink`, `@LocalStorageProp`修饰的变量,则使用LocalStorage提供的API接口方法(比如set方法)赋值。 +2. @ObjectLink的使用指导请参考文档[@ObjectLink使用指导](../../../application-dev/quick-start/arkts-state-mgmt-page-level.md)。 + + +## cl.arkui.LocalStorage.1 get接口返回类型变更 + +**变更影响** + +返回类型从get(propName: string): T变更为get(propName: string): T | undefined +应用不需要进行适配。 + +## cl.arkui.LocalStorage.2 setOrCreate参数newValue变成必选 +**变更影响** + +原接口声明: +```js +setOrCreate(propName: string, newValue?: T): boolean +``` +现接口声明: +```js +setOrCreate(propName: string, newValue: T): boolean +``` +第二个参数newValue变为必选。 +如果应用调用这个接口没有指定newValue参数,在替换新的sdk后会编译不过,需要手动指定newValue。 + +**适配指导** + +```js +let storage = new LocalStorage(); +storage.setOrCreate('propA', 'hello'); +``` +## cl.arkui.LocalStorage.3 link参数和返回类型变更 +**变更影响** + +原接口声明: +```js +link(propName: string, linkUser?: T, subscribersName?: string): T +``` +现接口声明: +```js +link(propName: string): SubscribedAbstractProperty +``` +1. link第二三个参数为框架内部调用,不应对外开发,所以将接口变更为一个参数; +2. 返回类型T变更为SubscribedAbstractProperty; + +**适配指导** + +```js +let storage = new LocalStorage({"PropA": "47"}); +let linA = storage.link("PropA"); +linA.set(50); +``` + +## cl.arkui.LocalStorage.4 setAndLink参数和返回类型变更 +**变更影响** + +原接口声明: +```js +setAndLink(propName: string, defaultValue: T, linkUser?: T, subscribersName?: string): T +``` +现接口声明: +```js +setAndLink(propName: string, defaultValue: T): SubscribedAbstractProperty +``` +1. setAndLink第三四个参数为框架内部调用,不应对外开发,所以将接口变更为2个参数; +2. 返回类型T变更为SubscribedAbstractProperty; + +**适配指导** + +```js +let storage = new LocalStorage({"PropA": "47"}); +let linA = storage.setAndLink("PropA", "48") +linA.set(50); +``` + +## cl.arkui.LocalStorage.5 prop参数和返回类型变更 +**变更影响** + +原接口声明: +```js +prop(propName: string, propUser?: T, subscribersName?: string): T +``` +现接口声明: +```js +prop(propName: string): SubscribedAbstractProperty +``` +1. prop第二三个参数为框架内部调用,不应对外开发,所以将接口变更为1个参数; +2. 返回类型T变更为SubscribedAbstractProperty; + +**适配指导** + +```js +let storage = new LocalStorage({"PropA": "47"}); +let propA = storage.prop("PropA"); +propA.set(51); // one-way sync +``` + +## cl.arkui.LocalStorage.6 setAndProp参数和返回类型变更 +**变更影响** + +原接口声明: +```js +setAndProp(propName: string, defaultValue: T, propUser?: T, subscribersName?: string): T +``` +现接口声明: +```js +setAndProp(propName: string, defaultValue: S): SubscribedAbstractProperty +``` +1. setAndProp第三四个参数为框架内部调用,不应对外开发,所以将接口变更为2个参数; +2. 返回类型T变更为SubscribedAbstractProperty; + +**适配指导** + +```js +let storage = new LocalStorage({"PropA": "47"}); +let propA = storage.setAndProp("PropA", "48"); +propA.set(51); // one-way sync +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-camera-sync.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-camera-sync.md new file mode 100644 index 0000000000000000000000000000000000000000..3f5cd56d576151dc37ab56f50301a4d4443a271a --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-camera-sync.md @@ -0,0 +1,520 @@ +# 媒体子系统 JS API 变更 Changelog + +## cl.subsystemname.1 camera 接口变更 +1. camera 部件在 API9 版本全量改为 SystemAPI +2. 基于以下原因新增部分功能接口以及废弃部分接口: + +提升开发者使用相机接口的便利。 +帮助开发者快速掌握相机开发接口,快速投入到开发当中。 +易于后续版本中框架功能的扩展,降低框架模块之间的耦合度。 + +具体参考下方变更内容,开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +影响 API9 版本的 JS 接口,应用需要进行适配才可以在新版本 SDK 环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 是否为 SystemApi | 变更类型 | +| ---------------------- | ----------------------- | ------------------------------------------------------------ | --------------- | -------- | +| ohos.multimedia.camera | camera | function getCameraManager(context: Context): CameraManager; | 是 | 新增 | +| ohos.multimedia.camera | camera | function getCameraManager(context: Context, callback: AsyncCallback): void;
function getCameraManager(context: Context): Promise; | 是 | 废弃 | +| ohos.multimedia.camera | CameraErrorCode | INVALID_ARGUMENT = 7400101,
OPERATION_NOT_ALLOWED = 7400102,
SESSION_NOT_CONFIG = 7400103,
SESSION_NOT_RUNNING = 7400104,
SESSION_CONFIG_LOCKED = 7400105,
DEVICE_SETTING_LOCKED = 7400106,
CONFILICT_CAMERA = 7400107,
DEVICE_DISABLED = 7400108,
SERVICE_FATAL_ERROR = 7400201 | 是 | 新增 | +| ohos.multimedia.camera | CameraManager | getSupportedCameras(): Array;
getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability;
createCameraInput(camera: CameraDevice): CameraInput;
createCameraInput(position: CameraPosition, type: CameraType): CameraInput;
createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput;
createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput;
createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput;
createMetadataOutput(metadataObjectTypes: Array): MetadataOutput;
createCaptureSession(): CaptureSession; | 是 | 新增 | +| ohos.multimedia.camera | CameraManager | getSupportedCameras(callback: AsyncCallback>): void;
getSupportedCameras(): Promise>;
getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void;
getSupportedOutputCapability(camera: CameraDevice): Promise;
createCameraInput(camera: CameraDevice, callback: AsyncCallback): void;
createCameraInput(camera: CameraDevice): Promise;
createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void;
createCameraInput(position: CameraPosition, type: CameraType): Promise;
createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPreviewOutput(profile: Profile, surfaceId: string): Promise;
createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPhotoOutput(profile: Profile, surfaceId: string): Promise;
createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void;
createVideoOutput(profile: VideoProfile, surfaceId: string): Promise;
createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void;
createMetadataOutput(metadataObjectTypes: Array): Promise;
createCaptureSession(callback: AsyncCallback): void;
createCaptureSession(): Promise; | 是 | 废弃 | +| ohos.multimedia.camera | CameraType | CAMERA_TYPE_DEFAULT = 0 | 是 | 新增 | +| ohos.multimedia.camera | CameraType | CAMERA_TYPE_UNSPECIFIED = 0 | 是 | 废弃 | +| ohos.multimedia.camera | CameraInput | on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; | 是 | 新增 | +| ohos.multimedia.camera | CameraInput | release(callback: AsyncCallback): void;
release(): Promise;
on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; | 是 | 废弃 | +| ohos.multimedia.camera | CameraInputErrorCode | ERROR_UNKNOWN = -1
ERROR_NO_PERMISSION = 0
ERROR_DEVICE_PREEMPTED = 1
ERROR_DEVICE_DISCONNECTED = 2
ERROR_DEVICE_IN_USE = 3
ERROR_DRIVER_ERROR = 4 | 是 | 废弃 | +| ohos.multimedia.camera | CameraInputError | code: CameraInputErrorCode | 是 | 废弃 | +| ohos.multimedia.camera | CaptureSession | beginConfig(): void;
addInput(cameraInput: CameraInput): void;
removeInput(cameraInput: CameraInput): void;
addOutput(cameraOutput: CameraOutput): void;
removeOutput(cameraOutput: CameraOutput): void;
hasFlash(): boolean;
isFlashModeSupported(flashMode: FlashMode): boolean;
getFlashMode(): FlashMode;
setFlashMode(flashMode: FlashMode): void;
isExposureModeSupported(aeMode: ExposureMode): boolean;
getExposureMode(): ExposureMode;
setExposureMode(aeMode: ExposureMode): void;
getMeteringPoint(): Point;
setMeteringPoint(point: Point): void;
getExposureBiasRange(): Array;
setExposureBias(exposureBias: number): void;
getExposureValue(): number;
isFocusModeSupported(afMode: FocusMode): boolean;
getFocusMode(): FocusMode;
setFocusMode(afMode: FocusMode): void;
setFocusPoint(point: Point): void;
getFocusPoint(): Point;
getFocalLength(): number;
getZoomRatioRange(): Array;
getZoomRatio(): number;
setZoomRatio(zoomRatio: number): void;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean;
getActiveVideoStabilizationMode(): VideoStabilizationMode;
setVideoStabilizationMode(mode: VideoStabilizationMode): void;
on(type: 'error', callback: ErrorCallback): void; | 是 | 新增 | +| ohos.multimedia.camera | CaptureSession | beginConfig(callback: AsyncCallback): void;
beginConfig(): Promise;
addInput(cameraInput: CameraInput, callback: AsyncCallback): void;
addInput(cameraInput: CameraInput): Promise;
removeInput(cameraInput: CameraInput, callback: AsyncCallback): void;
removeInput(cameraInput: CameraInput): Promise;
addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
addOutput(cameraOutput: CameraOutput): Promise;
removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
removeOutput(cameraOutput: CameraOutput): Promise;
hasFlash(callback: AsyncCallback): void;
hasFlash(): Promise;
isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void;
isFlashModeSupported(flashMode: FlashMode): Promise;
getFlashMode(callback: AsyncCallback): void;
getFlashMode(): Promise;
setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void;
setFlashMode(flashMode: FlashMode): Promise;
isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void;
isExposureModeSupported(aeMode: ExposureMode): Promise;
getExposureMode(callback: AsyncCallback): void;
getExposureMode(): Promise;
setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void;
setExposureMode(aeMode: ExposureMode): Promise;
getMeteringPoint(callback: AsyncCallback): void;
getMeteringPoint(): Promise;
setMeteringPoint(point: Point, callback: AsyncCallback): void;
setMeteringPoint(point: Point): Promise;
getExposureBiasRange(callback: AsyncCallback>): void;
getExposureBiasRange(): Promise>;
setExposureBias(exposureBias: number, callback: AsyncCallback): void;
setExposureBias(exposureBias: number): Promise;
getExposureValue(callback: AsyncCallback): void;
getExposureValue(): Promise;
isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void;
isFocusModeSupported(afMode: FocusMode): Promise;
getFocusMode(callback: AsyncCallback): void;
getFocusMode(): Promise;
setFocusMode(afMode: FocusMode, callback: AsyncCallback): void;
setFocusMode(afMode: FocusMode): Promise;
setFocusPoint(point: Point, callback: AsyncCallback): void;
setFocusPoint(point: Point): Promise;
getFocusPoint(callback: AsyncCallback): void;
getFocusPoint(): Promise;
getFocalLength(callback: AsyncCallback): void;
getFocalLength(): Promise;
getZoomRatioRange(callback: AsyncCallback>): void;
getZoomRatioRange(): Promise>;
getZoomRatio(callback: AsyncCallback): void;
getZoomRatio(): Promise;
setZoomRatio(zoomRatio: number, callback: AsyncCallback): void;
setZoomRatio(zoomRatio: number): Promise;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback): void;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise;
getActiveVideoStabilizationMode(callback: AsyncCallback): void;
getActiveVideoStabilizationMode(): Promise;
setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback): void;
setVideoStabilizationMode(mode: VideoStabilizationMode): Promise;
on(type: 'error', callback: ErrorCallback): void; | 是 | 废弃 | +| ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_UNKNOWN = -1
ERROR_INSUFFICIENT_RESOURCES = 0
ERROR_TIMEOUT = 1 | 是 | 废弃 | +| ohos.multimedia.camera | CaptureSessionError | code: CaptureSessionErrorCode | 是 | 废弃 | +| ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback): void; | 是 | 新增 | +| ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback): void; | 是 | 废弃 | +| ohos.multimedia.camera | PreviewOutputErrorCode | ERROR_UNKNOWN = -1 | 是 | 废弃 | +| ohos.multimedia.camera | PreviewOutputError | code: PreviewOutputErrorCode | 是 | 废弃 | +| ohos.multimedia.camera | PhotoOutput | capture(): Promise;
isMirrorSupported(): boolean;
on(type: 'error', callback: ErrorCallback): void; | 是 | 新增 | +| ohos.multimedia.camera | PhotoOutput | isMirrorSupported(callback: AsyncCallback): void;
isMirrorSupported(): Promise;
on(type: 'error', callback: ErrorCallback): void; | 是 | 废弃 | +| ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_UNKNOWN = -1
ERROR_DRIVER_ERROR = 0
ERROR_INSUFFICIENT_RESOURCES = 1
ERROR_TIMEOUT = 2 | 是 | 废弃 | +| ohos.multimedia.camera | PhotoOutputError | code: PhotoOutputErrorCode | 是 | 废弃 | +| ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback): void; | 是 | 新增 | +| ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback): void; | 是 | 废弃 | +| ohos.multimedia.camera | VideoOutputErrorCode | ERROR_UNKNOWN = -1
ERROR_DRIVER_ERROR = 0 | 是 | 废弃 | +| ohos.multimedia.camera | VideoOutputError | code: VideoOutputErrorCode | 是 | 废弃 | +| ohos.multimedia.camera | MetadataObject | readonly type: MetadataObjectType;
readonly timestamp: number; | 是 | 新增 | +| ohos.multimedia.camera | MetadataObject | getType(callback: AsyncCallback): void;
getType(): Promise;
getTimestamp(callback: AsyncCallback): void;
getTimestamp(): Promise;
getBoundingBox(callback: AsyncCallback): void;
getBoundingBox(): Promise; | 是 | 废弃 | +| ohos.multimedia.camera | MetadataFaceObject | readonly boundingBox: Rect | 是 | 新增 | +| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback): void; | 是 | 新增 | +| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback): void; | 是 | 废弃 | +| ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_UNKNOWN = -1
ERROR_INSUFFICIENT_RESOURCES = 0 | 是 | 废弃 | +| ohos.multimedia.camera | MetadataOutputError | code: MetadataOutputErrorCode | 是 | 废弃 | + +**适配指导** + +除新增接口,和废弃接口之外,开发者需要关注变更的接口的适配: + +从 Beta4 版本开始,对以下接口进行调整: + +**新增接口** + +1. CameraErrorCode 枚举 + + 枚举值名称:INVALID_ARGUMENT, 值:7400101; + + 枚举值名称:OPERATION_NOT_ALLOWED, 值:7400102; + + 枚举值名称:SESSION_NOT_CONFIG, 值:7400103; + + 枚举值名称:SESSION_NOT_RUNNING, 值:7400104; + + 枚举值名称:SESSION_CONFIG_LOCKED, 值:7400105; + + 枚举值名称:DEVICE_SETTING_LOCKED, 值:7400106; + + 枚举值名称:CONFILICT_CAMERA, 值:7400107; + + 枚举值名称:DEVICE_DISABLED, 值:7400108; + + 枚举值名称:SERVICE_FATAL_ERROR, 值:7400201; + +2. PhotoOutput 接口新增 capture(): Promise; + +3. MetadataObject 接口中新增 readonly type: MetadataObjectType; + +4. MetadataObject 接口中新增 readonly timestamp: number; + +5. MetadataObject 接口中新增 readonly boundingBox: Rect; + +**废弃接口** + +1. CameraInput 中废弃接口 release(callback: AsyncCallback): void; 以及 release(): Promise; + +2. 废弃枚举 CameraInputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_NO_PERMISSION = 0,ERROR_DEVICE_PREEMPTED = 1,ERROR_DEVICE_DISCONNECTED = 2,ERROR_DEVICE_IN_USE = 3,ERROR_DRIVER_ERROR = 4); + +3. 废弃接口 CameraInputError 以及接口属性 code:CameraInputErrorCode; + +4. 废弃枚举 CaptureSessionErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_INSUFFICIENT_RESOURCES = 0,ERROR_TIMEOUT = 1); + +5. 废弃接口 CaptureSessionError 以及接口属性 code: CaptureSessionErrorCode; + +6. 废弃枚举 PreviewOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1); + +7. 废弃接口 PreviewOutputError 以及接口属性 code: PreviewOutputErrorCode; + +8. 废弃枚举 PhotoOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_DRIVER_ERROR = 0,ERROR_INSUFFICIENT_RESOURCES = 1,ERROR_TIMEOUT = 2); + +9. 废弃接口 PhotoOutputError 以及接口属性 code:PhotoOutputErrorCode; + +10. 废弃枚举 VideoOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_DRIVER_ERROR = 0); + +11. 废弃接口 VideoOutputError 以及接口属性 code:VideoOutputErrorCode; + +12. 废弃接口 MetadataObject 中 getType(callback: AsyncCallback): void; + +13. 废弃接口 MetadataObject 中 getType(): Promise; + +14. 废弃接口 MetadataObject 中 getTimestamp(callback: AsyncCallback): void; + +15. 废弃接口 MetadataObject 中 getTimestamp(): Promise; + +16. 废弃接口 MetadataObject 中 getBoundingBox(callback: AsyncCallback): void; + +17. 废弃接口 MetadataObject 中 getBoundingBox(): Promise; + +18. 废弃枚举 MetadataOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_INSUFFICIENT_RESOURCES = 0); + +19. 废弃接口 MetadataOutputError 以及接口属性 code:MetadataOutputErrorCode; + +**接口变更** + +1. camera 模块中接口 getCameraManager 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getCameraManager(context: Context, callback: AsyncCallback): void; 以及 getCameraManager(context: Context): Promise; 变更为 getCameraManager(context: Context): CameraManager; + + 参考代码如下: + + ``` + let cameraManager = camera.getCameraManager(context); + ``` + +2. CameraManager 中接口 getSupportedCameras 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getSupportedCameras(callback: AsyncCallback>): void; 以及 getSupportedCameras(): Promise>; 变更为 getSupportedCameras(): Array; + + 参考代码如下: + + ``` + let cameras = cameraManager.getSupportedCameras(); + ``` + +3. CameraManager 中接口 getSupportedOutputCapability 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void; 以及 getSupportedOutputCapability(camera: CameraDevice): Promise; 变更为 getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability; + + 参考代码如下: + + ``` + let cameraDevice = cameras[0]; + let CameraOutputCapability = cameraManager.getSupportedOutputCapability(cameraDevice); + ``` + +4. CameraManager 中接口 createCameraInput(camera: CameraDevice) 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createCameraInput(camera: CameraDevice, callback: AsyncCallback): void; 以及 createCameraInput(camera: CameraDevice): Promise; 变更为 createCameraInput(camera: CameraDevice): CameraInput; + + 参考代码如下: + + ``` + let cameraDevice = cameras[0]; + let cameraInput = cameraManager.createCameraInput(cameraDevice); + ``` + +5. CameraManager 中接口 createCameraInput(position: CameraPosition, type: CameraType) 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void; 以及 createCameraInput(position: CameraPosition, type: CameraType): Promise; 变更为 createCameraInput(position: CameraPosition, type: CameraType): CameraInput; + + 参考代码如下: + + ``` + let cameraDevice = cameras[0]; + let position = cameraDevice.cameraPosition; + let type = cameraDevice.cameraType; + let cameraInput = cameraManager.createCameraInput(position, type); + ``` + +6. CameraManager 中接口 createPreviewOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void; 以及 createPreviewOutput(profile: Profile, surfaceId: string): Promise; 变更为 createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput; + + 参考代码如下: + + ``` + let profile = cameraoutputcapability.previewProfiles[0]; + let previewOutput = cameraManager.createPreviewOutput(profile, surfaceId); + ``` + +7. CameraManager 中接口 createPhotoOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void; 以及 createPhotoOutput(profile: Profile, surfaceId: string): Promise; 变更为 createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput; + + 参考代码如下: + + ``` + let profile = cameraoutputcapability.photoProfiles[0]; + let photoOutput = cameraManager.createPhotoOutput(profile, surfaceId); + ``` + +8. CameraManager 中接口 createVideoOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void; 以及 createVideoOutput(profile: VideoProfile, surfaceId: string): Promise; 变更为 createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput; + + 参考代码如下: + + ``` + let profile = cameraoutputcapability.videoProfiles[0]; + let videoOutput = cameraManager.createVideoOutput(profile, surfaceId); + ``` + +9. CameraManager 中接口 createMetadataOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void; 以及 createMetadataOutput(metadataObjectTypes: Array): Promise; 变更为 createMetadataOutput(metadataObjectTypes: Array): MetadataOutput; + + 参考代码如下: + + ``` + let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes; + let metadataOutput = cameraManager.createMetadataOutput(metadataObjectTypes); + ``` + +10. CameraManager 中接口 createCaptureSession 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createCaptureSession(callback: AsyncCallback): void; 以及 createCaptureSession(): Promise; 变更为 createCaptureSession(): CaptureSession; + + 参考代码如下: + + ``` + let captureSession = cameraManager.createCaptureSession(); + ``` + +11. 枚举 CameraType 中,枚举值名称 CAMERA_TYPE_UNSPECIFIED 变更为 CAMERA_TYPE_DEFAULT。 + +12. CameraInput 中,on 接口返回值类型由 CameraInputError 变更为 BusinessError,因此旧接口 on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; 变更为 on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; + + 参考代码如下: + + ``` + let cameraDevice = cameras[0]; + cameraInput.on('error', cameraDevice, (BusinessError) => { + + }) + ``` + +13. CaptureSession 中接口 beginConfig 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 beginConfig(callback: AsyncCallback): void; 以及 beginConfig(): Promise; 变更为 beginConfig(): void; + + 参考代码如下: + + ``` + captureSession.beginConfig(); + ``` + +14. CaptureSession 中接口 addInput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 addInput(cameraInput: CameraInput, callback: AsyncCallback): void; 以及 addInput(cameraInput: CameraInput): Promise; 变更为 addInput(cameraInput: CameraInput): void; + + 参考代码如下: + + ``` + captureSession.addInput(cameraInput); + ``` + +15. CaptureSession 中接口 removeInput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 removeInput(cameraInput: CameraInput, callback: AsyncCallback): void; 以及 removeInput(cameraInput: CameraInput): Promise; 变更为 removeInput(cameraInput: CameraInput): void; + + 参考代码如下: + + ``` + captureSession.removeInput(cameraInput); + ``` + +16. CaptureSession 中接口 addOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void; 以及 addOutput(cameraOutput: CameraOutput): Promise; 变更为 addOutput(cameraOutput: CameraOutput): void; + + 参考代码如下: + + ``` + captureSession.addOutput(previewOutput); + ``` + +17. CaptureSession 中接口 removeOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void; 以及 removeOutput(cameraOutput: CameraOutput): Promise; 变更为 removeOutput(cameraOutput: CameraOutput): void; + + 参考代码如下: + + ``` + captureSession.removeOutput(previewOutput); + ``` + +18. CaptureSession 中接口 hasFlash 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 hasFlash(callback: AsyncCallback): void; 以及 hasFlash(): Promise; 变更为 hasFlash(): boolean; + + 参考代码如下: + + ``` + let status = captureSession.hasFlash(); + ``` + +19. CaptureSession 中接口 isFlashModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void; 以及 isFlashModeSupported(flashMode: FlashMode): Promise; 变更为 isFlashModeSupported(flashMode: FlashMode): boolean; + + 参考代码如下: + + ``` + let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO); + ``` + +20. CaptureSession 中接口 getFlashMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFlashMode(callback: AsyncCallback): void; 以及 getFlashMode(): Promise; 变更为 getFlashMode(): FlashMode; + + 参考代码如下: + + ``` + let flashMode = captureSession.getFlashMode(); + ``` + +21. CaptureSession 中接口 isExposureModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void; 以及 isExposureModeSupported(aeMode: ExposureMode): Promise; 变更为 isExposureModeSupported(aeMode: ExposureMode): boolean; + + 参考代码如下: + + ``` + let isSupported = captureSession.isExposureModeSupported(camera.ExposureMode.EXPOSURE_MODE_LOCKED); + ``` + +22. CaptureSession 中接口 getExposureMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getExposureMode(callback: AsyncCallback): void; 以及 getExposureMode(): Promise; 变更为 getExposureMode(): ExposureMode; + + 参考代码如下: + + ``` + let exposureMode = captureSession.getExposureMode(); + ``` + +23. CaptureSession 中接口 setExposureMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void; 以及 setExposureMode(aeMode: ExposureMode): Promise; 变更为 setExposureMode(aeMode: ExposureMode): void; + + 参考代码如下: + + ``` + captureSession.setExposureMode(camera.ExposureMode.EXPOSURE_MODE_LOCKED); + ``` + +24. CaptureSession 中接口 getMeteringPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getMeteringPoint(callback: AsyncCallback): void; 以及 getMeteringPoint(): Promise; 变更为 getMeteringPoint(): Point; + + 参考代码如下: + + ``` + let exposurePoint = captureSession.getMeteringPoint(); + ``` + +25. CaptureSession 中接口 setMeteringPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setMeteringPoint(point: Point, callback: AsyncCallback): void; 以及 setMeteringPoint(point: Point): Promise; 变更为 setMeteringPoint(point: Point): void; + + 参考代码如下: + + ``` + let Point2 = {x: 2, y: 2}; + captureSession.setMeteringPoint(Point2); + ``` + +26. CaptureSession 中接口 getExposureBiasRange 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getExposureBiasRange(callback: AsyncCallback>): void; 以及 getExposureBiasRange(): Promise>; 变更为 getExposureBiasRange(): Array; + + 参考代码如下: + + ``` + let biasRangeArray = captureSession.getExposureBiasRange(); + ``` + +27. CaptureSession 中接口 setExposureBias 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setExposureBias(exposureBias: number, callback: AsyncCallback): void; 以及 setExposureBias(exposureBias: number): Promise; 变更为 setExposureBias(exposureBias: number): void; + + 参考代码如下: + + ``` + let exposureBias = biasRangeArray[0]; + captureSession.setExposureBias(exposureBias); + ``` + +28. CaptureSession 中接口 getExposureValue 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getExposureValue(callback: AsyncCallback): void; 以及 getExposureValue(): Promise; 变更为 getExposureValue(): number; + + 参考代码如下: + + ``` + let exposureValue = captureSession.getExposureValue(); + ``` + +29. CaptureSession 中接口 isFocusModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void; 以及 isFocusModeSupported(afMode: FocusMode): Promise; 变更为 isFocusModeSupported(afMode: FocusMode): boolean; + + 参考代码如下: + + ``` + let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO); + ``` + +30. CaptureSession 中接口 getFocusMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFocusMode(callback: AsyncCallback): void; 以及 getFocusMode(): Promise; 变更为 getFocusMode(): FocusMode; + + 参考代码如下: + + ``` + let afMode = captureSession.getFocusMode(); + ``` + +31. CaptureSession 中接口 setFocusMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setFocusMode(afMode: FocusMode, callback: AsyncCallback): void; 以及 setFocusMode(afMode: FocusMode): Promise; 变更为 setFocusMode(afMode: FocusMode): void; + + 参考代码如下: + + ``` + captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_AUTO); + ``` + +32. CaptureSession 中接口 setFocusPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setFocusPoint(point: Point, callback: AsyncCallback): void; 以及 setFocusPoint(point: Point): Promise; 变更为 setFocusPoint(point: Point): void; + + 参考代码如下: + + ``` + let Point2 = {x: 2, y: 2}; + captureSession.setFocusPoint(Point2); + ``` + +33. CaptureSession 中接口 getFocusPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFocusPoint(callback: AsyncCallback): void; 以及 getFocusPoint(): Promise; 变更为 getFocusPoint(): Point; + + 参考代码如下: + + ``` + let point = captureSession.getFocusPoint(); + ``` + +34. CaptureSession 中接口 getFocalLength 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFocalLength(callback: AsyncCallback): void; 以及 getFocalLength(): Promise; 变更为 getFocalLength(): number; + + 参考代码如下: + + ``` + let focalLength = captureSession.getFocalLength(); + ``` + +35. CaptureSession 中接口 getZoomRatioRange 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getZoomRatioRange(callback: AsyncCallback>): void; 以及 getZoomRatioRange(): Promise>; 变更为 getZoomRatioRange(): Array; + + 参考代码如下: + + ``` + let zoomRatioRange = captureSession.getZoomRatioRange(); + ``` + +36. CaptureSession 中接口 getZoomRatio 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getZoomRatio(callback: AsyncCallback): void; 以及 getZoomRatio(): Promise; 变更为 getZoomRatio(): number; + + 参考代码如下: + + ``` + let zoomRatio = captureSession.getZoomRatio(); + ``` + +37. CaptureSession 中接口 setZoomRatio 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setZoomRatio(zoomRatio: number, callback: AsyncCallback): void; 以及 setZoomRatio(zoomRatio: number): Promise; 变更为 setZoomRatio(zoomRatio: number): void; + + 参考代码如下: + + ``` + let zoomRatio = zoomRatioRange[0]; + captureSession.setZoomRatio(zoomRatio); + ``` + +38. CaptureSession 中接口 isVideoStabilizationModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback): void; 以及 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise; 变更为 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean; + + 参考代码如下: + + ``` + let isSupported = captureSession.isVideoStabilizationModeSupported(camera.VideoStabilizationMode.OFF); + ``` + +39. CaptureSession 中接口 getActiveVideoStabilizationMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getActiveVideoStabilizationMode(callback: AsyncCallback): void; 以及 getActiveVideoStabilizationMode(): Promise; 变更为 getActiveVideoStabilizationMode(): VideoStabilizationMode; + + 参考代码如下: + + ``` + let vsMode = captureSession.getActiveVideoStabilizationMode(); + ``` + +40. CaptureSession 中接口 setVideoStabilizationMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback): void; 以及 setVideoStabilizationMode(mode: VideoStabilizationMode): Promise; 变更为 setVideoStabilizationMode(mode: VideoStabilizationMode): void; + + 参考代码如下: + + ``` + captureSession.setVideoStabilizationMode(camera.VideoStabilizationMode.OFF); + ``` + +41. CaptureSession 中,on(type: 'error') callback 类型由 ErrorCallback 变更为 ErrorCallback,因此旧接口 on(type: 'error', callback: ErrorCallback): void; 变更为 on(type: 'error', callback: ErrorCallback): void; + + 参考代码如下: + + ``` + captureSession.on('error', (BusinessError) => { + + }) + ``` + +42. PreviewOutput 中,on(type: 'error') callback 类型由 ErrorCallback 变更为 ErrorCallback,因此旧接口 on(type: 'error', callback: ErrorCallback): void; 变更为 on(type: 'error', callback: ErrorCallback): void; + + 参考代码如下: + + ``` + previewOutput.on('error', (BusinessError) => { + + }) + ``` + +43. PhotoOutput 中接口 isMirrorSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isMirrorSupported(callback: AsyncCallback): void; 以及 isMirrorSupported(): Promise; 变更为 isMirrorSupported(): boolean; + + 参考代码如下: + + ``` + let isSupported = photoOutput.isMirrorSupported(); + ``` + +44. PhotoOutput 中,on(type: 'error') callback 类型由 ErrorCallback 变更为 ErrorCallback,因此旧接口 on(type: 'error', callback: ErrorCallback): void; 变更为 on(type: 'error', callback: ErrorCallback): void; + + 参考代码如下: + + ``` + PhotoOutput.on('error', (BusinessError) => { + + }) + ``` + +45. VideoOutput 中,on(type: 'error') callback 类型由 ErrorCallback 变更为 ErrorCallback,因此旧接口 on(type: 'error', callback: ErrorCallback): void; 变更为 on(type: 'error', callback: ErrorCallback): void; + + 参考代码如下: + + ``` + VideoOutput.on('error', (BusinessError) => { + + }) + ``` + +46. MetadataOutput 中,on(type: 'error') callback 类型由 ErrorCallback 变更为 ErrorCallback,因此旧接口 on(type: 'error', callback: ErrorCallback): void; 变更为 on(type: 'error', callback: ErrorCallback): void; + + 参考代码如下: + + ``` + MetadataOutput.on('error', (BusinessError) => { + + }) + ``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-container.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-container.md new file mode 100644 index 0000000000000000000000000000000000000000..8ba5a4809bb3b6fee51165a615a1bded4be9421e --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-container.md @@ -0,0 +1,21 @@ +# 公共基础类库子系统JS API变更Changelog + +## cl.公共基础类库子系统.1 错误码及信息变更 +公共基础类库子系统子系统中ArrayList、List、LinkedList、Stack、Queue、Deque、PlainArray、LightWeightMap、LightWeightSet、HashMap、HashSet、TreeMap、TreeSet类的接口抛出的错误码及信息变更: + +变更后的错误码详细介绍请参见[语言基础类库错误码](../../../application-dev/reference/errorcodes/errorcode-utils.md)。 + +已使用相关接口开发的应用无需重新适配。 + +**关键的接口/组件变更** +各个类中的接口重新定义了错误码抛出的信息,并在对应模块的`*.d.ts`声明文件中通过'@throws'标签进行标示。 +示例如下: +ArrayList类变更前: +constructor(); +ArrayList类变更后: +@throws { BusinessError } 10200012 - The ArrayList's constructor cannot be directly invoked. +constructor(); + +**变更影响** + +暂无影响。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-distributeddatamgr.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-distributeddatamgr.md new file mode 100644 index 0000000000000000000000000000000000000000..1bf0d3ff6bd3161271a8a79a0302f981aa670947 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-distributeddatamgr.md @@ -0,0 +1,158 @@ +# 分布式数据管理子系统JS API变更Changelog + +## cl.distributeddatamgr.1 接口变更 +distributeddatamgr子系统kv_store组件接口存在变更: + +由于执行时间固定且耗时短,不需要异步等待执行结果,createKVManager方法需要改为同步接口。因此旧的接口function createKVManager(config: KVManagerConfig): Promise\; 与 function createKVManager(config: KVManagerConfig, callback: AsyncCallback): void; 改为 function createKVManager(config: KVManagerConfig): KVManager; + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.distributedKVStore | distributedKVStore | function createKVManager(config: KVManagerConfig): Promise\; | 删除 | +| @ohos.distributedKVStore | distributedKVStore | function createKVManager(config: KVManagerConfig): KVManager; | 变更 | + + +**适配指导** + +应用中调用createKVManager创建KVManager对象实例可参考下列代码 + +Stage模型下的示例: + +```ts +import AbilityStage from '@ohos.application.Ability' +let kvManager; +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("MyAbilityStage onCreate") + let context = this.context + const kvManagerConfig = { + context: context, + bundleName: 'com.example.datamanagertest', + } + try { + kvManager = distributedKVStore.createKVManager(kvManagerConfig); + } catch (e) { + console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`); + } + } +} +``` + +FA模型下的示例: + +```ts +import featureAbility from '@ohos.ability.featureAbility' +let kvManager; +let context = featureAbility.getContext() +const kvManagerConfig = { + context: context, + bundleName: 'com.example.datamanagertest', +} +try { + kvManager = distributedKVStore.createKVManager(kvManagerConfig); +} catch (e) { + console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`); +} +``` + +## cl.distributeddatamgr.2 function getRdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +如下接口: +```ts +function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number, callback: AsyncCallback): void; +function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number): Promise; +``` +从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts: +``` +function getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback): void; +function getRdbStore(context: Context, config: StoreConfig): Promise; +``` + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * 按上述接口变更对齐修改所调用的方法名称即可。 + +## cl.distributeddatamgr.3 function deleteRdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +如下接口: +```ts +function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback): void; +function deleteRdbStoreV9(context: Context, name: string): Promise; +``` +从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts: +``` +function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback): void; +function deleteRdbStoreV9(context: Context, name: string): Promise; +``` + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * 按上述接口变更对齐修改所调用的方法名称即可。 + +## cl.distributeddatamgr.4 interface StoreConfigV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface StoreConfigV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface StoreConfig。 + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * 按上述接口变更对齐修改所调用的接口名称即可。 + +## cl.distributeddatamgr.5 enum SecurityLevel 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +enum SecurityLevel 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts。 + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * 按上述接口变更对齐修改所调用的接口名称即可。 + +## cl.distributeddatamgr.6 interface RdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface RdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface RdbStore。 + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * 按上述接口变更对齐修改所调用的接口名称即可。 + +## cl.distributeddatamgr.7 class RdbPredicatesV9 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +class RdbPredicatesV9 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface RdbPredicates。 + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * 按上述接口变更对齐修改所调用的接口名称即可。 + +## cl.distributeddatamgr.8 interface ResultSetV9 从api/@ohos.data.relationalStore.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface ResultSetV9 从api/data/rdb/resultSet.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface ResultSet。 + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * ResultSetV9实例仅通过getRdbStoreV9方法获取,参考cl.distributeddatamgr.2变更后,代码可自动适配ResultSet。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-filemanagement.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-filemanagement.md new file mode 100644 index 0000000000000000000000000000000000000000..d43b4523b78ba1d648e14ddde092b0f2a5557d98 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-filemanagement.md @@ -0,0 +1,145 @@ +# 文件管理子系统ChangeLog + +## cl.filemanagement.1 environment模块变更 + +文件管理子系统d.ts归档整改,现统一整改到file一层目录下。environment模块支持错误码处理。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现environment模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md) + +**关键接口/组件变更** + +原environment使用的是@ohos.environment,以以下方式import: + +```js +import environment from '@ohos.environment'; +``` + +现environment使用的是@ohos.file.environment,以以下方式import: + +```js +import environment from '@ohos.file.environment'; +``` + +## cl.filemanagement.2 securityLabel模块变更 + +文件管理子系统d.ts归档整改,现统一整改到file一层目录下。securityLabel模块支持错误码处理。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现securityLabel模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md) + +**关键接口/组件变更** + +原securityLabel使用的是@ohos.securityLabel,以以下方式import: + +```js +import securityLabel from '@ohos.securityLabel'; +``` + +现securityLabel使用的是@ohos.file.securityLabel,以以下方式import: + +```js +import securityLabel from '@ohos.file.securityLabel'; +``` + +## cl.filemanagement.3 fs模块变更 + +fs模块下Stat接口ino属性类型变更。 + +**变更影响** + +fs模块下Stat接口ino属性类型变更,由number变更为bigint,以适配文件系统下所有类型文件的inode范围。 + +**关键接口/组件变更** + +原Stat接口ino属性类型为number,现变更为bigint。 + +## cl.filemanagement.4 fileAccess模块变更 + +文件管理子系统d.ts归档整改,现统一整改到file一层目录下。fileAccess模块支持错误码处理。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现fileAccess模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md) + +**关键接口/组件变更** + +原fileAccess使用的是@ohos.data.fileAccess,以以下方式import: + +```js +import fileAccess from '@ohos.data.fileAccess'; +``` + +现fileAccess使用的是@ohos.file.fileAccess,以以下方式import: + +```js +import fileAccess from '@ohos.file.fileAccess'; +``` + +## cl.filemanagement.5 fileExtensionInfo模块变更 + +文件管理子系统d.ts归档整改,现统一整改到file一层目录下。fileExtensionInfo模块支持错误码处理。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现fileExtensionInfo模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md) + +**关键接口/组件变更** + +原fileExtensionInfo使用的是@ohos.fileExtensionInfo,以以下方式import: + +```js +import fileExtensionInfo from '@ohos.fileExtensionInfo'; +``` + +现fileExtensionInfo使用的是@ohos.file.fileExtensionInfo,以以下方式import: + +```js +import fileExtensionInfo from '@ohos.file.fileExtensionInfo'; +``` + +## cl.filemanagement.6 storageStatistics模块变更 + +文件管理子系统d.ts归档整改,现统一整改到file一层目录下。fileExtensionInfo模块支持错误码处理。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现storageStatistics模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md) + +**关键接口/组件变更** + +原storageStatistics使用的是@ohos.storageStatistics,以以下方式import: + +```js +import storageStatistics from '@ohos.storageStatistics'; +``` + +现storageStatistics使用的是@ohos.file.storageStatistics,以以下方式import: + +```js +import storageStatistics from '@ohos.file.storageStatistics'; +``` + +## cl.filemanagement.7 volumeManager模块变更 + +文件管理子系统d.ts归档整改,现统一整改到file一层目录下。fileExtensionInfo模块支持错误码处理。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现volumeManager模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md) + +**关键接口/组件变更** + +原volumeManager使用的是@ohos.volumeManager,以以下方式import: + +```js +import volumeManager from '@ohos.volumeManager'; +``` + +现volumeManager使用的是@ohos.file.volumeManager,以以下方式import: + +```js +import volumeManager from '@ohos.file.volumeManager'; +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-inputmethod-framworks.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-inputmethod-framworks.md new file mode 100644 index 0000000000000000000000000000000000000000..ba3fbf1df4e369ec72a031df204a0cb6cbb7ff47 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-inputmethod-framworks.md @@ -0,0 +1,30 @@ +# 输入法框架changeLog + +## cl.inputmethod_frameworks.1 API文件名变更 + +下列模块不符合OpenHarmony接口文件名命名规范。在API9进行变更。 + + **变更影响** + + 修改后的SDK与先前已发布版本不兼容,影响在此前版本已开发的应用,应用需要进行适配改动才可以在新版本SDK环境正常编译通过。 + + **关键的接口/组件变更** + +| 模块 | 变更前文件名 | 变更后文件名 | +|------|--------------|--------------| +| 输入法框架模块 | @ohos.inputmethod.d.ts |@ohos.inputMethod.d.ts | +| 输入法服务模块 |@ohos.inputmethodengine.d.ts | @ohos.inputMethodEngine.d.ts | +| 输入法ExtentionAbility模块 | @ohos.inputmethodextensionability.d.ts | @ohos.InputMethodExtensionAbility.d.ts | +| 输入法ExtentionContext模块 |@ohos.inputmethodextensioncontext.d.ts | @ohos.InputMethodExtensionContext.d.ts | +| 输入法子类型模块 | @ohos.inputMethodSubtype.d.ts | @ohos.InputMethodSubtype.d.ts | + + **适配指导** + + 应用中对输入法框架d.ts文件的import后的文件名要写为变更后文件名,即小驼峰/大驼峰命名格式。 + 如: + +```js +import inputMethodEngine from '@ohos.inputMethodEngine'; +``` + + \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-mediaLibrary.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-mediaLibrary.md new file mode 100644 index 0000000000000000000000000000000000000000..8b4a3fb8bec467cf18acf76cfbdd8deadb1d9d10 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-mediaLibrary.md @@ -0,0 +1,116 @@ +# 文件子系统ChangeLog + +## cl.file.1 mediaLibrary相关接口变更 + +multimedia 部件 medialibrary 接口废弃原有相关接口,使用 FilePicker 替代。 + +**变更影响** + +基于此前版本开发的应用,需注意废弃接口的迭代更新。替代的 FilePicker 应用是OpenHarmony中预置的系统应用,为用户提供文件选择及保存功能。 + +**关键接口/组件变更** + +medialibrary 相关接口废弃,原接口位于 @ohos.multimedia.medialibrary;替代应用为 FilePicker,位于[@ohos.file.picker](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.file.picker.d.ts) + +| 模块名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------------------------------------------------ | -------- | +| medialibrary | **function** getMediaLibrary(): MediaLibrary; | 废弃 | +| medialibrary | **function** getMediaLibrary(context: Context): MediaLibrary; | 废弃 | +| medialibrary | **function** getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** getFileAssets(options: MediaFetchOptions): Promise\ | 废弃 | +| medialibrary | **function** on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\): void | 废弃 | +| medialibrary | **function** off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\): void | 废弃 | +| medialibrary | **function** createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise\ | 废弃 | +| medialibrary | **function** deleteAsset(uri: string): Promise\ | 废弃 | +| medialibrary | **function** deleteAsset(uri: string, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** getPublicDirectory(type: DirectoryType, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** getPublicDirectory(type: DirectoryType): Promise\ | 废弃 | +| medialibrary | **function** getAlbums(options: MediaFetchOptions, callback: AsyncCallback\\>): void | 废弃 | +| medialibrary | **function** getAlbums(options: MediaFetchOptions): Promise\\> | 废弃 | +| medialibrary | **function** release(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** release(): Promise\ | 废弃 | +| medialibrary | **function** storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** storeMediaAsset(option: MediaAssetOption): Promise\ | 废弃 | +| medialibrary | **function** startImagePreview(images: Array\, index: number, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** startImagePreview(images: Array\, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** startImagePreview(images: Array\, index?: number): Promise\ | 废弃 | +| medialibrary | **function** startMediaSelect(option: MediaSelectOption, callback: AsyncCallback\\>): void | 废弃 | +| medialibrary | **function** startMediaSelect(option: MediaSelectOption): Promise\\> | 废弃 | +| medialibrary | **function** getActivePeers(): Promise\\>; | 废弃 | +| medialibrary | **function** getActivePeers(callback: AsyncCallback\\>): void; | 废弃 | +| medialibrary | **function** getAllPeers(): Promise\\>; | 废弃 | +| medialibrary | **function** FileAsset.isDirectory(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.isDirectory():Promise\ | 废弃 | +| medialibrary | **function** FileAsset.commitModify(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.commitModify(): Promise\ | 废弃 | +| medialibrary | **function** FileAsset.open(mode: string, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.open(mode: string): Promise\ | 废弃 | +| medialibrary | **function** FileAsset.close(fd: number, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.close(fd: number): Promise\ | 废弃 | +| medialibrary | **function** FileAsset.getThumbnail(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.getThumbnail(size: Size, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.getThumbnail(size?: Size): Promise\ | 废弃 | +| medialibrary | **function** FileAsset.favorite(isFavorite: boolean, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.favorite(isFavorite: boolean): Promise\ | 废弃 | +| medialibrary | **function** FileAsset.isFavorite(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.isFavorite():Promise\ | 废弃 | +| medialibrary | **function** FileAsset.trash(isTrash: boolean, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.trash(isTrash: boolean): Promise\ | 废弃 | +| medialibrary | **function** FileAsset.isTrash(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.isTrash():Promise\ | 废弃 | +| medialibrary | **function** FetchFileResult.getCount(): number | 废弃 | +| medialibrary | **function** FetchFileResult.isAfterLast(): boolean | 废弃 | +| medialibrary | **function** FetchFileResult.close(): void | 废弃 | +| medialibrary | **function** FetchFileResult.getFirstObject(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FetchFileResult.getFirstObject(): Promise\ | 废弃 | +| medialibrary | **function** FetchFileResult.getNextObject(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FetchFileResult.getNextObject(): Promise\ | 废弃 | +| medialibrary | **function** FetchFileResult.getLastObject(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FetchFileResult.getLastObject(): Promise\ | 废弃 | +| medialibrary | **function** FetchFileResult.getPositionObject(index: number, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FetchFileResult.getPositionObject(index: number): Promise\ | 废弃 | +| medialibrary | **function** FetchFileResult.getAllObject(callback: AsyncCallback\\>): void | 废弃 | +| medialibrary | **function** FetchFileResult.getAllObject(): Promise\\> | 废弃 | +| medialibrary | **function** Album.commitModify(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** Album.commitModify(): Promise\ | 废弃 | +| medialibrary | **function** Album.getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** Album.getFileAssets(options?: MediaFetchOptions): Promise\ | 废弃 | +| medialibrary | **enum** DeviceType | 废弃 | +| medialibrary | **enum** FileKey | 废弃 | +| medialibrary | **enum** DirectoryType | 废弃 | +| medialibrary | **enum** MediaType | 废弃 | +| medialibrary | **interface** PeerInfo | 废弃 | +| medialibrary | **interface** Size | 废弃 | +| medialibrary | **interface** MediaFetchOptions | 废弃 | +| medialibrary | **interface** MediaAssetOption | 废弃 | +| medialibrary | **interface** MediaSelectOption | 废弃 | +| medialibrary | **interface** FileAsset | 废弃 | + +**适配指导** + +以选取一张图片为例,在替代应用中如下方式进行调用: + +```js +import picker from '@ohos.file.picker'; + +async function example() { + try { + let PhotoSelectOptions = new picker.PhotoSelectOptions(); + PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; + PhotoSelectOptions.maxSelectNumber = 1; + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => { + if (PhotoSelectResult !== undefined) { + console.info("PhotoViewPicker.select pass, PhotoSelectResult uri: " + JSON.stringify(PhotoSelectResult)); + } else { + console.error("PhotoViewPicker.select PhotoSelectResult is undefined"); + } + }).catch((err) => { + console.error("PhotoViewPicker.select fail, err: " + err); + }); + } catch (err) { + console.error("PhotoViewPicker fail, err: " + err); + } +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-multimedia.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-multimedia.md new file mode 100644 index 0000000000000000000000000000000000000000..45249cf9851984f3119e534f732d694eacf1e31f --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-multimedia.md @@ -0,0 +1,53 @@ +## cl.multimedia.av_session.001 av_session所有接口更换为系统接口 + +所有av_session的接口变更为SystemApi。 + +**变更影响** + +非系统应用无法调用系统接口,如调用方为非系统应用或未申请SystemApi相关权限,将无法调用接口。 + +**关键的接口/组件变更** + +所有接口均变更为SystemApi,接口明细如下: + +| 接口、枚举或变量名 | 类型 | 是否为SystemApi | +| -------- | -------- | ------- | +| SessionToken | interface | 是 | +| AVMetadata | interface | 是 | +| AVPlaybackState | interface | 是 | +| PlaybackPosition | interface | 是 | +| OutputDeviceInfo | interface | 是 | +| AVSessionDescriptor | interface | 是 | +| AVSessionController | interface | 是 | +| AVControlCommand | interface | 是 | +| createAVSession | function | 是 | +| getAllSessionDescriptors | function | 是 | +| createController | function | 是 | +| castAudio | function | 是 | +| on | function | 是 | +| off | function | 是 | +| sendSystemAVKeyEvent | function | 是 | +| sendSystemControlCommand | function | 是 | +| sessionId | variable | 是 | +| setAVMetadata | function | 是 | +| setAVPlaybackState | function | 是 | +| setLaunchAbility | function | 是 | +| getController | function | 是 | +| getOutputDevice | function | 是 | +| activate | function | 是 | +| deactivate | function | 是 | +| destroy | function | 是 | +| getAVPlaybackState | function | 是 | +| getAVMetadata | function | 是 | +| getOutputDevice | function | 是 | +| sendAVKeyEvent | function | 是 | +| getLaunchAbility | function | 是 | +| getRealPlaybackPositionSync | function | 是 | +| isActive | function | 是 | +| getValidCommands | function | 是 | +| sendControlCommand | function | 是 | +| AVSessionType | type | 是 | +| AVControlCommandType | type | 是 | +| LoopMode | enum | 是 | +| PlaybackState | enum | 是 | +| AVSessionErrorCode | enum | 是 | diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-nfc.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-nfc.md similarity index 97% rename from zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-nfc.md rename to zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-nfc.md index 506de8014aa3d4ea26c6a36c63e51eaa133e1499..21caa2f21e1b8f4d93cadb1e1d6dc4947ab5e4a4 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-nfc.md +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-nfc.md @@ -1,7 +1,5 @@ # 公共通信子系统NFC JS API变更Changelog -OpenHarmony 3.2.10.2(Mr)版本相较于OpenHarmony 3.2.beta4版本,分布式数据管理子系统的API变更如下 - ## cl.nfc.1 接口变更 NFC部分API6到API8部分JS接口不支持抛出错误码,需要删除废弃,然后使用新的API9替换。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-notification.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-notification.md new file mode 100644 index 0000000000000000000000000000000000000000..7877ff8ae51a74460187fcd3460070bf12919813 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-notification.md @@ -0,0 +1,48 @@ +# 事件通知子系统ChangeLog + +## cl.notification.1 删除标记为废弃的API9接口 + +[事件通知异常处理整改](../OpenHarmony_3.2.8.3/changelogs-notification.md)将部分API9接口标记为了废弃,根据OpenHarmony接口规范,需要删除标记为废弃的API9接口。 + +**变更影响** + +基于此前版本开发的应用,需要将被删除的接口替换为新接口,否则会影响应用编译。 + +**关键接口/组件变更** + +原接口中标记为废弃的API9接口将被删除,可以使用新接口中的同名接口替换。 + +| 原接口 | 新接口 | +| ----------------------- | -------------------------------- | +| @ohos.commonEvent.d.ts | @ohos.commonEventManager.d.ts | +| @ohos.notification.d.ts | @ohos.notificationManager.d.ts | +| @ohos.notification.d.ts | @ohos.notificationSubscribe.d.ts | + +接口、属性被删除: + +- @ohos.notification.d.ts + - 接口 publishAsBundle、cancelAsBundle、isNotificationSlotEnabled、setSyncNotificationEnabledWithoutApp、getSyncNotificationEnabledWithoutApp 被删除。可以使用 api/@ohos.notificationManager.d.ts 的同名接口替换。 + - 接口 enableNotificationSlot 被删除。可以使用 api/@ohos.notificationManager.d.ts 的接口 setNotificationEnableSlot 替换。 + - 导出类 NotificationActionButton、NotificationBasicContent、NotificationContent、NotificationLongTextContent、NotificationMultiLineContent、NotificationPictureContent、NotificationFlags、NotificationFlagStatus、NotificationRequest、DistributedOptions、NotificationSlot、NotificationSorting、NotificationTemplate、NotificationUserInput 被删除。可以使用 api/@ohos.notificationManager.d.ts 的同名导出类替换。 + - 导出类 NotificationSubscribeInfo、NotificationSubscriber、SubscribeCallbackData、EnabledNotificationCallbackData 被删除。可以使用 api/@ohos.notificationSubscribe.d.ts 的同名导出类替换。 + +**适配指导** + +如上所述,仅将老接口平移到了新的namespace中,所以可以通过修改import来解决适配问题: + +如原先接口使用了@ohos.commonEvent + +```js +import commonEvent from '@ohos.commonEvent'; +``` + +可以通过直接修改import,来切换到新的namespace上: + +```js +import commonEvent from '@ohos.commonEventManager'; +``` + +@ohos.notification拆分成了两个namespace,需要根据接口情况选择需要的新namespace进行适配。 + +此外还需要适配异常处理,具体参考新接口的接口文档。 + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ohos-geoLocationManager.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ohos-geoLocationManager.md new file mode 100644 index 0000000000000000000000000000000000000000..a509d856204ff61c962b99fef71642eafaab930b --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ohos-geoLocationManager.md @@ -0,0 +1,107 @@ +# 位置服务子系统ChangeLog + +## cl.location.1 @ohos.geolocation.d.ts接口迁移到新增的@ohos.geoLocationManager.d.ts + +@ohos.geolocation.d.ts接口不支持抛出错误码,为了支持错误码功能,把@ohos.geolocation.d.ts中所有接口,迁移到新增的@ohos.geoLocationManager.d.ts中,并增加错误码描述。 + +后续需要import @ohos.geoLocationManager才能使用位置服务的接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + + +**变更影响** + +对位置服务所有接口的使用有影响,需要import @ohos.geoLocationManager才能使用位置服务接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + +**关键的接口/组件变更** + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +|geolocation| method | function on(type: 'locationChange', request: LocationRequest, callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'locationChange', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'locationServiceState', callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'locationServiceState'更改为type: 'locationEnabledChange' | +|geolocation| method | function off(type: 'locationServiceState', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'locationServiceState'更改为type: 'locationEnabledChange' | +|geolocation| method | function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'cachedGnssLocationsReporting'更改为type: 'cachedGnssLocationsChange' | +|geolocation| method | function off(type: 'cachedGnssLocationsReporting', callback?: Callback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'cachedGnssLocationsReporting'更改为type: 'cachedGnssLocationsChange' | +|geolocation| method | function on(type: 'gnssStatusChange', callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'gnssStatusChange'更改为type: 'satelliteStatusChange' | +|geolocation| method | function off(type: 'gnssStatusChange', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'gnssStatusChange'更改为type: 'satelliteStatusChange' | +|geolocation| method | function on(type: 'nmeaMessageChange', callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'nmeaMessageChange'更改为type: 'nmeaMessage' | +|geolocation| method | function off(type: 'nmeaMessageChange', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'nmeaMessageChange'更改为type: 'nmeaMessage' | +|geolocation| method | function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'fenceStatusChange'更改为type: 'gnssFenceStatusChange' | +|geolocation| method | function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'fenceStatusChange'更改为type: 'gnssFenceStatusChange' | +|geolocation| method | function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCurrentLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCurrentLocation(request?: CurrentLocationRequest): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getLastLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function getLastLocation(): Location; | +|geolocation| method | function getLastLocation(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function getLastLocation(): Location; | +|geolocation| method | function isLocationEnabled(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function isLocationEnabled(): boolean; | +|geolocation| method | function isLocationEnabled(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function isLocationEnabled(): boolean; | +|geolocation| method | function requestEnableLocation(callback: AsyncCallback): void; | 接口删除 | +|geolocation| method | function requestEnableLocation(): Promise; | 接口删除 | +|geolocation| method | function enableLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableLocation(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function disableLocation(): void; | +|geolocation| method | function disableLocation(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function disableLocation(): void; | +|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise>; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest): Promise>; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isGeoServiceAvailable(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function isGeocoderAvailable(): boolean; | +|geolocation| method | function isGeoServiceAvailable(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function isGeocoderAvailable(): boolean; | +|geolocation| method | function getCachedGnssLocationsSize(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCachedGnssLocationsSize(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function flushCachedGnssLocations(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function flushCachedGnssLocations(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function sendCommand(command: LocationCommand, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function sendCommand(command: LocationCommand): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableLocationMock(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function enableLocationMock(): void; | +|geolocation| method | function enableLocationMock(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function enableLocationMock(): void; | +|geolocation| method | function disableLocationMock(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function disableLocationMock(): void; | +|geolocation| method | function disableLocationMock(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function disableLocationMock(): void; | +|geolocation| method | function setMockedLocations(config: LocationMockConfig, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function setMockedLocations(config: LocationMockConfig): void; | +|geolocation| method | function setMockedLocations(config: LocationMockConfig): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function setMockedLocations(config: LocationMockConfig): void; | +|geolocation| method | function enableReverseGeocodingMock(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function enableReverseGeocodingMock(): void; | +|geolocation| method | function enableReverseGeocodingMock(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function enableReverseGeocodingMock(): void; | +|geolocation| method | function disableReverseGeocodingMock(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function disableReverseGeocodingMock(): void; | +|geolocation| method | function disableReverseGeocodingMock(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function disableReverseGeocodingMock(): void; | +|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function setReverseGeocodingMockInfo(mockInfos: Array): void; | +|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function setReverseGeocodingMockInfo(mockInfos: Array): void; | +|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean; | +|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType,): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean; | +|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): void; | +|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): void; | +|geolocation| interface | SatelliteStatusInfo | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | CachedGnssLocationsRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | GeofenceRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | Geofence | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | ReverseGeoCodeRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | GeoCodeRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | GeoAddress | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | LocationRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | CurrentLocationRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | Location | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | LocationRequestPriority | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | LocationRequestScenario | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | GeoLocationErrorCode | 接口废弃 | +|geolocation| enum | LocationPrivacyType | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | LocationCommand | 接口迁移到@ohos.geoLocationManager.d.ts | + + +**适配指导(可选,不涉及则可以删除)** + +以enableLocation为例,在新版本上需要使用如下方式进行调用: + + ```ts + import geoLocationManager from '@ohos.geoLocationManager'; + try { + geoLocationManager.enableLocation((err, data) => { + if (err) { + console.log('enableLocation: err=' + JSON.stringify(err)); + } + }); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } + ``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ohos-geolocation.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ohos-geolocation.md new file mode 100644 index 0000000000000000000000000000000000000000..5d127ca0d13961d29741afdbd713275a3f6c8033 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ohos-geolocation.md @@ -0,0 +1,92 @@ +# 位置服务子系统ChangeLog + +## cl.location.1 @ohos.geolocation.d.ts接口迁移到新增的@ohos.geoLocationManager.d.ts + +@ohos.geolocation.d.ts接口不支持抛出错误码,为了支持错误码功能,把@ohos.geolocation.d.ts中所有接口,迁移到新增的@ohos.geoLocationManager.d.ts中,并增加错误码描述。 + +后续需要import @ohos.geoLocationManager才能使用位置服务的接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + + +**变更影响** + +对位置服务所有接口的使用有影响,需要import @ohos.geoLocationManager才能使用位置服务接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + +**关键的接口/组件变更** + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +|geolocation| namespace | declare namespace geolocation| 迁移到@ohos.geoLocationManager.d.ts,使用namespace geoLocationManager代替 | +|geolocation| method | function on(type: 'locationChange', request: LocationRequest, callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'locationChange', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'locationServiceState', callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'locationServiceState', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'cachedGnssLocationsReporting', callback?: Callback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'gnssStatusChange', callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'gnssStatusChange', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'nmeaMessageChange', callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'nmeaMessageChange', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCurrentLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCurrentLocation(request?: CurrentLocationRequest): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getLastLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getLastLocation(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isLocationEnabled(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isLocationEnabled(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function requestEnableLocation(callback: AsyncCallback): void; | 接口删除 | +|geolocation| method | function requestEnableLocation(): Promise; | 接口删除 | +|geolocation| method | function enableLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableLocation(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableLocation(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise>; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest): Promise>; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isGeoServiceAvailable(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isGeoServiceAvailable(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCachedGnssLocationsSize(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCachedGnssLocationsSize(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function flushCachedGnssLocations(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function flushCachedGnssLocations(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function sendCommand(command: LocationCommand, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function sendCommand(command: LocationCommand): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | SatelliteStatusInfo | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | CachedGnssLocationsRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | GeofenceRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | Geofence | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | ReverseGeoCodeRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | GeoCodeRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | GeoAddress | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | LocationRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | CurrentLocationRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | Location | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | LocationRequestPriority | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | LocationRequestScenario | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | GeoLocationErrorCode | 接口废弃 | +|geolocation| enum | LocationPrivacyType | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | LocationCommand | 接口迁移到@ohos.geoLocationManager.d.ts | + + +**适配指导(可选,不涉及则可以删除)** + +以enableLocation为例,在新版本上需要使用如下方式进行调用: + + ```ts + import geoLocationManager from '@ohos.geoLocationManager'; + try { + geoLocationManager.enableLocation((err, data) => { + if (err) { + console.log('enableLocation: err=' + JSON.stringify(err)); + } + }); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } + ``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-request.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-request.md new file mode 100644 index 0000000000000000000000000000000000000000..6d7bc0e05cd183ff46328bbbbbe8722287961c70 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-request.md @@ -0,0 +1,42 @@ +# 上传下载子系统ChangeLog + + +## cl.request.2 request上传下载接口变更 + +- 删除API9-beta接口: +1. function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback): void; +2. function download(context: BaseContext, config: DownloadConfig): Promise; +3. function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback): void; +4. function upload(context: BaseContext, config: UploadConfig): Promise; + +**变更影响** + +基于此前版本使用Stage模式开发的应用,需适配变更后的接口,否则会影响原有业务逻辑。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +|--------------|--------------|-------------------------------------------------------------------------------------------------------------------|------| +| ohos.request | request | function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback): void; | 删除 | +| ohos.request | request | function download(context: BaseContext, config: DownloadConfig): Promise; | 删除 | +| ohos.request | request | function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback): void; | 删除 | +| ohos.request | request | function upload(context: BaseContext, config: UploadConfig): Promise; | 删除 | + + +**适配指导** + +以download为例,在新版本上需要使用downloadFile, 如下方式进行调用: + +```ts +try { + request.downloadFile(globalThis.abilityContext, { url: 'https://xxxx/xxxxx.hap', + filePath: 'xxx/xxxxx.hap'}, (err, data) => { + if (err) { + console.error('Failed to request the download. Cause: ' + JSON.stringify(err)); + return; + } + }); +} catch (err) { + console.log("downloadFile callback fail." + "errCode:" + err.code + ",errMessage:" + err.message); +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-resourceschedule.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-resourceschedule.md new file mode 100644 index 0000000000000000000000000000000000000000..a7c431a2365444a6275d3fc3be61f785dcaa4b4f --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-resourceschedule.md @@ -0,0 +1,111 @@ +# 资源调度子系统ChangeLog + +## cl.resourceschedule.backgroundTaskManager +对资源调度子系统backgroundTaskManager仓原有接口进行整改,原有@ohos.backgroundTaskManager.d.ts中的API9接口删除,需要使用@ohos.resourceschedule.backgroundTaskManager.d.ts中的API9新接口。新的API9接口符合错误码规范。 + +**变更影响** + +基于OpenHarmony3.2.10.5及之后的SDK版本开发的应用,需适配API9的模块和接口,以及的API异常处理返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下方法、属性、枚举和常量均从API9变更。@ohos.backgroundTaskManager.d.ts文件中的接口移植到@ohos.resourceschedule.backgroundTaskManager.d.ts文件。 + +| 类名 | 接口类型 | 接口声明 | 说明 | +| -- | -- | -- | -- | +| backgroundTaskManager | method | function resetAllEfficiencyResources(): void; | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function applyEfficiencyResources(request: EfficiencyResourcesRequest): bool; | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts,修改为function applyEfficiencyResources(request: EfficiencyResourcesRequest): void; | +| backgroundTaskManager.ResourceType | enum | export enum ResourceType | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | CPU = 1 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | COMMON_EVENT = 1 << 1 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | TIMER = 1 << 2 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | WORK_SCHEDULER = 1 << 3 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | BLUETOOTH = 1 << 4 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | GPS = 1 << 5 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | AUDIO = 1 << 6 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | interface | export interface EfficiencyResourcesRequest | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | reason: string | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | isProcess?: bool | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | isPersist?: bool | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | timeOut: number | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | isApply: bool | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | resourceTypes: number | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | + + +**适配指导**
+ +导入backgroundTaskManager模块。 +``` +import bundle form '@ohos.resourceschedule.backgroundTaskManager' +``` +此外还需要适配异常处理,具体参考[backgroundTaskManager接口文档](../../../application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md)。 + +## c2.resourceschedule.workScheduler +对资源调度子系统workScheduler仓原有接口进行整改,原有@ohos.workScheduler.d.ts中的API9接口删除,需要使用@ohos.resourceschedule.workScheduler.d.ts中的API9新接口。新的API9接口符合错误码规范。 + +**变更影响** + +基于OpenHarmony3.2.10.5及之后的SDK版本开发的应用,需适配API9的模块和接口,以及的API异常处理返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下方法、属性、枚举和常量均从API9变更。删除@ohos.workScheduler.d.ts文件,相关接口变更至@ohos.resourceschedule.workScheduler.d.ts文件中。 + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +| workScheduler | namespace | declare namespace workScheduler | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | interface | export interface WorkInfo | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | parameters?: {[key: string]: any} | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | idleWaitTime?: number | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isDeepIdle?: boolean | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | repeatCount?: number | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isRepeat?: boolean | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | repeatCycleTime?: number | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | storageRequest?: StorageRequest | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | batteryStatus?: BatteryStatus | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | batteryLevel?: number | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | chargerType?: ChargingType | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isCharging?: boolean | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | networkType?: NetworkType | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isPersisted?: boolean | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | abilityName: string | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | bundleName: string | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | workId: number | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function isLastWorkTimeOut(workId: number): Promise; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function isLastWorkTimeOut(workId: number, callback: AsyncCallback): boolean; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function stopAndClearWorks(): boolean; | 接口API8变更,移植到ohos.resourceschedule.workScheduler.d.ts,修改为function stopAndClearWorks(): boolean; | +| workScheduler | method | function obtainAllWorks(): Promise>; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function obtainAllWorks(callback: AsyncCallback): Array; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function getWorkStatus(workId: number): Promise; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function getWorkStatus(workId: number, callback: AsyncCallback): void; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function stopWork(work: WorkInfo, needCancel?: boolean): boolean; | 接口API8变更,移植到ohos.resourceschedule.workScheduler.d.ts,修改为function stopWork(work: WorkInfo, needCancel?: boolean): void; | +| workScheduler | method | function startWork(work: WorkInfo): boolean; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts,修改为function startWork(work: WorkInfo): void; | +| workScheduler.NetworkType | enum | export enum NetworkType | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_ANY = 0 | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_MOBILE | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_WIFI | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_BLUETOOTH | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_WIFI_P2P | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_ETHERNET | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | export enum ChargingType | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_ANY = 0 | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_AC | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_USB | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_WIRELESS | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | export enum BatteryStatus | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | BATTERY_STATUS_LOW = 0 | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | BATTERY_STATUS_OKAY | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | BATTERY_STATUS_LOW_OR_OKAY | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.StorageRequest | enum | export enum StorageRequest | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_LOW = 0 | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_OKAY | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_LOW_OR_OKAY | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | + + +**适配指导**
+ +导入workScheduler模块。 +``` +import bundle form '@ohos.resourceschedule.workScheduler' +``` +此外还需要适配异常处理,具体参考[workScheduler接口文档](../../../application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md)。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-security.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-security.md new file mode 100644 index 0000000000000000000000000000000000000000..3f3a7acf0bbdee1aa1b640f511c91e3f65d2333e --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-security.md @@ -0,0 +1,475 @@ +# security子系统ChangeLog + +## cl.security.1 Random的setSeed功能变更,由异步接口改为同步接口 + +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +setSeed(seed : DataBlob, callback : AsyncCallback\) : void; +setSeed(seed : DataBlob) : Promise\; +修改后的接口原型: +setSeed(seed : DataBlob) : void; + +**适配指导** +查看API参考中setSeed对应的接口适配指南: +[加解密算法库框架-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md) + + +## cl.security.2 interface DataArray 从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface DataArray从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.3 interface EncodingFormat从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface EncodingFormat从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.4 interface EncodingBlob 从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface EncodingBlob 从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.5 interface CertChainData从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface CertChainData从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.6 interface X509Cert从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface X509Cert从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.7 function createX509Cert从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +function createX509Cert从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.8 interface X509CrlEntry从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface X509CrlEntry从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.9 interface X509Crl从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface X509Crl从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.10 function createX509Crl从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +function createX509Crl从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.11 interface CertChainValidator从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface CertChainValidator从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.12 function createCertChainValidator从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +function createCertChainValidator从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.13 X509Cert 的getPublicKey功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +getPublicKey(callback : AsyncCallback\) : void; +getPublicKey() : Promise\; +修改后的接口原型: +getPublicKey() : cryptoFramework.PubKey; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.14 X509Cert 的checkValidityWithDate功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +checkValidityWithDate(date: string, callback : AsyncCallback\) : void; +checkValidityWithDate(date: string) : Promise\; +修改后的接口原型: +checkValidityWithDate(date: string) : void; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.15 X509CrlEntry 的getCertIssuer功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +getCertIssuer(callback : AsyncCallback\) : void; +getCertIssuer() : Promise\; + +修改后的接口原型: +getCertIssuer() : DataBlob; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.16 X509CrlEntry 的getRevocationDate功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +getRevocationDate(callback : AsyncCallback\) : void; +getRevocationDate() : Promise\; + +修改后的接口原型: +getRevocationDate() : string; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.17 X509Crl 的isRevoked功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +isRevoked(cert : X509Cert, callback : AsyncCallback\) : void; +isRevoked(cert : X509Cert) : Promise\; + +修改后的接口原型: +isRevoked(cert : X509Cert) : boolean; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.18 X509Crl 的getRevokedCert功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +getRevokedCert(serialNumber : number, callback : AsyncCallback\) : void; +getRevokedCert(serialNumber : number) : Promise\; + +修改后的接口原型: +getRevokedCert(serialNumber : number) : X509CrlEntry; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.19 X509Crl 的getRevokedCertWithCert功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +getRevokedCertWithCert(cert : X509Cert, callback : AsyncCallback\) : void; +getRevokedCertWithCert(cert : X509Cert) : Promise\; + +修改后的接口原型: +getRevokedCertWithCert(cert : X509Cert) : X509CrlEntry; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.20 X509Crl 的getTbsInfo功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +getTbsInfo(callback : AsyncCallback\) : void; +getTbsInfo() : Promise\; + +修改后的接口原型: +getTbsInfo() : DataBlob; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + +## cl.security.21 HUKS支持No-Hash的签名模式 + +变更之前,应用传递huks.HuksTag.HUKS_TAG_DIGEST = huks.HuksKeyDigest.HUKS_DIGEST_NONE,HUKS默认使用huks.HuksKeyDigest.HUKS_DIGEST_SHA256进行处理;变更之后,应用传递huks.HuksTag.HUKS_TAG_DIGEST = huks.HuksKeyDigest.HUKS_DIGEST_NONE时,HUKS默认不进行摘要处理,需要业务先对原始数据进行hash操作,再将hash后的摘要传入huks进行签名/验签处理。 + +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以使得变更前后的签名/验签结果通过。 + +**关键的接口/组件变更** + +发布的JS接口不变, 传入接口的参数集合发生变更。 + +业务使用No-Hash的签名模式,需要先对原始数据进行hash处理,再将hash后的摘要传入huks签名/验签接口。同时huks.HuksTag.HUKS_TAG_DIGEST参数设置为huks.HuksKeyDigest.HUKS_DIGEST_NONE。 + +**适配指导** + +以签名为例,示例代码如下: + +```js +import huks from '@ohos.security.huks'; + +let keyAlias = 'rsa_Key'; +/* sha256之后的摘要值 */ +let inDataAfterSha256 = new Uint8Array( + 0x4B, 0x1E, 0x22, 0x64, 0xA9, 0x89, 0x60, 0x1D, 0xEC, 0x78, 0xC0, 0x5D, 0xBE, 0x46, 0xAD, 0xCF, + 0x1C, 0x35, 0x16, 0x11, 0x34, 0x01, 0x4E, 0x9B, 0x7C, 0x00, 0x66, 0x0E, 0xCA, 0x09, 0xC0, 0xF3, +); +/* 签名参数 */ +let signProperties = new Array(); +signProperties[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_RSA, +} +signProperties[1] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN +} +signProperties[2] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048, +} +signProperties[3] = { + tag: huks.HuksTag.HUKS_TAG_DIGEST, + value: huks.HuksKeyDigest.HUKS_DIGEST_NONE, // 设置 digest-none +} +let signOptions = { + properties: signProperties, + inData: inDataAfterSha256 // 设置HASH后的值 +} + +huks.initSession(keyAlias, signOptions); +``` + +更多接口的示例代码可参考[HUKS-guidelines](../../../application-dev/security/huks-guidelines.md)和[HUKS API](../../../application-dev/reference/apis/js-apis-huks.md)。 + +## cl.security.22 HUKS支持在密钥使用时指定密钥运算参数 + +变更之前,业务在生成密钥的时候,必须指定密钥运算的全部参数;变更之后,在生成密钥时,只需要包含必选参数即可,在密钥使用阶段再传入其他参数。业务使用会更加灵活。 + +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 + +允许应用在生成密钥阶段传入的参数中包含必选参数即可,在密钥使用阶段再传入其他可选参数。 + +**关键的接口/组件变更** + +发布的JS接口不变, 传入接口的参数集合发生变更,将参数分为必选参数和可选参数,具体可参考[HUKS-guidelines](../../../application-dev/security/huks-guidelines.md),涉及的接口有: + +huks.generateKeyItem + +huks.importKeyItem + +huks.importWrappedKeyItem + +huks.initSession + +huks.updateSession + +huks.finishSession + +**适配指导** + +以生成密钥为例,示例代码如下: + +```js +let keyAlias = 'keyAlias'; +let properties = new Array(); +//必选参数 +properties[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_RSA +}; +//必选参数 +properties[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048 +}; +//必选参数 +properties[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY +}; +//可选参数,如果在生成密钥阶段没有传入,则在使用密钥阶段必须传入。 +properties[3] = { + tag: huks.HuksTag.HUKS_TAG_DIGEST, + value: huks.HuksKeyDigest.HUKS_DIGEST_SHA256 +}; +let options = { + properties: properties +}; +try { + huks.generateKeyItem(keyAlias, options, function (error, data) { + if (error) { + console.error(`callback: generateKeyItem failed, code: ${error.code}, msg: ${error.message}`); + } else { + console.info(`callback: generateKeyItem key success`); + } + }); +} catch (error) { + console.error(`callback: generateKeyItem input arg invalid, code: ${error.code}, msg: ${error.message}`); +} +``` + +更多接口的示例代码可参考[HUKS-guidelines](../../../application-dev/security/huks-guidelines.md)和[HUKS API](../../../application-dev/reference/apis/js-apis-huks.md)。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-system-geolocation.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-system-geolocation.md new file mode 100644 index 0000000000000000000000000000000000000000..4494940d23cfa519f2c7b0e3ac7f3c1a3b1cfa8c --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-system-geolocation.md @@ -0,0 +1,50 @@ +# 位置服务子系统ChangeLog + +## cl.location.1 @system.geolocation.d.ts接口迁移到新增的@ohos.geoLocationManager.d.ts + +@system.geolocation.d.ts接口不支持抛出错误码,为了支持错误码功能,把@system.geolocation.d.ts中所有接口,迁移到新增的@ohos.geoLocationManager.d.ts中,并增加错误码描述。 + +后续需要import @ohos.geoLocationManager才能使用位置服务的接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + + +**变更影响** + +对位置服务所有接口的使用有影响,需要import @ohos.geoLocationManager才能使用位置服务接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + +**关键的接口/组件变更** + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +|Geolocation| class | Geolocation | 接口迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager代替 | +|Geolocation| interface | static getLocation(options?: GetLocationOption): void; | 接口迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager.getCurrentLocation代替 | +|Geolocation| interface | static getLocationType(options?: GetLocationTypeOption): void; | 接口废弃 | +|Geolocation| interface | static subscribe(options: SubscribeLocationOption): void; | 接口迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager.on#event:locationChange代替 | +|Geolocation| interface | static unsubscribe(): void; | 接口迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager.off#event:locationChange代替 | +|Geolocation| interface | static getSupportedCoordTypes(): Array; | 接口废弃 | +|| interface | GeolocationResponse| 迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager.Location代替 | +|| interface | GetLocationOption | 接口迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest代替 | +|| interface | GetLocationTypeResponse | 接口废弃 | +|| interface | GetLocationTypeOption | 接口废弃 | +|| interface | SubscribeLocationOption | 接口迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager.LocationRequest代替 | + + +**适配指导(可选,不涉及则可以删除)** + +以enableLocation为例,在新版本上需要使用如下方式进行调用: + + ```ts + import geoLocationManager from '@ohos.geoLocationManager'; + try { + geoLocationManager.enableLocation((err, data) => { + if (err) { + console.log('enableLocation: err=' + JSON.stringify(err)); + } + }); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } + ``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-telephony.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-telephony.md new file mode 100644 index 0000000000000000000000000000000000000000..9096ff88cbc71e971fa3bd2d631684a161c175e2 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-telephony.md @@ -0,0 +1,59 @@ +# 电话子系统ChangeLog + + + +## cl.telephony.1 radio模块接口变更 + + +### 电话子系统radio模块 `isNrSupported` 接口存在变更: + +NR是专有名词,需要全部大写。 + +开发者需要根据以下说明对应用进行适配。 + + + +**变更影响** + +基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。 + + + +**关键的接口/组件变更** + +- 涉及接口 + + isNrSupported(): boolean; + isNrSupported(slotId: number): boolean; + +- 变更前: + +```js +function isNrSupported(): boolean; +function isNrSupported(slotId: number): boolean; +``` + +- 变更后: + +```js +function isNRSupported(): boolean; +function isNRSupported(slotId: number): boolean; +``` + + + +**适配指导** + +使用变更后的接口,示例代码如下: + +```js +let result = radio.isNrSupported(); +console.log("Result: "+ result); +``` + + +```js +let slotId = 0; +let result = radio.isNRSupported(slotId); +console.log("Result: "+ result); +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-time.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-time.md new file mode 100644 index 0000000000000000000000000000000000000000..1f6aa755b94e4acbcec7900011f563478e1793fc --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-time.md @@ -0,0 +1,336 @@ +# 时间时区子系统ChangeLog + +## cl.time.1 接口异常抛出变更 + +时间时区子系统定时器接口异常抛出:202非系统应用异常和401参数无效异常。 + +**变更影响** + +该接口变更前向兼容,基于此前版本开发的应用可继续使用接口,增加相应的异常处理,原有功能不受影响。 + +**关键接口/组件变更** + +变更前: + - 接口异常抛出message,无错误码。 + +变更后: + - 接口异常抛出message和code,包括202非系统应用异常和401参数无效异常。 + + | 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | + | ----------------- | ----------- | ------------------------------------------------------------ | -------- | + | @ohos.systemTimer | systemTimer | function createTimer(options: TimerOptions, callback: AsyncCallback): void | 变更 | + | @ohos.systemTimer | systemTimer | function createTimer(options: TimerOptions): Promise | 变更 | + | @ohos.systemTimer | systemTimer | function startTimer(timer: number, triggerTime: number, callback: AsyncCallback): void | 变更 | + | @ohos.systemTimer | systemTimer | function startTimer(timer: number, triggerTime: number): Promise | 变更 | + | @ohos.systemTimer | systemTimer | function stopTimer(timer: number, callback: AsyncCallback): void | 变更 | + | @ohos.systemTimer | systemTimer | function stopTimer(timer: number): Promise | 变更 | + | @ohos.systemTimer | systemTimer | function destroyTimer(timer: number, callback: AsyncCallback): void | 变更 | + | @ohos.systemTimer | systemTimer | function destroyTimer(timer: number): Promise | 变更 | + + +**适配指导** + +应用中调用systemTimer所有接口可参考下列代码进行异常捕获 + +createTimer callback形式调用: + +**示例:** + +```js +export default { + systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat: false + }; + try { + systemTimer.createTimer(options, (error, timerId) => { + if (error) { + //捕获权限否定异常 + console.info(`Failed to create timer. message: ${error.message}, code: ${error.code}`); + } + console.info(`Succeeded in creating timer. timerId: ${timerId}`); + }); + } catch(e) { + //捕获参数校验失败异常 + console.info(`Failed to create timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +createTimer promise形式调用: + +**示例:** + +```js +export default { + systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat: false + }; + try { + systemTimer.createTimer(options).then((timerId) => { + console.info(`Succeeded in creating timer. timerId: ${timerId}`); + }).catch((error) => { + //捕获权限否定异常 + console.info(`Failed to create timer. message: ${error.message}, code: ${error.code}`); + }); + } catch(e) { + //捕获参数校验失败异常 + console.info(`Failed to create timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +startTimer callback形式调用: + +**示例:** + +```js +export default { + async systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + try { + systemTimer.startTimer(timerId, triggerTime, (error) => { + if (error) { + //捕获权限否定异常 + console.error(`Failed to start timer. message: ${error.message}, code: ${error.code}`); + } + }); + } catch (e) { + //捕获参数校验失败异常 + console.info(`Failed to start timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +startTimer promise形式调用: + +**示例:** + +```js +export default { + async systemTimer (){ + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + try { + systemTimer.startTimer(timerId, triggerTime).then((data) => { + console.log(`Succeeded in startting timer. Data:` + data); + }).catch((error) => { + //捕获权限否定异常 + console.info(`Failed to start timer. message: ${error.message}, code: ${error.code}`); + }); + } catch (e) { + //捕获参数校验失败异常 + console.info(`Failed to start timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +stopTimer callback形式调用: + +**示例:** + +```js +export default { + async systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + try { + systemTimer.stopTimer(timerId, triggerTime, (error) => { + if (error) { + //捕获权限否定异常 + console.error(`Failed to stop timer. message: ${error.message}, code: ${error.code}`); + } + }); + } catch (e) { + //捕获参数校验失败异常 + console.info(`Failed to stop timer. message: ${e.message}, code: ${e.code}`); + } + } +}git +``` + +stopTimer promise形式调用: + +**示例:** + +```js +export default { + async systemTimer (){ + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + try { + systemTimer.stopTimer(timerId, triggerTime).then((data) => { + console.log(`Succeeded in stop timer. Data:` + data); + }).catch((error) => { + //捕获权限否定异常 + console.info(`Failed to stop timer. message: ${error.message}, code: ${error.code}`); + }); + } catch (e) { + //捕获参数校验失败异常 + console.info(`Failed to stop timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +destroyTimer callback形式调用: + +**示例:** + +```js +export default { + async systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + systemTimer.stopTimer(timerId); + try { + systemTimer.destroyTimer(timerId, triggerTime, (error) => { + if (error) { + //捕获权限否定异常 + console.error(`Failed to destroy timer. message: ${error.message}, code: ${error.code}`); + } + }); + } catch (e) { + //捕获参数校验失败异常 + console.info(`Failed to destroy timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +destroyTimer promise形式调用: + +**示例:** + +```js +export default { + async systemTimer (){ + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + systemTimer.stopTimer(timerId); + try { + systemTimer.destroyTimer(timerId, triggerTime).then((data) => { + console.log(`Succeeded in destroy timer. Data:` + data); + }).catch((error) => { + //捕获权限否定异常 + console.info(`Failed to destroy timer. message: ${error.message}, code: ${error.code}`); + }); + } catch (e) { + //捕获参数校验失败异常 + console.info(`Failed to destroy timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +## cl.time.2 接口异常抛出变更 + +时间时区子系统时间相关接口异常抛出:201权限否定异常、202非系统应用异常和401参数无效异常。 + +**变更影响** + +基于此前版本开发的应用,继续使用无影响,使用新接口需要捕获并处理抛出的新异常。 + +**关键接口/组件变更** + +变更前: + - 接口异常抛出message,错误码-1。 + +变更后: + - 接口异常抛出message和code,包括201权限否定异常、202非系统应用异常和401参数无效异常。 + +原接口中标记为废弃的接口,可以使用新接口中的同名接口替换 + +| 原接口 | 新接口 | +| ---------------- | -------------------- | +| @ohos.systemTime | @ohos.systemDateTime | + +**适配指导** + +应用中调用systemTime所有接口可参考下列代码进行异常捕获,以setTime接口为例,其他接口适配方法相同。 + +callback形式调用: + +**示例:** + +```js +import systemDateTime from @ohos.systemDateTime +// time对应的时间为2021-01-20 02:36:25 +let time = 1611081385000; +try { + systemDateTime.setTime(time, (error) => { + //捕获权限否定异常和非系统应用异常 + if (error) { + console.info(`Failed to setting time. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in setting time.`); + }) +} catch(e) { + //捕获参数校验失败异常 + console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`); +} +``` + +promise形式调用: + +**示例:** + +```js +import systemDateTime from @ohos.systemDateTime +// time对应的时间为2021-01-20 02:36:25 +let time = 1611081385000; +try { + systemDateTime.setTime(time).then(() => { + console.info(`Succeeded in setting time.`); + }).catch((error) => { + //捕获权限否定异常和非系统应用异常 + console.info(`Failed to setting time. message: ${error.message}, code: ${error.code}`); + }); +} catch(e) { + //捕获参数校验失败异常 + console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`); +} +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-url.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-url.md new file mode 100644 index 0000000000000000000000000000000000000000..34da098e0a10b2e03811bbc534e8599c759bac6f --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-url.md @@ -0,0 +1,68 @@ +# 公共基础类库子系统JS API变更Changelog + +## cl.commonlibrary.1.URLParams类接口变更 +公共基础类库子系统url模块URLParams类构造函数存在变更: + +constructor(init?: string[][] | Record | string | URLSearchParams) 改为 constructor(init?: string[][] | Record | string | URLParams);参数类型为原来的URLSearchParams类改为URLParams类。 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| :------------------------ | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.url | URLParams | constructor(string[][] \| Record<string, string> \| string \| URLSearchParams) | 删除 | +| @ohos.url | URLParams | constructor(string[][] \| Record<string, string> \| string \| URLParams)| 变更 + +**适配指导** + +应用中创建URLParams对象实例可参考下列代码 + +示例: + +```ts +import url from '@ohos.url' +try { + let params1 = new Url.URLParams('?user=abc&query=xyz') + let params2 = new Url.URLParams(params1) + var result= params2.toString() + console.log(result) //"user=abc&query=xyz" +} catch (err) { + console.error(`Fail to ceate URLParams.codeis${err.code},message is ${err.message}`); +} +``` +## cl.commonlibrary.2.URL类属性变更url子系统URLParams类构造函数存在变更: +公共基础类库子系统url模块URL类属性存在变更: + +废弃searchParams: URLSearchParams属性,新增params: URLParams属性 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| :------------------------ | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.url | URL | searchParams: URLSearchParams; |废弃版本:9
| +| @ohos.url | URL | params: URLParams; | 新增 | + +**适配指导** + +应用中创建URLParams对象实例可参考下列代码 + +示例: + +```ts +import url from '@ohos.url' +let that = new Url.URL('http://username:password@host:8080/directory/file?你好=china#qwer=da') +let params = that.URLParams +var result = params.toString() +console.log(result) //%E4%BD%A0%E5%A5%BD=china +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-useriam.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-useriam.md new file mode 100644 index 0000000000000000000000000000000000000000..0444bab5234087b1f865eda378e680c95fc1abb4 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-useriam.md @@ -0,0 +1,17 @@ +# 用户IAM子系统Changelog + +## cl.useriam.1 API9返回值命名变更 + +用户IAM API9的返回值枚举类类名发生变更,从 ResultCodeV9 更名为 UserAuthResultCode + +**变更影响** + +基于此版本以前开发的应用不受影响,以后的需适配错误码的类名,否则会影响业务逻辑。 + +**关键接口/组件变更** + +无接口/组件变更 + +**适配指导** + +需要修改返回值调用类名从 ResultCodeV9 改为 UserAuthResultCode \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-window.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-window.md new file mode 100644 index 0000000000000000000000000000000000000000..697060fe9cf6a50e0958bc566bd495e9220fa1c4 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-window.md @@ -0,0 +1,63 @@ +# 窗口子系统ChangeLog + +## cl.window.1 WindowStage生命周期监听类型名称变更 + +WindowStage生命周期的监听类型枚举定义自3.2.10.5版本起进行了变更。 + +**变更影响** + +3.2.10.5版本之前使用FOREGROUND/BACKGROUND类型开发的应用生命周期监听,在3.2.10.5版本之后失效。 + +**关键接口/组件变更** + +## WindowStageEventType9+ + +变更前: + +| 名称 | 值 | 说明 | +| ---------- | ---- | ---------- | +| FOREGROUND | 1 | 切到前台。 | +| BACKGROUND | 4 | 切到后台。 | + +变更后: +| 名称 | 值 | 说明 | +| ------ | ---- | ---------- | +| SHOWN | 1 | 切到前台。 | +| HIDDEN | 4 | 切到后台。 | + +**适配指导** + +在注册生命周期监听回调时,将前后台事件类型改为SHOWN/HIDDEN: + +``` +import Ability from '@ohos.application.Ability'; + +class myAbility extends Ability { + onWindowStageCreate(windowStage) { + console.log('onWindowStageCreate'); + try { + windowStage.on('windowStageEvent', (stageEventType) => { + switch (stageEventType) { + case window.WindowStageEventType.SHOWN: + console.log("windowStage shown"); + break; + case window.WindowStageEventType.ACTIVE: + console.log("windowStage active"); + break; + case window.WindowStageEventType.INACTIVE: + console.log("windowStage inActive"); + break; + case window.WindowStageEventType.HIDDEN: + console.log("windowStage hidden"); + break; + default: + break; + } + } ) + } catch (exception) { + console.error('Failed to enable the listener for window stage event changes. Cause:' + + JSON.stringify(exception)); + }; + } +}; +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-release/Readme.md b/zh-cn/release-notes/changelogs/v3.2-release/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..90bbd7a5fbf68123d02056315d5de25b313202e7 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/Readme.md @@ -0,0 +1,12 @@ +# Readme + +- [元能力](changelogs-ability.md) +- [ArkUI](changelogs-arkui.md) +- [包管理](changelogs-bundlemanager.md) +- [输入法框架](changelogs-imf.md) +- [全局资源调度](changelogs-resourceschedule.md) +- [主题框架-锁屏](changelogs-screenlock.md) +- [电话服务](changelogs-telephony.md) +- [util](changelogs-util.md) +- [主题框架-壁纸](changelogs-wallpaper.md) +- [web组件](changelogs-web.md) diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-ability.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-ability.md new file mode 100644 index 0000000000000000000000000000000000000000..b5289610acebcfd24695f527efc2ae51f2198da1 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-ability.md @@ -0,0 +1,291 @@ +# 元能力子系统JS API变更Changelog + +## cl.ability.1 AreaMode接口变更 +AreaMode接口有多个重复,删除掉重复的AreaMode。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.app.ability.common.d.ts | common.AreaMode | | 删除 | +| application/Context.d.ts | AreaMode | | 删除 | + + +**适配指导** + +使用@ohos.app.ability.contextConstant.d.ts中的AreaMode + +```ts +import contextConstant from '@ohos.app.ability.contextConstant'; +let area: contextConstant.AreaMode = contextConstant.AreaMode.EL1; +``` + + + +## cl.ability.2 killProcessesBySelf接口变更 + +killProcessesBySelf接口命名不合理,修改为killAllProcesses。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------------ | ------------------ | ----------------------------------------------------- | -------- | +| application/ApplicationContext | ApplicationContext | killProcessesBySelf(): Promise\; | 删除 | +| application/ApplicationContext | ApplicationContext | killProcessesBySelf(callback: AsyncCallback\); | 删除 | +| application/ApplicationContext | ApplicationContext | killAllProcesses(): Promise\; | 新增 | +| application/ApplicationContext | ApplicationContext | killAllProcesses(callback: AsyncCallback\); | 新增 | + + +**适配指导** + +应用中调用killProcessesBySelf可参考下列代码 + +变更前代码: + +```ts +let context: common.UIAbilityContext = globalThis.abilityContext; +let appContext = context.getApplicationContext(); +appContext.killProcessesBySelf() +``` + +变更后代码: + +```ts +let context: common.UIAbilityContext = globalThis.abilityContext; +let appContext = context.getApplicationContext(); +appContext.killAllProcesses() +``` + + + +## cl.ability.3 getProcessRunningInformation接口变更 + +getProcessRunningInformation接口命名不合理,修改为getRunningProcessInformation。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ----------------------------------- | ------------------ | ------------------------------------------------------------ | -------- | +| @ohos.app.ability.appManager.d.ts | appManager | function getProcessRunningInformation(): Promise\\>; | 删除 | +| @ohos.app.ability.appManager.d.ts | appManager | function getProcessRunningInformation(callback: AsyncCallback\\>): void; | 删除 | +| @ohos.app.ability.appManager.d.ts | appManager | function getRunningProcessInformation(): Promise\\>; | 新增 | +| @ohos.app.ability.appManager.d.ts | appManager | function getRunningProcessInformation(callback: AsyncCallback\\>): void; | 新增 | +| application/ApplicationContext.d.ts | ApplicationContext | getProcessRunningInformation(): Promise\\>; | 删除 | +| application/ApplicationContext.d.ts | ApplicationContext | getProcessRunningInformation(callback: AsyncCallback\\>): void; | 删除 | +| application/ApplicationContext.d.ts | ApplicationContext | getRunningProcessInformation(): Promise\\>; | 新增 | +| application/ApplicationContext.d.ts | ApplicationContext | getRunningProcessInformation(callback: AsyncCallback\\>): void; | 新增 | + +**适配指导** + +应用中调用getProcessRunningInformation可参考下列代码 + +变更前代码: + +```ts +let context: common.UIAbilityContext = globalThis.abilityContext; +let appContext = context.getApplicationContext(); +appContext.getProcessRunningInformation() +``` + +变更后代码: + +```ts +let context: common.UIAbilityContext = globalThis.abilityContext; +let appContext = context.getApplicationContext(); +appContext.getRunningProcessInformation() +``` + + + +## cl.ability.4 WantConstant.Flags接口变更 +WantConstant.Flags接口有多个无效Flag定义,删除掉无效的Flag。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_FORWARD_RESULT | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CONTINUATION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_NOT_OHOS_COMPONENT | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_FORM_ENABLED | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_AUTH_PREFIX_URI_PERMISSION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITYSLICE_MULTI_DEVICE | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_START_FOREGROUND_ABILITY | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CONTINUATION_REVERSIBLE | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_INSTALL_WITH_BACKGROUND_MODE | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CLEAR_MISSION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_NEW_MISSION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_MISSION_TOP | 删除 | + + + +## cl.ability.5 WantConstant.Action接口变更 +WantConstant.Action接口有多个无效Action定义,删除掉无效的Action。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_APP_ACCOUNT_AUTH | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_MARKET_DOWNLOAD | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_MARKET_CROWDTEST | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_SANDBOX | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_BUNDLE_NAME | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_MODULE_NAME | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_ABILITY_NAME | 删除 | + + + +## cl.ability.6 Caller相关接口变更 +Caller相关接口使用RPC废弃的Sequenceable和MessageParcel对象,使用RPC在API9提供的Parcelable和MessageSequence对象替代。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| api/@ohos.app.ability.UIAbility.d.ts | CalleeCallback | (indata: rpc.MessageParcel): rpc.Sequenceable; | 变更,修改为 (indata: rpc.MessageSequence): rpc.Parcelable; | +| api/@ohos.app.ability.UIAbility.d.ts | Caller | call(method: string, data: rpc.Sequenceable): Promise; | 变更,修改为 call(method: string, data: rpc.Parcelable): Promise; | +| api/@ohos.app.ability.UIAbility.d.ts | Caller | callWithResult(method: string, data: rpc.Sequenceable): Promise; | 变更,修改为 callWithResult(method: string, data: rpc.Parcelable): Promise; | + +**适配指导** + +应用中调用Caller相关接口可参考下列代码 + +变更前代码: + +```ts + class MyMessageAble{ + name:"" + str:"" + num: 1 + constructor(name, str) { + this.name = name; + this.str = str; + } + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']'); + return true; + } + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']'); + return true; + } + }; + let method = 'call_Function'; + function funcCallBack(pdata) { + console.log('Callee funcCallBack is called ' + pdata); + let msg = new MyMessageAble("test", ""); + pdata.readSequenceable(msg); + return new MyMessageAble("test1", "Callee test"); + } + export default class MainUIAbility extends UIAbility { + onCreate(want, launchParam) { + console.log('Callee onCreate is called'); + try { + this.callee.on(method, funcCallBack); + } catch (error) { + console.log('Callee.on catch error, error.code: ' + error.code + + ' error.message: ' + error.message); + } + } + } +``` + +变更后代码: + +```ts + class MyMessageAble{ + name:"" + str:"" + num: 1 + constructor(name, str) { + this.name = name; + this.str = str; + } + marshalling(messageSequence) { + messageSequence.writeInt(this.num); + messageSequence.writeString(this.str); + console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']'); + return true; + } + unmarshalling(messageSequence) { + this.num = messageSequence.readInt(); + this.str = messageSequence.readString(); + console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']'); + return true; + } + }; + let method = 'call_Function'; + function funcCallBack(pdata) { + console.log('Callee funcCallBack is called ' + pdata); + let msg = new MyMessageAble("test", ""); + pdata.readParcelable(msg); + return new MyMessageAble("test1", "Callee test"); + } + export default class MainUIAbility extends UIAbility { + onCreate(want, launchParam) { + console.log('Callee onCreate is called'); + try { + this.callee.on(method, funcCallBack); + } catch (error) { + console.log('Callee.on catch error, error.code: ' + error.code + + ' error.message: ' + error.message); + } + } + } +``` + + + +## cl.ability.7 WantConstant.Flags接口变更 + +wantConstant接口有两个类似的枚举,合并成一个。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ----------------------------------- | ---------------------- | ----------------------------------- | -------- | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Parameter | ABILITY_BACK_TO_OTHER_MISSION_STACK | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Params | ABILITY_BACK_TO_OTHER_MISSION_STACK | 新增 | + +**适配指导** + +使用@ohos.app.ability.wantConstant.d.ts中的ABILITY_BACK_TO_OTHER_MISSION_STACK + +```ts +import wantConstant from '@ohos.app.ability.wantConstant'; +let backToOtherMissionStack: wantConstant.Params = wantParam.Params.ABILITY_BACK_TO_OTHER_MISSION_STACK; +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-arkui.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-arkui.md new file mode 100644 index 0000000000000000000000000000000000000000..23d453b41ef6811d484f1c62796676f6a2f1013b --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-arkui.md @@ -0,0 +1,306 @@ +# arkui子系统ChangeLog + +## cl.arkui.1 getInspectorTree接口返回值从string修改为Object。 + +**变更影响** + +3.2.10.7之前使用getInspectorTree接口的代码需要适配 + +**关键的接口/组件变更** + +getInspectorTree接口返回值从string修改为Object + +**适配指导** + +将getInspectorTree返回值作为string使用的代码需要修改,比如以下示例代码: + +```typescript +console.info(getInspectorTree()) +``` + +需要修改成 + +```typescript +console.info(JSON.stringify(getInspectorTree())) +``` + +## cl.arkui.2 废弃GridItem的forceRebuild属性 + +**变更影响** + +无,该属性无作用 + +**关键的接口/组件变更** + +GridItem的forceRebuild属性废弃 + +**适配指导** + +如有使用可以直接删除,不影响GridItem功能 + +## cl.arkui.3 Plugin模块接口变更 + + +### 1. arkui子系统Plugin模块 `PluginComponentTemplate` 接口存在变更: + +ability命名无法准确表达对应参数的语义,修改为bundleName。 + +开发者需要根据以下说明对应用进行适配。 + + + +**变更影响** + +基于此前版本开发的应用,需适配变更接口,变更前的接口已经不能正常使用,会在编译过程中报错。 + + + +**关键的接口/组件变更** + +- 涉及接口 + + interface PluginComponentTemplate { + source: string; + bundleName: string; + } + + interface PluginComponentInterface { + (value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute; +} + +- 变更前: + +```js + interface PluginComponentTemplate { source: string; ability: string; } + interface PluginComponentInterface { + (value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute; + } +``` + +- 变更后: + +```js + interface PluginComponentTemplate { source: string; bundleName: string; } + interface PluginComponentInterface { + (value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute; + } +``` + +**适配指导** + +使用变更后的接口,示例代码如下: + +- 变更前: +```js +PluginComponent({ + template: { source: 'plugincomponent1', ability: 'com.example.plugin' }, + data: { 'countDownStartValue': 'new countDownStartValue' } +}).size({ width: 500, height: 100 }) +``` + +- 变更后: +```js +PluginComponent({ + template: { source: 'plugincomponent1', bundleName: 'com.example.plugin' }, + data: { 'countDownStartValue': 'new countDownStartValue' } +}).size({ width: 500, height: 100 }) +``` + +### 2. arkui子系统Plugin模块 `pluginComponentManager` 接口存在变更: + +want命名无法准确表达对应参数的语义,修改为target。 + +开发者需要根据以下说明对应用进行适配。 + + + +**变更影响** + +基于此前版本开发的应用,需适配变更接口。变更前的接口会出现告警,虽然可以通过编译,但是已经不能正常使用其功能。 + + + +**关键的接口/组件变更** + +- 涉及接口 + + interface PushParameterForStage { + owner: Want; + target: Want; + name: string; + data: KVObject; + extraData: KVObject; + jsonPath?: string; + } + + function push(param: PushParameterForStage, callback: AsyncCallback): void; + + interface RequestParameterForStage { + owner: Want; + target: Want; + name: string; + data: KVObject; + jsonPath?: string; + } + + function request(param: RequestParameterForStage, callback: AsyncCallback): void; + +- 变更前: + +```js + interface PushParameterForStage { + owner: Want; + want: Want; + name: string; + data: KVObject; + extraData: KVObject; + jsonPath?: string; + } + + function push(param: PushParameterForStage, callback: AsyncCallback): void; + + interface RequestParameterForStage { + owner: Want; + want: Want; + name: string; + data: KVObject; + jsonPath?: string; + } + + function request(param: RequestParameterForStage, callback: AsyncCallback): void; +``` + +- 变更后: + +```js + interface PushParameterForStage { + owner: Want; + target: Want; + name: string; + data: KVObject; + extraData: KVObject; + jsonPath?: string; + } + + function push(param: PushParameterForStage, callback: AsyncCallback): void; + + interface RequestParameterForStage { + owner: Want; + target: Want; + name: string; + data: KVObject; + jsonPath?: string; + } + + function request(param: RequestParameterForStage, callback: AsyncCallback): void; +``` + +**适配指导** + +使用变更后的接口,示例代码如下: + +- 变更前: +```js +import pluginComponentManager from '@ohos.pluginComponent' + +pluginComponentManager.push({ + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + want: { + bundleName: "com.example.provider", + abilityName: "com.example.provider.MainAbility", + }, + name: "ets/pages/plugin2.js", + data: { + "js": "ets/pages/plugin.js", + "key_1": 1111, + }, + extraData: { + "extra_str": "this is push event" + }, + jsonPath: "", + }, + (err, data) => { + console.log("push_callback:err: " ,JSON.stringify(err)); + console.log("push_callback:data: " , JSON.stringify(data)); + console.log("push_callback: push ok!"); + } +) + +pluginComponentManager.request({ + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + want: { + bundleName: "com.example.provider", + abilityName: "ets/pages/plugin2.js", + }, + name: "plugintemplate", + data: { + "key_1": " myapplication plugin component test", + "key_2": 123456 + }, + jsonPath: "", +}, + (err, data) => { + console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) + console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) + } +) +``` + +- 变更后: +```js +import pluginComponentManager from '@ohos.pluginComponent' + +pluginComponentManager.push({ + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + target: { + bundleName: "com.example.provider", + abilityName: "com.example.provider.MainAbility", + }, + name: "ets/pages/plugin2.js", + data: { + "js": "ets/pages/plugin.js", + "key_1": 1111, + }, + extraData: { + "extra_str": "this is push event" + }, + jsonPath: "", + }, + (err, data) => { + console.log("push_callback:err: " ,JSON.stringify(err)); + console.log("push_callback:data: " , JSON.stringify(data)); + console.log("push_callback: push ok!"); + } +) + +pluginComponentManager.request({ + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + target: { + bundleName: "com.example.provider", + abilityName: "ets/pages/plugin2.js", + }, + name: "plugintemplate", + data: { + "key_1": " myapplication plugin component test", + "key_2": 123456 + }, + jsonPath: "", +}, + (err, data) => { + console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) + console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) + } +) +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-bundlemanager.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-bundlemanager.md new file mode 100644 index 0000000000000000000000000000000000000000..f175165703f3b7929833790238251b5d0b6fa901 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-bundlemanager.md @@ -0,0 +1,298 @@ +# 包管理子系统ChangeLog + +## cl.bundlemanager.1 包管理删除@ohos.bundle.bundleManager.d.ts中的getAbilityIcon接口,可以使用@ohos.resourceManager.d.ts中的getMediaContent替换。 + +包管理删除[@ohos.bundle.bundleManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleManager.d.ts)中的getAbilityIcon接口,可以使用[@ohos.resourceManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.resourceManager.d.ts)中的getMediaContent替换。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了getAbilityIcon接口的,需要改为使用getMediaContent接口。 + +**关键的接口/组件变更**
+删除@ohos.bundle.bundleManager.d.ts中的getAbilityIcon接口。 + +**适配指导**
+使用@ohos.bundle.bundleManager.d.ts下面的getAbilityIcon,需要修改为@ohos.resourceManager.d.ts中的getMediaContent。需要提前获取到图标的资源ID值,可参考该接口的[使用指导](../../../application-dev/reference/apis/js-apis-resource-manager.md#getmediacontent9)。 + +## cl.bundlemanager.2 包管理底层能力变更,仅支持系统资源HAP自定义权限,其它HAP均不支持自定义权限。 + +仅支持系统资源HAP自定义权限,其它HAP均不支持自定义权限。包管理在解析HAP时,仅支持解析资源HAP(包名为:ohos.global.systemres)的配置文件中的definePermissions字段,该字段用来定义权限。其它HAP中配置的definePermissions字段将不会解析。 +如果有应用需要自定义权限,可以在资源HAP的[配置文件](https://gitee.com/openharmony/utils_system_resources/blob/master/systemres/main/config.json)中definePermissions字段下面新增定义权限。格式可参考[定义权限](../../../application-dev/quick-start/module-structure.md#definepermissions对象内部结构)。 + + +**变更影响**
+升级新版本镜像后,应用自定义的权限将不会生效,使用方在申请该权限时,会授权失败。 + +**关键的接口/组件变更**
+包管理底层能力变更,仅支持系统资源HAP自定义权限,其它HAP均不支持自定义权限。 + +**适配指导**
+如果有应用需要自定义权限,可以在资源HAP的[配置文件](https://gitee.com/openharmony/utils_system_resources/blob/master/systemres/main/config.json)中definePermissions字段下面新增定义权限。格式可参考[定义权限](../../../application-dev/quick-start/module-structure.md#definepermissions对象内部结构)。 + +## cl.bundlemanager.3 包管理二级模块文件名称变更,修改为文件内对应的接口名称 + +包管理二级模块文件名称变更,修改为文件内对应的接口名称,变更文件如下: + +| 原文件名称 |变更后文件名称 | +|----|----| +| bundleManager/abilityInfo.d.ts | bundleManager/AbilityInfo.d.ts | +| bundleManager/applicationInfo.d.ts | bundleManager/ApplicationInfo.d.ts | +| bundleManager/bundleInfo.d.ts | bundleManager/BundleInfo.d.ts | +| bundleManager/dispatchInfo.d.ts | bundleManager/DispatchInfo.d.ts | +| bundleManager/elementName.d.ts | bundleManager/ElementName.d.ts | +| bundleManager/extensionAbilityInfo.d.ts | bundleManager/ExtensionAbilityInfo.d.ts | +| bundleManager/hapModuleInfo.d.ts | bundleManager/HapModuleInfo.d.ts | +| bundleManager/launcherAbilityInfo.d.ts | bundleManager/LauncherAbilityInfo.d.ts | +| bundleManager/metadata.d.ts | bundleManager/Metadata.d.ts | +| bundleManager/packInfo.d.ts | bundleManager/BundlePackInfo.d.ts | +| bundleManager/permissionDef.d.ts | bundleManager/PermissionDef.d.ts | +| bundleManager/remoteAbilityInfo.d.ts | bundleManager/RemoteAbilityInfo.d.ts | +| bundleManager/shortcutInfo.d.ts | bundleManager/ShortcutInfo.d.ts | + +除了免安装相关的BundlePackInfo文件名称增加了Bundle,其余文件名称均是修改为大写开头。 + +**变更影响**
+仅修改二级模块文件名称,不会影响一级模块的使用。在使用之前已发布的API 9各beta版本时,如果在ts文件中直接导入了bundleManager下面二级模块接口的,IDE中编译报错的话,需要修改导入的文件名称。 + +**关键的接口/组件变更**
+变更bundleManager文件夹下面的d.ts名称,修改为文件中的接口名称。 + +**适配指导**
+使用新的sdk后,正常情况下应用无需适配该变更。如果在应用中直接导入了bundleManager文件夹下面的文件,则需要修改导入的文件名称。可以按照如下的修改方式: + +**修改前:** +```ts +import {AbilityInfo} from 'bundleManger/abilityInfo'; +import {ExtensionAbilityInfo} from 'bundleManger/extensionAbilityInfo'; +import {BundlePackInfo} from 'bundleManger/packInfo'; +``` +**修改后:** +```ts +import {AbilityInfo} from 'bundleManger/AbilityInfo'; +import {ExtensionAbilityInfo} from 'bundleManger/ExtensionAbilityInfo'; +import {BundlePackInfo} from 'bundleManger/BundlePackInfo'; +``` + +## cl.bundlemanager.4 包管理LaunchType枚举类型名称变更,由STANDARD修改为MULTITON,枚举值不变。 + +包管理[LaunchType](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleManager.d.ts)枚举类型变更,由STANDARD修改为MULTITON,枚举值不变,表示多实例类型。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了LaunchType.STANDARD的,需要改为使用LaunchType.MULTITON接口。 + +**关键的接口/组件变更**
+LaunchType枚举类型名称变更,由LaunchType.STANDARD修改为LaunchType.MULTITON。 + +**适配指导**
+由LaunchType.STANDARD修改为LaunchType.MULTITON。 + +## cl.bundlemanager.5 包管理AbilityInfo结构体中isVisible字段修改为exported,类型不变。 + +包管理[AbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/AbilityInfo.d.ts)结构体中isVisible字段修改为exported,类型不变,表示当前ability是否支持导出,被其他的ability使用。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了isVisible的,需要改为使用exported。 + +**关键的接口/组件变更**
+包管理[AbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/AbilityInfo.d.ts)结构体中isVisible字段修改为exported,类型不变。 + +**适配指导**
+由isVisible修改为exported。 + +## cl.bundlemanager.6 包管理ExtensionAbilityInfo结构体中isVisible字段修改为exported,类型不变。 + +包管理[ExtensionAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ExtensionAbilityInfo.d.ts)结构体中isVisible字段修改为exported,类型不变,表示当前ability是否支持导出,被其他的ability使用。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了isVisible的,需要改为使用exported。 + +**关键的接口/组件变更**
+包管理[ExtensionAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ExtensionAbilityInfo.d.ts)结构体中isVisible字段修改为exported,类型不变。 + +**适配指导**
+由isVisible修改为exported。 + +## cl.bundlemanager.7 包管理ModuleAbilityInfo结构体中visible字段修改为exported,类型不变。 + +包管理[ModuleAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundlePackInfo.d.ts)结构体中visible字段修改为exported,类型不变,表示当前ability是否支持导出,被其他的ability使用。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了visible的,需要改为使用exported。 + +**关键的接口/组件变更**
+包管理[ModuleAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundlePackInfo.d.ts)结构体中visible字段修改为exported,类型不变。 + +**适配指导**
+由visible修改为exported。 + +## cl.bundlemanager.8 app.json配置文件删除distributedNotificationEnabled标签 +删除配置文件app.json中[distributedNotificationEnabled](../../../application-dev/quick-start/app-configuration-file.md)标签 + +**变更影响**
+删除配置文件app.json中[distributedNotificationEnabled](../../../application-dev/quick-start/app-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除[distributedNotificationEnabled](../../../application-dev/quick-start/app-configuration-file.md)标签 + +## cl.bundlemanager.9 app.json配置文件删除entityType标签 +删除配置文件app.json中[entityType](../../../application-dev/quick-start/app-configuration-file.md)标签 + +**变更影响**
+删除配置文件app.json中[entityType](../../../application-dev/quick-start/app-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除[entityType](../../../application-dev/quick-start/app-configuration-file.md)标签 + +## cl.bundlemanager.10 app.json配置文件删除keepAlive标签 +删除配置文件app.json中[keepAlive](../../../application-dev/quick-start/app-configuration-file.md)标签 + +**变更影响**
+删除配置文件app.json中[keepAlive](../../../application-dev/quick-start/app-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除[keepAlive](../../../application-dev/quick-start/app-configuration-file.md)标签 + +## cl.bundlemanager.11 app.json配置文件删除removable标签 +删除配置文件app.json中[removable](../../../application-dev/quick-start/app-configuration-file.md)标签 + +**变更影响**
+删除配置文件app.json中[removable](../../../application-dev/quick-start/app-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除[removable](../../../application-dev/quick-start/app-configuration-file.md)标签 + +## cl.bundlemanager.12 app.json配置文件删除singleton标签 +删除配置文件app.json中[singleton](../../../application-dev/quick-start/app-configuration-file.md)标签 + +**变更影响**
+删除配置文件app.json中[singleton](../../../application-dev/quick-start/app-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除[singleton](../../../application-dev/quick-start/app-configuration-file.md)标签 + +## cl.bundlemanager.13 app.json配置文件删除userDataClearable标签 +删除配置文件app.json中[userDataClearable](../../../application-dev/quick-start/app-configuration-file.md)标签 + +**变更影响**
+删除配置文件app.json中[userDataClearable](../../../application-dev/quick-start/app-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除[userDataClearable](../../../application-dev/quick-start/app-configuration-file.md)标签 + +## cl.bundlemanager.14 module.json配置文件中module的name标签不再支持配置中文 +module.json配置文件中的module的[name](../../../application-dev/quick-start/module-configuration-file.md)不再支持配置中文 + +**变更影响**
+删除配置文件module.json中module的[name](../../../application-dev/quick-start/module-configuration-file.md)标签不再支持配置中文,IDE中配置该标签为中文,会导致IDE编译报错 + +**适配指导**
+使用英文语言配置module.json中module的[name](../../../application-dev/quick-start/module-configuration-file.md)标签 + +## cl.bundlemanager.15 module.json配置文件中ability的name标签不再支持配置中文 +module.json配置文件中的ability的[name](../../../application-dev/quick-start/module-configuration-file.md)不再支持配置中文 + +**变更影响**
+删除配置文件module.json中ability的[name](../../../application-dev/quick-start/module-configuration-file.md)标签不再支持配置中文,IDE中配置该标签为中文,会导致IDE编译报错 + +**适配指导**
+使用英文语言配置module.json中ability的[name](../../../application-dev/quick-start/module-configuration-file.md)标签 + +## cl.bundlemanager.16 module.json配置文件删除uiSyntax标签 +删除配置文件module.json中[uiSyntax](../../../application-dev/quick-start/module-configuration-file.md)标签 + +**变更影响**
+删除配置文件module.json中[uiSyntax](../../../application-dev/quick-start/module-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除module.json中[uiSyntax](../../../application-dev/quick-start/module-configuration-file.md)标签 + +## cl.bundlemanager.17 module.json配置文件中module及ability中的srcEntrance标签修改为srcEntry +配置文件module.json中[srcEntrance](../../../application-dev/quick-start/module-configuration-file.md)标签修改为srcEntry + +**变更影响**
+删除配置文件module.json中[srcEntrance](../../../application-dev/quick-start/module-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除module.json中[srcEntrance](../../../application-dev/quick-start/module-configuration-file.md)标签,使用srcEntry替代 + +## cl.bundlemanager.18 删除module.json配置文件中distroFilter的apiVersion标签 +删除配置文件module.json中[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)的apiVersion标签 + +**变更影响**
+删除配置文件module.json[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)的apiVersion标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除module.json中[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)的apiVersion标签 + +## cl.bundlemanager.19 module.json配置文件中distroFilter修改为distributionFilter +配置文件module.json中[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)标签修改为distributionFilter + +**变更影响**
+删除配置文件module.json[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除module.json中[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)标签,使用distributionFilter替代 + +## cl.bundlemanager.20 module.json配置文件中launchTypede标签standard模式修改为multiton +删除module.json中[launchType](../../../application-dev/quick-start/module-configuration-file.md)标签的standard模式修改为multiton + +**适配指导**
+删除module.json中[launchType](../../../application-dev/quick-start/module-configuration-file.md)标签的standard模式,使用multiton替代 + +## cl.bundlemanager.21 app.json配置文件删除atomicService标签 +删除配置文件app.json中atomicService标签 + +**变更影响**
+删除配置文件app.json中atomicService标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除atomicService标签 + +## cl.bundlemanager.22 app.json配置文件新增bundleType标签 +配置文件app.json中新增bundleType标签 + +**变更影响**
+现存的元服务([installationFree](../../../application-dev/quick-start/module-configuration-file.md)为true),必须在app.json中指定bundleType为atomicService,否则打包失败。 + +**适配指导**
+新增[bundleType](../../../application-dev/quick-start/app-configuration-file.md)标签。该标签为可缺省(缺省值为app)。该标签需要和module.json中[installationFree](../../../application-dev/quick-start/module-configuration-file.md)字段保持一一对应,其相应规则为: +- 当bundleType为app时,installationFree必须为false。 +- 当bundleType为atomicService时,installationFree必须为true。 + +## cl.bundlemanager.23 包管理ApplicationInfo结构体中删除split字段。 + +包管理[ApplicationInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ApplicationInfo.d.ts)结构体中删除split字段。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了split的,会编译失败。 + +**关键的接口/组件变更**
+包管理[ApplicationInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ApplicationInfo.d.ts)结构体中删除split字段。 + +**适配指导**
+删除ApplicationInfo结构体中的split字段。目前元服务中stage模型强制分包,不支持不分包。 + +## cl.bundlemanager.24 包管理HapModuleInfo结构体中删除atomicServiceModuleType字段。 + +包管理[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中删除atomicServiceModuleType字段。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了atomicServiceModuleType的,会编译失败。 + +**关键的接口/组件变更**
+包管理[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中删除atomicServiceModuleType字段。 + +**适配指导**
+删除[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中的atomicServiceModuleType字段。判断atomicServiceModuleType字段的部分,用[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中的moduleType代替。 + +## cl.bundlemanager.25 包管理删除AtomicServiceModuleType枚举值。 + +包管理[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中删除atomicServiceModuleType字段。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了atomicServiceModuleType的,会编译失败。 + +**关键的接口/组件变更**
+包管理[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中删除atomicServiceModuleType字段。 + +**适配指导**
+删除[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中的atomicServiceModuleType字段。判断atomicServiceModuleType字段的部分,用[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中的moduleType代替。 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-imf.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-imf.md new file mode 100644 index 0000000000000000000000000000000000000000..a6cdab6b8d7e7fc6a97698ce9b2e2a84ba32076a --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-imf.md @@ -0,0 +1,21 @@ +# 输入法框架子系统-输入法框架服务ChangeLog + + +## @ohos.InputMethodSubtype 中输入法子类型中name、label、id属性值变更 +从API9开始,变更如上三个属性值 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +此三个属性的取值发生变化,需要开发者进行适配更新 + +| 名称 | 变更前 | 变更后 | +| -------- | -------- | -------- | +| label | (1)取值:输入法子类型的id。| (1)取值:输入法子类型的标签。| +| name | (1)说明:输入法子类型的名字;(2)取值:输入法子类型的标签。| (1)说明:输入法应用的包名;(2)取值:输入法应用的包名。| +| id | (1)取值:输入法应用的包名。| (1)取值:输入法子类型的id。| + +**适配指导** + +请按上述取值变更结果适配更新。 diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-resourceschedule.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-resourceschedule.md new file mode 100644 index 0000000000000000000000000000000000000000..8042bb2241aa42c2c43aedc691c8b1113e93bf8a --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-resourceschedule.md @@ -0,0 +1,21 @@ +# 资源调度子系统ChangeLog + +## cl.resourceschedule.workScheduler +修改parameters属性值的数据类型,不允许使用any类型,支持number、string、boolean三种类型。 + +**变更影响** + +基于OpenHarmony3.2.10.7及之后的SDK版本开发的应用,parameters属性值的数据类型不允许使用any类型,仅支持number、string、boolean三种类型,否则将编译报错。 + +**关键接口/组件变更** + +@ohos.resourceschedule.workScheduler.d.ts中的parameters属性变更。 + +| 类名 | 接口类型 | 变更前声明 | 变更后声明 | +| -- | -- | -- | -- | +| workScheduler.WorkInfo | field | parameters?: {[key: string]: any} | parameters?: {[key: string]: number | string | boolean} | + + +**适配指导**
+ +parameters属性使用{[key: string]: number | string | boolean}数据类型。 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-screenlock.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-screenlock.md new file mode 100644 index 0000000000000000000000000000000000000000..8e5a2fab3671eb32db8accb72d764a1194f26ff1 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-screenlock.md @@ -0,0 +1,155 @@ +# 主题框架子系统-锁屏管理服务ChangeLog + + +## cl.screenlock.1 isLocked、unlock接口使用权限变更 +从API9开始,变更为systemapi,停止对三方应用开放。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。 + +- 涉及接口 + +```js + function isLocked(): boolean; + function unlock(callback: AsyncCallback): void; + function unlock():Promise; +``` + +- 变更前: + +```js + * Checks whether the screen is currently locked. + * + * @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function isLocked(): boolean; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function unlock(callback: AsyncCallback): void; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function unlock():Promise; +``` + +- 变更后: + +```js + * Checks whether the screen is currently locked. + * + * @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function isLocked(): boolean; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function unlock(callback: AsyncCallback): void; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function unlock():Promise; +``` + + +**适配指导** + +该接口变更为系统应用后,三方应用已无法使用。 +系统应用可正常使用。 +示例代码如下: + +```js + try { + let ret = screenLock.isLocked(); + console.error(`Obtain whether the screen is locked successfully , ret is: ${ret}`); + } catch (error) { + console.error(`Failed to obtain whether the screen is locked, error is : ${error.code}, ${error.message}`); + } +``` + +```js + screenlock.unlock((err, data) => { + if (err) { + console.error(`Failed to unlock the screen, because: ${err.message}`); + return; + } + console.info(`unlock the screen successfully. result: ${data}`); + }); +``` + +```js + screenlock.unlock().then((data) => { + console.info(`unlock the screen successfully. result: ${data}`); + }).catch((err) => { + console.error(`Failed to unlock the screen, because: ${err.message}`); + }); +``` + + +## cl.screenlock.2 isSecure接口废弃变更 +从API9开始,废弃此接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用进行更新使用,否则会影响原有功能。 + +- 涉及接口 + +```js + function isSecure(): boolean; +``` + +- 变更前: + +```js + function isSecure(): boolean; +``` + +- 变更后:删除接口,停止对外开放。 + + +**适配指导** + +该接口删除后无法再使用,请适配更新。 diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-telephony.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-telephony.md new file mode 100644 index 0000000000000000000000000000000000000000..cd74291d37afa9e4aee941a0e813824ede5af546 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-telephony.md @@ -0,0 +1,223 @@ +# 电话子系统ChangeLog + + + +## cl.telephony.1 call模块reject接口变更 +从API9开始,废弃此接口,改为使用rejectCall接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用新增的接口rejectCall替换,否则会影响原有功能。 + +- 涉及接口 + +```js + function reject(callId: number, callback: AsyncCallback): void; + function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; + function reject(callId?: number, options?: RejectMessageOptions): Promise; + function reject(callback: AsyncCallback): void; + function reject(options: RejectMessageOptions, callback: AsyncCallback): void; +``` + +- 变更前: + +```js + function reject(callId: number, callback: AsyncCallback): void; + function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; + function reject(callId?: number, options?: RejectMessageOptions): Promise; + function reject(callback: AsyncCallback): void; + function reject(options: RejectMessageOptions, callback: AsyncCallback): void; +``` + +- 变更后: + +```js + function rejectCall(callId: number, callback: AsyncCallback): void; + function rejectCall(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; + function rejectCall(callId?: number, options?: RejectMessageOptions): Promise; + function rejectCall(callback: AsyncCallback): void; + function rejectCall(options: RejectMessageOptions, callback: AsyncCallback): void; +``` + + +**适配指导** + +该接口删除无法再使用,请使用新增的接口rejectCall替换。 +使用变更后的接口,示例代码如下: + +```js +call.rejectCall("138xxxxxxxx", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +```js +let rejectMessageOptions={ + messageContent: "拦截陌生号码" +} +let promise = call.rejectCall(1, rejectMessageOptions); +promise.then(data => { + console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + + +```js +let rejectMessageOptions={ + messageContent: "拦截陌生号码" +} +let promise = call.rejectCall(1, rejectMessageOptions); +promise.then(data => { + console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + + +```js +call.rejectCall((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +```js +let rejectMessageOptions={ + messageContent: "拦截陌生号码" +} +call.rejectCall(rejectMessageOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## cl.telephony.2 call模块answer接口变更 +从API9开始,废弃此接口,改为使answerCall接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用新增的接口answerCall替换,否则会影响原有功能。 + +- 涉及接口 + +```js + function answer(callId: number, callback: AsyncCallback): void; + function answer(callId?: number): Promise; + function answer(callback: AsyncCallback): void; +``` + +- 变更前: + +```js + function answer(callId: number, callback: AsyncCallback): void; + function answer(callId?: number): Promise; + function answer(callback: AsyncCallback): void; +``` + +- 变更后: + +```js + function answerCall(callId: number, callback: AsyncCallback): void; + function answerCall(callId?: number): Promise; + function answerCall(callback: AsyncCallback): void; +``` + + +**适配指导** + +该接口删除无法再使用,请使用新增的接口answerCall替换。 +使用变更后的接口,示例代码如下: + +```js +call.answerCall(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +```js +let promise = call.answerCall(1); +promise.then(data => { + console.log(`answerCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`answerCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + + +```js +call.answerCall((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## cl.telephony.1 call模块hangup接口变更 +从API9开始,废弃此接口,改为使用hangUpCall接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用新增的接口hangUpCall替换,否则会影响原有功能。 + +- 涉及接口 + +```js + function hangup(callId: number, callback: AsyncCallback): void; + function hangup(callId?: number): Promise; + function hangup(callback: AsyncCallback): void; +``` + +- 变更前: + +```js + function hangup(callId: number, callback: AsyncCallback): void; + function hangup(callId?: number): Promise; + function hangup(callback: AsyncCallback): void; +``` + +- 变更后: + +```js + function hangUpCall(callId: number, callback: AsyncCallback): void; + function hangUpCall(callId?: number): Promise; + function hangUpCall(callback: AsyncCallback): void; +``` + + +**适配指导** + +该接口删除无法再使用,请使用新增的接口hangUpCall替换。 +使用变更后的接口,示例代码如下: + +```js +call.hangUpCall(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +```js +let promise = call.hangUpCall(1); +promise.then(data => { + console.log(`hangUpCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`hangUpCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + + +```js +call.hangUpCall((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-util.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-util.md new file mode 100644 index 0000000000000000000000000000000000000000..3455ff99e6f1a2e885acd1865b59f166d99a8c3e --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-util.md @@ -0,0 +1,99 @@ +# util系统JS API变更Changelog + +OpenHarmony 3.2.10.7(Mr)版本相较于OpenHarmony 3.2.beta4版本,util子系统的API变更如下 + +## cl.util.1.randomUUID接口名变更 +util子系统randomUUID函数名存在变更: + +function randomUUID(entropyCache?: boolean): string 改为 function generateRandomUUID(entropyCache?: boolean): string 函数名由原来的randomUUID改为generateRandomUUID。 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 方法/属性/枚举/常量 | 变更类型 | +| :---------- | ------------------- | ------- | +| @ohos.util | function randomUUID(entropyCache?: boolean): string | 删除 | +| @ohos.util | function generateRandomUUID(entropyCache?: boolean): string| 变更 | + +**适配指导** + +应用中使用generateRandomUUID可参考下列代码 + +示例: + +```ts +import util from '@ohos.util' +let uuid = util.generateRandomUUID(true); +console.log("RFC 4122 Version 4 UUID:" + uuid); +// 输出: +// RFC 4122 Version 4 UUID:88368f2a-d5db-47d8-a05f-534fab0a0045 +``` + +## cl.util.2.randomBinaryUUID接口名变更 +util子系统randomBinaryUUID函数名存在变更: + +function randomBinaryUUID(entropyCache?: boolean): Uint8Array 改为 function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array 函数名由原来的randomBinaryUUID改为generateRandomBinaryUUID。 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 方法/属性/枚举/常量 | 变更类型 | +| :---------- | ------------------- | ------- | +| @ohos.util | function randomBinaryUUID(entropyCache?: boolean): Uint8Array; | 删除 | +| @ohos.util | function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array| 变更 | + +**适配指导** + +应用中使用generateRandomBinaryUUID可参考下列代码 + +示例: + +```ts +import util from '@ohos.util' +let uuid = util.generateRandomBinaryUUID(true); +console.log(JSON.stringify(uuid)); +// 输出: +// 138,188,43,243,62,254,70,119,130,20,235,222,199,164,140,150 +``` + +## cl.util.3.LRUCache类contains接口参数类型变更 +util子系统LRUCache类contains接口参数类型变更: + +contains(key: object): boolean 改为 contains(key: K): boolean 参数类型由原来的object改为K。 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| :-------- | ---------| -------------------------------- | -------- | +| @ohos.util | LRUCache | contains(key: object): boolean | 删除 | +| @ohos.util | LRUCache | contains(key: K): boolean | 变更 | + +**适配指导** + +应用中使用contains函数可参考下列代码 + +示例: + +```ts +import util from '@ohos.util' +let pro = new util.LRUCache(); +pro.put(2,10); +let obj = {1:"key"}; +let result = pro.contains(obj); +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-wallpaper.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-wallpaper.md new file mode 100644 index 0000000000000000000000000000000000000000..13baab45851959398ccf4689543f91c5e1aa1d68 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-wallpaper.md @@ -0,0 +1,304 @@ +# 主题框架子系统-壁纸管理服务ChangeLog + + +## cl.wallpaper.1 getColorsSync、getMinHeightSync、getMinWidthSync、restore、setImage接口使用权限变更 +从API9开始,变更为systemapi,停止对三方应用开放。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。 + +- 涉及接口 + +```js + function getColorsSync(wallpaperType: WallpaperType): Array; + function getMinHeightSync(): number; + function getMinWidthSync(): number; + function restore(wallpaperType: WallpaperType, callback: AsyncCallback): void; + function restore(wallpaperType: WallpaperType): Promise; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; +``` + +- 变更前: + +```js + /** + * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. + * @param wallpaperType Indicates the wallpaper type. + * @returns { Array } the Array returned by the function. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getColorsSync(wallpaperType: WallpaperType): Array; + + /** + * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getMinHeightSync(): number; + + /** + * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getMinWidthSync(): number; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function restore(wallpaperType: WallpaperType, callback: AsyncCallback): void; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function restore(wallpaperType: WallpaperType): Promise; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; +``` + +- 变更后: + +```js + /** + * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. + * @param wallpaperType Indicates the wallpaper type. + * @returns { Array } the Array returned by the function. + * @throws {BusinessError} 401 - parameter error. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getColorsSync(wallpaperType: WallpaperType): Array; + + /** + * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getMinHeightSync(): number; + + /** + * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getMinWidthSync(): number; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function restore(wallpaperType: WallpaperType, callback: AsyncCallback): void; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function restore(wallpaperType: WallpaperType): Promise; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; +``` + + +**适配指导** + +该接口变更为系统应用后,三方应用已无法使用。 +系统应用可正常使用。 +示例代码如下: + +```js + try { + let colors = wallpaper.getColorsSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM); + console.log(`success to getColorsSync: ${JSON.stringify(colors)}`); + } catch (error) { + console.error(`failed to getColorsSync because: ${JSON.stringify(error)}`); + } +``` + +```js + let minHeight = wallpaper.getMinHeightSync(); +``` + +```js + let minWidth = wallpaper.getMinWidthSync(); +``` + +```js + wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => { + if (error) { + console.error(`failed to restore because: ${JSON.stringify(error)}`); + return; + } + console.log(`success to restore.`); + }); +``` + +```js + wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => { + console.log(`success to restore.`); + }).catch((error) => { + console.error(`failed to restore because: ${JSON.stringify(error)}`); + }); +``` + +```js + // source类型为string + let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; + wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => { + if (error) { + console.error(`failed to setImage because: ${JSON.stringify(error)}`); + return; + } + console.log(`success to setImage.`); + }); +``` + +```js + // source类型为string + let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; + wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => { + console.log(`success to setImage.`); + }).catch((error) => { + console.error(`failed to setImage because: ${JSON.stringify(error)}`); + }); +``` + + +## cl.wallpaper.2 getIdSync、getFileSync、isChangeAllowed、isUserChangeAllowed、on、off、RgbaColor接口废弃变更 +从API9开始,废弃此接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用进行更新使用,否则会影响原有功能。 + +- 涉及接口 + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- 变更前: + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- 变更后:删除接口,停止对外开放。 + + +**适配指导** + +该接口删除后无法再使用,请适配更新。 diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-web.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-web.md new file mode 100644 index 0000000000000000000000000000000000000000..1fd92a86421021c0ac26639f04c56c4e5c0f01f6 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-web.md @@ -0,0 +1,467 @@ +# web子系统ChangeLog + +OpenHarmony 3.2.10.7 版本相较于OpenHarmony 之前的版本,web的API变更如下。 + +## cl.web.1 HitTestTypeV9命名变更 + +枚举类HitTestTypeV9由于命名规范问题,名称变更为WebHitTestType。 + +**变更影响** + +枚举类HitTestTypeV9,以及使用HitTestTypeV9作为参数或返回值的接口,在3.2.10.7版本及后续版本中无法继续正常使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + enum HitTestTypeV9 + +- 变更前: + + ```ts + enum HitTestTypeV9 + ``` + +- 变更后: + + ```ts + enum WebHitTestType + ``` + +**适配指导** + +请使用WebHitTestType替换HitTestTypeV9。 + +## cl.web.2 HeaderV9命名变更 + +结构体HeaderV9由于命名规范问题,名称变更为WebHeader。 + +**变更影响** + +结构体HeaderV9,以及使用HeaderV9作为参数或返回值的接口,在3.2.10.7版本及后续版本中无法继续正常使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + interface HeaderV9 + +- 变更前: + + ```ts + interface HeaderV9 + ``` + +- 变更后: + + ```ts + interface WebHeader + ``` + +**适配指导** + +请使用WebHeader替换HeaderV9。 + +## cl.web.3 HitTestValue结构体成员类型变更 + +结构体HitTestValue中的成员变量HitTestTypeV9由于命名规范问题,名称变更为WebHitTestType。 + +**变更影响** + +结构体HitTestValue,以及使用HitTestValue作为参数或返回值的接口,在3.2.10.7版本及后续版本中无法继续正常使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + interface HitTestValue + +- 变更前: + + ```ts + interface HitTestValue { + + /** + * Get the hit test type. + * + * @since 9 + */ + type: HitTestTypeV9; + + /** + * Get the hit test extra data. + * + * @since 9 + */ + extra: string; + } + ``` + +- 变更后: + + ```ts + interface HitTestValue { + + /** + * Get the hit test type. + * + * @since 9 + */ + type: WebHitTestType; + + /** + * Get the hit test extra data. + * + * @since 9 + */ + extra: string; + } + ``` + +**适配指导** + +请使用WebHitTestType替换HitTestTypeV9。 + +## cl.web.4 loadUrl参数类型变更 + +loadUrl接口中的参数headers,由于其类型的命名规范问题,类型变更为WebHeader。 + +**变更影响** + +loadUrl接口若使用了headers参数,则在3.2.10.7版本及后续版本中无法继续正常使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + loadUrl(url: string | Resource, headers?: Array): void + +- 变更前: + + ```ts + loadUrl(url: string | Resource, headers?: Array): void + ``` + +- 变更后: + + ```ts + loadUrl(url: string | Resource, headers?: Array): void + ``` + +**适配指导** + +在loadUrl中设置headers参数时,请使用WebHeader类型替换HeaderV9类型。 + +## cl.web.5 getHitTest返回值类型变更 + +getHitTest接口中的返回值,由于其类型的命名规范问题,变更为WebHitTest。 + +**变更影响** + +getHitTest接口,在3.2.10.7版本及后续版本中无法继续正常使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + getHitTest(): HitTestTypeV9 + +- 变更前: + + ```ts + getHitTest(): HitTestTypeV9 + ``` + +- 变更后: + + ```ts + getHitTest(): WebHitTestType + ``` + +**适配指导** + +在使用getHitTest接口的返回值时,请使用WebHitTestType类型替换HitTestTypeV9类型。 + +## cl.web.6 WebMessagePort类迁移 + +WebMessagePort类迁移至@ohos.web.webview.d.ts,并新增错误码抛出。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现该类下接口支持错误码处理,需注意错误码处理的使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + postMessageEvent(message: WebMessageEvent): void; + onMessageEvent(callback: (result: string) => void): void; + +- 变更前: + + ```ts + postMessageEvent(message: WebMessageEvent): void; + onMessageEvent(callback: (result: string) => void): void; + ``` + +- 变更后: + + ```ts + postMessageEvent(message: WebMessage): void; + onMessageEvent(callback: (result: WebMessage) => void): void; + ``` + +**适配指导** + +原WebMessagePort类不需要import,现WebMessagePort类使用的是@ohos.web.webview,以下方式import: + + ```ts + import web_webview from '@ohos.web.webview'; + ``` + +## cl.web.7 HitTestValue类迁移 + +HitTestValue类迁移至@ohos.web.webview.d.ts,HitTestValue类变更为接口,getType,getExtra变更为属性。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。 + +**关键的接口/组件变更** + +- 涉及接口 + + getType(): HitTestType; + getExtra(): string; + +- 变更前: + + ```ts + getType(): HitTestType; + getExtra(): string; + ``` + +- 变更后: + + ```ts + type: WebHitTestType; + extra: string; + ``` + +**适配指导** + +原HitTestValue类不需要import,现HitTestValue类使用的是@ohos.web.webview,以下方式import: + + ```ts + import web_webview from '@ohos.web.webview'; + ``` + +## cl.web.8 WebCookie类下api9接口迁移 + +WebCookie类下api9接口迁移,WebCookie类下api9接口迁移到web.webview.webview.WebCookieManager。 +并新增接口错误码抛出。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现该类下接口支持错误码处理,需注意错误码处理的使用。 +该类方法变为静态方法。 + +**关键的接口/组件变更** + +- 涉及接口 + + isCookieAllowed(): boolean; + isThirdPartyCookieAllowed(): boolean; + putAcceptCookieEnabled(accept: boolean): void; + putAcceptThirdPartyCookieEnabled(accept: boolean): void; + setCookie(url: string, value: string): boolean; + saveCookieSync(): boolean; + getCookie(url: string): string; + existCookie(): boolean; + deleteEntireCookie(): void; + deleteSessionCookie(): void; + +- 变更前: + + ```ts + isCookieAllowed(): boolean; + isThirdPartyCookieAllowed(): boolean; + putAcceptCookieEnabled(accept: boolean): void; + putAcceptThirdPartyCookieEnabled(accept: boolean): void; + setCookie(url: string, value: string): boolean; + saveCookieSync(): boolean; + getCookie(url: string): string; + existCookie(): boolean; + deleteEntireCookie(): void; + deleteSessionCookie(): void; + ``` + +- 变更后: + + ```ts + static isCookieAllowed(): boolean; + static isThirdPartyCookieAllowed(): boolean; + static putAcceptCookieEnabled(accept: boolean): void; + static putAcceptThirdPartyCookieEnabled(accept: boolean): void; + static setCookie(url: string, value: string): void; + static saveCookieAsync(): Promise; + static saveCookieAsync(callback: AsyncCallback): void; + static getCookie(url: string): string; + static existCookie(): boolean; + static deleteEntireCookie(): void; + static deleteSessionCookie(): void; + ``` + +**适配指导** + +原WebCookie类不需要import,现WebCookieManager使用的是@ohos.web.webview,以下方式import: + + ```ts + import web_webview from '@ohos.web.webview'; + ``` + +## cl.web.9 WebController类下api9接口迁移 + +WebController类下api9接口迁移至web.webview.webview.WebviewController,并新增接口错误码抛出。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现该类下接口支持错误码处理,需注意错误码处理的使用。 +getDefaultUserAgent接口更名为getUserAgent。 + +**关键的接口/组件变更** + +- 涉及接口 + + zoomIn(): boolean; + zoomOut(): boolean; + createWebMessagePorts(): Array; + postMessage(options: { message: WebMessageEvent, uri: string}): void; + getHitTestValue(): HitTestValue; + getWebId(): number; + getDefaultUserAgent(): string; + getTitle(): string; + getPageHeight(): number; + backOrForward(step: number): void; + searchAllAsync(searchString: string): void; + clearMatches(): void; + searchNext(forward: boolean): void; + clearSslCache(): void; + clearClientAuthenticationCache(): void; + getUrl(): string; + +- 变更前: + + ```ts + zoomIn(): boolean; + zoomOut(): boolean; + createWebMessagePorts(): Array; + postMessage(options: { message: WebMessageEvent, uri: string}): void; + getHitTestValue(): HitTestValue; + getWebId(): number; + getDefaultUserAgent(): string; + getTitle(): string; + getPageHeight(): number; + backOrForward(step: number): void; + searchAllAsync(searchString: string): void; + clearMatches(): void; + searchNext(forward: boolean): void; + clearSslCache(): void; + clearClientAuthenticationCache(): void; + getUrl(): string; + ``` + +- 变更后: + + ```ts + zoomIn(): void; + zoomOut(): void; + createWebMessagePorts(): Array; + postMessage(name: string, ports: Array, uri: string): void; + getHitTestValue(): HitTestValue; + getWebId(): number; + getUserAgent(): string; + getTitle(): string; + getPageHeight(): number; + backOrForward(step: number): void; + searchAllAsync(searchString: string): void; + clearMatches(): void; + searchNext(forward: boolean): void; + clearSslCache(): void; + clearClientAuthenticationCache(): void; + getUrl(): string; + ``` + +**适配指导** + +原WebController类不需要import,现WebviewController类使用的是@ohos.web.webview,以下方式import: + + ```ts + import web_webview from '@ohos.web.webview'; + ``` + +## cl.web.10 WebAsyncController类迁移 + +WebAsyncController类下接口迁移至web.webview.webview.WebviewController,并新增接口错误码抛出。 + +**变更影响** + +基于此前版本开发的应用,需注意错误码处理的使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + storeWebArchive(baseName: string, autoName: boolean): Promise; + storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback): void; + +- 变更前: + + ```ts + storeWebArchive(baseName: string, autoName: boolean): Promise; + storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback): void; + ``` + +- 变更后: + + ```ts + storeWebArchive(baseName: string, autoName: boolean): Promise; + storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback): void; + ``` + +**适配指导** + +使用示例: + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('saveWebArchive') + .onClick(() => { + try { + this.controller.storeWebArchive("/data/storage/el2/base/", true, (error, filename) => { + if (error) { + console.info(`save web archive error: ` + JSON.stringify(error)) + return; + } + if (filename != null) { + console.info(`save web archive success: ${filename}`) + } + }); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-release/list.txt b/zh-cn/release-notes/changelogs/v3.2-release/list.txt new file mode 100644 index 0000000000000000000000000000000000000000..e87fad3e559dbe665d47642fae8a1e4427ef91b5 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/list.txt @@ -0,0 +1,12 @@ +changelogs-ability.md +changelogs-arkui.md +changelogs-bundlemanager.md +changelogs-imf.md +changelogs-resourceschedule.md +changelogs-screenlock.md +changelogs-telephony.md +changelogs-util.md +changelogs-wallpaper.md +changelogs-web.md +list.txt +Readme.md diff --git a/zh-cn/website.md b/zh-cn/website.md index 143491dad3d136f95dc6e3c3ef480a428bc01b76..2d5d2a13a01484308e8a6c42a72321646b7de543 100644 --- a/zh-cn/website.md +++ b/zh-cn/website.md @@ -101,6 +101,17 @@ - [用户IAM](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-user-iam.md) - [Web](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-web.md) - [窗口](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-window.md) + - 变更说明 + - [元能力](release-notes/changelogs/v3.2-release/changelogs-ability.md) + - [ArkUI](release-notes/changelogs/v3.2-release/changelogs-arkui.md) + - [包管理](release-notes/changelogs/v3.2-release/changelogs-bundlemanager.md) + - [输入法框架](release-notes/changelogs/v3.2-release/changelogs-imf.md) + - [全局资源调度](release-notes/changelogs/v3.2-release/changelogs-resourceschedule.md) + - [主题框架-锁屏](release-notes/changelogs/v3.2-release/changelogs-screenlock.md) + - [电话服务](release-notes/changelogs/v3.2-release/changelogs-telephony.md) + - [util](release-notes/changelogs/v3.2-release/changelogs-util.md) + - [主题框架-壁纸](release-notes/changelogs/v3.2-release/changelogs-wallpaper.md) + - [web组件](release-notes/changelogs/v3.2-release/changelogs-web.md) - OpenHarmony 3.2 Beta5 - JS API差异报告 - [元能力](release-notes/api-change/v3.2-beta5/js-apidiff-ability.md)