diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-dmsfwk.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-dmsfwk.md new file mode 100644 index 0000000000000000000000000000000000000000..6876e374974e37a027a336788294f9ef6fbf3fdc --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-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/changelog-resourceschedule.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-resourceschedule.md new file mode 100644 index 0000000000000000000000000000000000000000..2434d2d22974e3b4264b13565b5316a608227e02 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-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/changelog-web.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-web.md new file mode 100644 index 0000000000000000000000000000000000000000..92a0328779d3059ef92a06c966d213b9f85f51c9 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-web.md @@ -0,0 +1,128 @@ +# web子系统ChangeLog + +OpenHarmony 3.2.9.1 sp8版本相较于OpenHarmony 3.2.8.1版本,web的API变更如下 + +## 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/changelog-wifi.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-wifi.md new file mode 100644 index 0000000000000000000000000000000000000000..1f84833ca57af98d069eeba6c13c993f31cd1e8a --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-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-beta4/changelogs-ability.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-ability.md index fbe76bbc55d468adc2a683112cdd272a9332206a..2c6f17521f8bef0ed9b63dceaed6505fb082aa63 100644 --- a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-ability.md +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-ability.md @@ -228,7 +228,7 @@ **关键接口/组件变更** -为适配统一的API异常处理方式,对元能力相关接口进行废弃(下表中 原接口 列内容),并新增对应接口(下表中 新接口 列内容)。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。 +为适配统一的API异常处理方式,对元能力相关接口进行废弃(下表中 原接口 列内容,其中的API9接口将被删除,API8及以前的接口将被标注为废弃),并新增对应接口(下表中 新接口 列内容)。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。 | 原接口 | 新接口 | | ----------------------------------------------- | ----------------------------------------------- | 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 index 216a2b4f3e158dd8246200a2a039b25f09027b7f..e59049fbac5248afaa1d120c47ea574dc4da2fa4 100644 --- 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 @@ -1,6 +1,112 @@ +# 帐号子系统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.1 帐号SystemAPI错误信息返回方式变更 +## cl.account_os_account.2 帐号SystemAPI错误信息返回方式变更 已发布的部分帐号SystemAPI使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9开始作以下变更: @@ -15,6 +121,7 @@ **关键接口/组件变更** 变更前: + - class UserAuth - setProperty(request: SetPropertyRequest, callback: AsyncCallback<number>): void; - setProperty(request: SetPropertyRequest): Promise<number>; @@ -25,6 +132,7 @@ - cancel(challenge: Uint8Array): number; 变更后: + - class UserAuth - setProperty(request: SetPropertyRequest, callback: AsyncCallback<void>): void; - setProperty(request: SetPropertyRequest): Promise<void>; @@ -83,7 +191,7 @@ try { } ``` -## cl.account_os_account.2 应用帐号鉴权服务ACTION定义变更 +## cl.account_os_account.3 应用帐号鉴权服务ACTION定义变更 **变更影响** @@ -106,6 +214,7 @@ ACTION_APP_ACCOUNT_AUTH = "ohos.appAccount.action.auth" **适配指导** 提供应用帐号鉴权服务的三方应用,需要在相关ServiceAbility的配置文件(FA模型为config.json或Stage模型为module.json5)中适配变更后的应用帐号认证ACTION,示例如下: + ``` "abilities": [ { @@ -122,3 +231,5 @@ ACTION_APP_ACCOUNT_AUTH = "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 index 03fb7e2d7bc8bbb20d9294731f78805b245fd1d6..4ce56f7346c9f1f0c92dc1037eb9eb1845e7a6e5 100644 --- a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-arkui.md +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-arkui.md @@ -65,4 +65,62 @@ ArkUI子系统alertDialog, actionSheet, customDialog组件及prompt, promptActio **适配指导** -无需适配 \ No newline at end of file +无需适配 + +## 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..9d5c7e9811baa1f5f4a2abbad0702db42aaadacd --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-camera.md @@ -0,0 +1,783 @@ +# 媒体子系统JS API变更Changelog + +OpenHarmony3.2 Beta4版本相较于OpenHarmony3.2 Beta3版本,媒体子系统camera部件API变更如下 + +## 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-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..5ab2c1109b6b6adc2a505aa5aad1baa2675ccc50 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-enterprise_device_management.md @@ -0,0 +1,159 @@ +# 定制子系统ChangeLog + +OpenHarmony 3.2.8.3 版本相较于OpenHarmony 3.2.8.1版本,定制子系统的API变更如下: + +## 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-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..ec7e3f8202e14792db1a8df9fde33390a935944c --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-request.md @@ -0,0 +1,108 @@ +# 上传下载子系统ChangeLog + +OpenHarmony 3.2.8.1版本相较于OpenHarmony 3.2.beta3版本,request子系统的API变更如下 + +## 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-telephony.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-telephony.md index 9bbe5739345b8426fc3918e03806fbfdb65cab40..88b25f832e020276df920a43b3fa5543af6bf5b3 100644 --- a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-telephony.md +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-telephony.md @@ -62,4 +62,4 @@ promise.then(data => { }).catch(err => { console.error(`isImsSmsSupported failed, promise: err->${JSON.stringify(err)}`); }); -``` \ No newline at end of file +``` 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..468cdd16e5e625acc563890bea2ddf380245ba4e --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-wantAgent.md @@ -0,0 +1,90 @@ +# wantAgent的JS API变更Changelog + +OpenHarmony 3.2.9.1 sp8版本相较于OpenHarmony 3.2.8.1版本,wantAgent的API变更如下 + +## 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-beta5/changelog-LocalStorage.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelog-LocalStorage.md new file mode 100644 index 0000000000000000000000000000000000000000..ab6f7ad4e5f69f2c240683c18fd98e0d9a23f71b --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelog-LocalStorage.md @@ -0,0 +1,116 @@ +# ArkUI子系统LocalStorage类接口ChangeLog + +## cl.LocalStorage.1 get接口返回类型变更 + +**变更影响** + +返回类型从get(propName: string): T变更为get(propName: string): T | undefined +应用不需要进行适配。 + +## cl.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.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.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.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.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 +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelog-resourceschedule.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelog-resourceschedule.md new file mode 100644 index 0000000000000000000000000000000000000000..a7c431a2365444a6275d3fc3be61f785dcaa4b4f --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelog-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-beta4/changelog-security.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelog-security.md similarity index 74% rename from zh-cn/release-notes/changelogs/v3.2-beta4/changelog-security.md rename to zh-cn/release-notes/changelogs/v3.2-beta5/changelog-security.md index 829bf9766431b66434b09849516feb1a52e2d90c..3f3a7acf0bbdee1aa1b640f511c91e3f65d2333e 100644 --- a/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-security.md +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelog-security.md @@ -344,3 +344,132 @@ 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/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..2f92e22d13abad7b7571e48058e88b443999bc0d --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ability.md @@ -0,0 +1,177 @@ +# 元能力子系统JS API变更Changelog + +OpenHarmony 3.2.10.1(Mr)版本相较于OpenHarmony 3.2.beta4版本,元能力子系统的API变更如下 + +## 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-bundlemanager.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-bundlemanager.md deleted file mode 100644 index 778ce0e4378d00ce220c65a195887077f24a3f53..0000000000000000000000000000000000000000 --- a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-bundlemanager.md +++ /dev/null @@ -1,33 +0,0 @@ -# 包管理子系统ChangeLog - -## cl.bundlemanager.1 API9的ApplicationInfo结构体字段变更,删除entryDir字段。 - -API9的ApplicationInfo结构体[[bundleManager/applicationInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/monthly_20221018/api/bundleManager/applicationInfo.d.ts)]字段变更,删除entryDir字段。 - -**变更影响**
-对使用API version 8及之前版本SDK的应用无影响,使用API version 9的应用需要适配新模块和新接口。 - -**关键的接口/组件变更**
-ApplicationInfo结构体发生变化的字段内容如下表所示。 -| 删除 | API9新增或变更 | 类型 | -| --- | --- | --- | -| entryDir | 无 | string | - -**适配指导**
-导入包管理查询的模块,在API9 version的ApplicationInfo结构体时,使用了entryDir需要进行修改,该字段属于多余字段。 - -## cl.bundlemanager.2 API9的HapModuleInfo结构体字段变更,删除moduleSourceDir字段。 - -API9的HapModuleInfo结构体[[bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/monthly_20221018/api/bundleManager/hapModuleInfo.d.ts)]字段变更,删除moduleSourceDir字段。 - -**变更影响**
-对使用API version 8及之前版本SDK的应用无影响,使用API version 9的应用需要适配新模块和新接口。 - -**关键的接口/组件变更**
-HapModuleInfo结构体发生变化的字段内容如下表所示。 -| 删除 | API9新增或变更 | 类型 | -| --- | --- | --- | -| moduleSourceDir | 无 | string | - -**适配指导**
-导入包管理查询的模块,在API9 version的HapModuleInfo结构体时不能使用moduleSourceDir字段。使用了moduleSourceDir需要进行修改,该字段属于多余字段。 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..44cfb4d87f548d6f399b822afd2b586d34584577 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-container.md @@ -0,0 +1,23 @@ +# commonlibrary子系统JS API变更Changelog + +OpenHarmony 3.2.10.1(Mr)版本相较于OpenHarmony 3.2.beta4版本,container子系统的API变更如下 + +## 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 index 999ba1d22e7068bb5d09ee24b5079c648a2b4214..8273daea910b4b07c5e8930e1a64910a673af1c9 100644 --- a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-distributeddatamgr.md +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-distributeddatamgr.md @@ -66,11 +66,10 @@ try { ## cl.distributeddatamgr.2 function getRdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts **变更影响** -getRdbStoreV9接口标记废弃,应用需要进行适配。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 **关键的接口/组件变更** 如下接口: - ```ts function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number, callback: AsyncCallback): void; function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number): Promise; @@ -87,11 +86,10 @@ function getRdbStore(context: Context, config: StoreConfig): Promise; ## cl.distributeddatamgr.3 function deleteRdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts **变更影响** -deleteRdbStoreV9接口标记废弃,应用需要进行适配。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 **关键的接口/组件变更** 如下接口: - ```ts function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback): void; function deleteRdbStoreV9(context: Context, name: string): Promise; @@ -108,7 +106,7 @@ function deleteRdbStoreV9(context: Context, name: string): Promise; ## cl.distributeddatamgr.4 interface StoreConfigV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts **变更影响** -StoreConfigV9接口标记废弃,应用需要进行适配。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 **关键的接口/组件变更** interface StoreConfigV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface StoreConfig。 @@ -119,7 +117,7 @@ interface StoreConfigV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalSto ## cl.distributeddatamgr.5 enum SecurityLevel 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts **变更影响** -SecurityLevel接口标记废弃,应用需要进行适配。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 **关键的接口/组件变更** enum SecurityLevel 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts。 @@ -130,7 +128,7 @@ enum SecurityLevel 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.t ## cl.distributeddatamgr.6 interface RdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts **变更影响** -RdbStoreV9接口标记废弃,应用需要进行适配。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 **关键的接口/组件变更** interface RdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface RdbStore。 @@ -141,7 +139,7 @@ interface RdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore. ## cl.distributeddatamgr.7 class RdbPredicatesV9 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts **变更影响** -RdbPredicatesV9接口标记废弃,应用需要进行适配。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 **关键的接口/组件变更** class RdbPredicatesV9 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface RdbPredicates。 @@ -152,7 +150,7 @@ class RdbPredicatesV9 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore. ## cl.distributeddatamgr.8 interface ResultSetV9 从api/@ohos.data.relationalStore.d.ts 迁移至@ohos.data.relationalStore.d.ts **变更影响** -ResultSetV9接口标记废弃,应用需要进行适配。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 **关键的接口/组件变更** interface ResultSetV9 从api/data/rdb/resultSet.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface 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..6d04fd1b5c9263d0e91ba8d83ccc3bc536acf640 --- /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模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../OpenHarmony_3.2.8.1/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模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../OpenHarmony_3.2.8.1/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模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../OpenHarmony_3.2.8.1/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模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../OpenHarmony_3.2.8.1/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模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../OpenHarmony_3.2.8.1/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模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../OpenHarmony_3.2.8.1/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-media.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-media.md deleted file mode 100644 index 1d1fadf9dbee56c3538e4462ee7936a364ec4445..0000000000000000000000000000000000000000 --- a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-media.md +++ /dev/null @@ -1,312 +0,0 @@ -# 媒体子系统ChangeLog - -## cl.media.1 播放功能接口变更 - -新增音视频播放接口[AVPlayer](../../../application-dev/reference/apis/js-apis-media.md#avplayer9)9+, 升级了状态机和错误码,推荐用户使用。旧版音频播放接口[AudioPlayer](../../../application-dev/reference/apis/js-apis-media.md#audioplayer)6+和视频播放接口[VideoPlayer](../../../application-dev/reference/apis/js-apis-media.md#videoplayer)8+停止维护。 - -**变更影响** - -原有的接口暂时可继续使用,但是停止维护,建议使用新接口进行开发。 - -**关键的接口/组件变更** - -新增接口如下: - -| 类名 | 新增接口声明 | -| -------------- | ------------------------------------------------------------ | -| media | createAVPlayer(callback: AsyncCallback\): void | -| media | createAVPlayer() : Promise\ | -| media.AVPlayer | interface AVPlayer | -| media.AVPlayer | videoScaleType ?: VideoScaleType | -| media.AVPlayer | url ?: string | -| media.AVPlayer | surfaceId ?: string | -| media.AVPlayer | stop(callback: AsyncCallback\): void | -| media.AVPlayer | stop(): Promise\ | -| media.AVPlayer | setVolume(volume: number): void | -| media.AVPlayer | setSpeed(speed: PlaybackSpeed): void | -| media.AVPlayer | setBitrate(bitrate: number): void | -| media.AVPlayer | seek(timeMs: number, mode?:SeekMode): void | -| media.AVPlayer | reset(callback: AsyncCallback\): void | -| media.AVPlayer | reset(): Promise\ | -| media.AVPlayer | release(callback: AsyncCallback\): void | -| media.AVPlayer | release(): Promise\ | -| media.AVPlayer | readonly width: number | -| media.AVPlayer | readonly state: AVPlayerState | -| media.AVPlayer | readonly height: number | -| media.AVPlayer | readonly duration: number | -| media.AVPlayer | readonly currentTime: number | -| media.AVPlayer | prepare(callback: AsyncCallback\): void | -| media.AVPlayer | prepare(): Promise\ | -| media.AVPlayer | play(callback: AsyncCallback\): void | -| media.AVPlayer | play(): Promise\ | -| media.AVPlayer | pause(callback: AsyncCallback\): void | -| media.AVPlayer | pause(): Promise\ | -| media.AVPlayer | on(type: 'volumeChange', callback: Callback\): void | -| media.AVPlayer | on(type: 'videoSizeChange', callback: (width: number, height: number) => void): void | -| media.AVPlayer | on(type: 'timeUpdate', callback: Callback\): void | -| media.AVPlayer | on(type: 'stateChange', callback: (state: AVPlayerState, reason: StateChangeReason) => void): void | -| media.AVPlayer | on(type: 'startRenderFrame', callback: Callback\): void | -| media.AVPlayer | on(type: 'speedDone', callback: Callback\): void | -| media.AVPlayer | on(type: 'seekDone', callback: Callback\): void | -| media.AVPlayer | on(type: 'error', callback: ErrorCallback): void | -| media.AVPlayer | on(type: 'endOfStream', callback: Callback\): void | -| media.AVPlayer | on(type: 'durationUpdate', callback: Callback\): void | -| media.AVPlayer | on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void | -| media.AVPlayer | on(type: 'bitrateDone', callback: Callback\): void | -| media.AVPlayer | on(type: 'availableBitrates', callback: (bitrates: Array\) => void): void | -| media.AVPlayer | on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void | -| media.AVPlayer | off(type: 'volumeChange'): void | -| media.AVPlayer | off(type: 'videoSizeChange'): void | -| media.AVPlayer | off(type: 'timeUpdate'): void | -| media.AVPlayer | off(type: 'stateChange'): void | -| media.AVPlayer | off(type: 'startRenderFrame'): void | -| media.AVPlayer | off(type: 'speedDone'): void | -| media.AVPlayer | off(type: 'seekDone'): void | -| media.AVPlayer | off(type: 'error'): void | -| media.AVPlayer | off(type: 'endOfStream'): void | -| media.AVPlayer | off(type: 'durationUpdate'): void | -| media.AVPlayer | off(type: 'bufferingUpdate'): void | -| media.AVPlayer | off(type: 'bitrateDone'): void | -| media.AVPlayer | off(type: 'availableBitrates'): void | -| media.AVPlayer | off(type: 'audioInterrupt'): void | -| media.AVPlayer | loop: boolean | -| media.AVPlayer | getTrackDescription(callback: AsyncCallback\>): void | -| media.AVPlayer | getTrackDescription() : Promise\> | -| media.AVPlayer | fdSrc ?: AVFileDescriptor | -| media.AVPlayer | audioInterruptMode ?: audio.InterruptMode | -| unnamed | type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error' | - -停止维护接口如下: - -| 类名 | 停止维护接口声明 | -| ----------------- | ------------------------------------------------------------ | -| media | createVideoPlayer(callback: AsyncCallback\): void | -| media | createVideoPlayer() : Promise\ | -| media | createAudioPlayer(): AudioPlayer | -| media.AudioPlayer | interface AudioPlayer | -| media.AudioPlayer | play(): void | -| media.AudioPlayer | release(): void | -| media.AudioPlayer | audioInterruptMode ?: audio.InterruptMode | -| media.AudioPlayer | fdSrc: AVFileDescriptor | -| media.AudioPlayer | seek(timeMs: number): void | -| media.AudioPlayer | readonly duration: number | -| media.AudioPlayer | loop: boolean | -| media.AudioPlayer | readonly state: AudioState | -| media.AudioPlayer | getTrackDescription(callback: AsyncCallback\>): void | -| media.AudioPlayer | getTrackDescription() : Promise\> | -| media.AudioPlayer | on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void | -| media.AudioPlayer | on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void | -| media.AudioPlayer | on(type: 'timeUpdate', callback: Callback\): void | -| media.AudioPlayer | on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void | -| media.AudioPlayer | on(type: 'error', callback: ErrorCallback): void | -| media.AudioPlayer | setVolume(vol: number): void | -| media.AudioPlayer | pause(): void | -| media.AudioPlayer | readonly currentTime: number | -| media.AudioPlayer | stop(): void | -| media.AudioPlayer | reset(): void | -| media.AudioPlayer | src: string | -| media.VideoPlayer | interface VideoPlayer | -| media.VideoPlayer | play(callback: AsyncCallback\): void | -| media.VideoPlayer | play(): Promise\ | -| media.VideoPlayer | prepare(callback: AsyncCallback\): void | -| media.VideoPlayer | prepare(): Promise\ | -| media.VideoPlayer | release(callback: AsyncCallback\): void | -| media.VideoPlayer | release(): Promise\ | -| media.VideoPlayer | audioInterruptMode ?: audio.InterruptMode | -| media.VideoPlayer | fdSrc: AVFileDescriptor | -| media.VideoPlayer | seek(timeMs: number, callback: AsyncCallback\): void | -| media.VideoPlayer | seek(timeMs: number, mode:SeekMode, callback: AsyncCallback\): void | -| media.VideoPlayer | seek(timeMs: number, mode?:SeekMode): Promise\ | -| media.VideoPlayer | readonly duration: number | -| media.VideoPlayer | loop: boolean | -| media.VideoPlayer | videoScaleType ?: VideoScaleType | -| media.VideoPlayer | readonly state: VideoPlayState | -| media.VideoPlayer | getTrackDescription(callback: AsyncCallback\>): void | -| media.VideoPlayer | getTrackDescription() : Promise\> | -| media.VideoPlayer | readonly height: number | -| media.VideoPlayer | on(type: 'playbackCompleted', callback: Callback\): void | -| media.VideoPlayer | on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void | -| media.VideoPlayer | on(type: 'startRenderFrame', callback: Callback\): void | -| media.VideoPlayer | on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void | -| media.VideoPlayer | on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void | -| media.VideoPlayer | on(type: 'error', callback: ErrorCallback): void | -| media.VideoPlayer | setDisplaySurface(surfaceId: string, callback: AsyncCallback\): void | -| media.VideoPlayer | setDisplaySurface(surfaceId: string): Promise\ | -| media.VideoPlayer | setVolume(vol: number, callback: AsyncCallback\): void | -| media.VideoPlayer | setVolume(vol: number): Promise\ | -| media.VideoPlayer | url: string | -| media.VideoPlayer | pause(callback: AsyncCallback\): void | -| media.VideoPlayer | pause(): Promise\ | -| media.VideoPlayer | readonly currentTime: number | -| media.VideoPlayer | setSpeed(speed:number, callback: AsyncCallback\): void | -| media.VideoPlayer | setSpeed(speed:number): Promise\ | -| media.VideoPlayer | stop(callback: AsyncCallback\): void | -| media.VideoPlayer | stop(): Promise\ | -| media.VideoPlayer | readonly width: number | -| media.VideoPlayer | reset(callback: AsyncCallback\): void | -| media.VideoPlayer | reset(): Promise\ | -| unnamed | type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error' | -| unnamed | type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error' | - -**适配指导** - -请参考各接口的[API参考](../../../application-dev/reference/apis/js-apis-media.md) - -## cl.media.2 录制功能接口变更 - -新增音视频录制接口[AVRecorder](../../../application-dev/reference/apis/js-apis-media.md#avrecorder9)9+, 升级了状态机和错误码,推荐用户使用。旧版音频录制接口[AudioRecorder](../../../application-dev/reference/apis/js-apis-media.md#audiorecorder)6+和视频录制接口[VideoRecorder](../../../application-dev/reference/apis/js-apis-media.md#videorecorder9)9+停止维护。 - -新旧录制接口共用的[AudioSourceType](../../../application-dev/reference/apis/js-apis-media.md#audiosourcetype9)和[VideoSourceType](../../../application-dev/reference/apis/js-apis-media.md#videosourcetype9)接口,变更为非系统接口。 - -**变更影响** - -原有的接口[AudioRecorder](../../../application-dev/reference/apis/js-apis-media.md#audiorecorder)6+和[VideoRecorder](../../../application-dev/reference/apis/js-apis-media.md#videorecorder9)9+暂时可继续使用,但是停止维护,建议使用新接口进行开发[AVRecorder](../../../application-dev/reference/apis/js-apis-media.md#avrecorder9)9+。 - -**关键的接口/组件变更** - -新增接口如下: - -| 类名 | 新增接口声明 | -| ----------------------- | ------------------------------------------------------------ | -| media | createAVRecorder(callback: AsyncCallback\): void | -| media | createAVRecorder() : Promise\ | -| media.AVRecorder | interface AVRecorder | -| media.AVRecorder | prepare(config: AVRecorderConfig, callback: AsyncCallback\): void | -| media.AVRecorder | prepare(config: AVRecorderConfig): Promise\ | -| media.AVRecorder | release(callback: AsyncCallback\): void | -| media.AVRecorder | release(): Promise\ | -| media.AVRecorder | readonly state: AVRecorderState | -| media.AVRecorder | on(type: 'stateChange', callback: (state: AVRecorderState, reason: StateChangeReason) => void): void | -| media.AVRecorder | on(type: 'error', callback: ErrorCallback): void | -| media.AVRecorder | resume(callback: AsyncCallback\): void | -| media.AVRecorder | resume(): Promise\ | -| media.AVRecorder | start(callback: AsyncCallback\): void | -| media.AVRecorder | start(): Promise\ | -| media.AVRecorder | off(type: 'stateChange'): void | -| media.AVRecorder | off(type: 'error'): void | -| media.AVRecorder | pause(callback: AsyncCallback\): void | -| media.AVRecorder | pause(): Promise\ | -| media.AVRecorder | stop(callback: AsyncCallback\): void | -| media.AVRecorder | stop(): Promise\ | -| media.AVRecorder | reset(callback: AsyncCallback\): void | -| media.AVRecorder | reset(): Promise\ | -| media.AVRecorder | getInputSurface(callback: AsyncCallback\): void | -| media.AVRecorder | getInputSurface(): Promise\ | -| media.AVRecorderConfig | videoSourceType?: VideoSourceType | -| media.AVRecorderConfig | audioSourceType?: AudioSourceType | -| media.AVRecorderConfig | profile: AVRecorderProfile | -| media.AVRecorderConfig | rotation?: number | -| media.AVRecorderConfig | url: string | -| media.AVRecorderConfig | location?: Location | -| media.AVRecorderConfig | interface AVRecorderConfig | -| media.AVRecorderProfile | videoBitrate?: number | -| media.AVRecorderProfile | videoCodec?: CodecMimeType | -| media.AVRecorderProfile | audioCodec?: CodecMimeType | -| media.AVRecorderProfile | videoFrameRate?: number | -| media.AVRecorderProfile | videoFrameHeight?: number | -| media.AVRecorderProfile | audioSampleRate?: number | -| media.AVRecorderProfile | audioBitrate?: number | -| media.AVRecorderProfile | videoFrameWidth?: number | -| media.AVRecorderProfile | audioChannels?: number | -| media.AVRecorderProfile | fileFormat: ContainerFormatType | -| media.AVRecorderProfile | interface AVRecorderProfile | -| unnamed | type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error' | - -停止维护接口如下: - -| 类名 | 停止维护接口声明 | -| -------------------------- | ------------------------------------------------------------ | -| media | createVideoRecorder(callback: AsyncCallback\): void | -| media | createVideoRecorder(): Promise\ | -| media | createAudioRecorder(): AudioRecorder | -| media.AudioRecorder | interface AudioRecorder | -| media.AudioRecorder | prepare(config: AudioRecorderConfig): void | -| media.AudioRecorder | release(): void | -| media.AudioRecorder | on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void | -| media.AudioRecorder | on(type: 'error', callback: ErrorCallback): void | -| media.AudioRecorder | resume(): void | -| media.AudioRecorder | start(): void | -| media.AudioRecorder | pause(): void | -| media.AudioRecorder | stop(): void | -| media.AudioRecorder | reset(): void | -| media.AudioRecorderConfig | audioSampleRate?: number | -| media.AudioRecorderConfig | location?: Location | -| media.AudioRecorderConfig | fileFormat?: ContainerFormatType | -| media.AudioRecorderConfig | interface AudioRecorderConfig | -| media.AudioRecorderConfig | audioEncoder?: AudioEncoder | -| media.AudioRecorderConfig | audioEncodeBitRate?: number | -| media.AudioRecorderConfig | numberOfChannels?: number | -| media.AudioRecorderConfig | format?: AudioOutputFormat | -| media.AudioRecorderConfig | uri: string | -| media.AudioRecorderConfig | audioEncoderMime?: CodecMimeType | -| media.VideoRecorder | interface VideoRecorder | -| media.VideoRecorder | prepare(config: VideoRecorderConfig, callback: AsyncCallback\): void | -| media.VideoRecorder | prepare(config: VideoRecorderConfig): Promise\ | -| media.VideoRecorder | release(callback: AsyncCallback\): void | -| media.VideoRecorder | release(): Promise\ | -| media.VideoRecorder | readonly state: VideoRecordState | -| media.VideoRecorder | on(type: 'error', callback: ErrorCallback): void | -| media.VideoRecorder | resume(callback: AsyncCallback\): void | -| media.VideoRecorder | resume(): Promise\ | -| media.VideoRecorder | start(callback: AsyncCallback\): void | -| media.VideoRecorder | start(): Promise\ | -| media.VideoRecorder | pause(callback: AsyncCallback\): void | -| media.VideoRecorder | pause(): Promise\ | -| media.VideoRecorder | stop(callback: AsyncCallback\): void | -| media.VideoRecorder | stop(): Promise\ | -| media.VideoRecorder | reset(callback: AsyncCallback\): void | -| media.VideoRecorder | reset(): Promise\ | -| media.VideoRecorder | getInputSurface(callback: AsyncCallback\): void | -| media.VideoRecorder | getInputSurface(): Promise\ | -| media.VideoRecorderConfig | videoSourceType: VideoSourceType | -| media.VideoRecorderConfig | audioSourceType?: AudioSourceType | -| media.VideoRecorderConfig | profile: VideoRecorderProfile | -| media.VideoRecorderConfig | rotation?: number | -| media.VideoRecorderConfig | url: string | -| media.VideoRecorderConfig | location?: Location | -| media.VideoRecorderConfig | interface VideoRecorderConfig | -| media.VideoRecorderProfile | readonly videoBitrate: number | -| media.VideoRecorderProfile | readonly videoCodec: CodecMimeType | -| media.VideoRecorderProfile | readonly audioCodec: CodecMimeType | -| media.VideoRecorderProfile | readonly videoFrameRate: number | -| media.VideoRecorderProfile | readonly videoFrameHeight: number | -| media.VideoRecorderProfile | readonly audioSampleRate: number | -| media.VideoRecorderProfile | readonly audioBitrate: number | -| media.VideoRecorderProfile | readonly videoFrameWidth: number | -| media.VideoRecorderProfile | readonly audioChannels: number | -| media.VideoRecorderProfile | readonly fileFormat: ContainerFormatType | -| media.VideoRecorderProfile | interface VideoRecorderProfile | -| unnamed | type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error' | - -变更接口如下: - -| 类名 | 接口声明 | 变更前能力 | 变更后能力 | 变更前是否为系统接口 | 变更后是否为系统接口 | -| --------------------- | ------------------------------------------------------------ | ----------------------------------------------- | -------------------------------------------- | -------------------- | -------------------- | -| media.AudioSourceType | enum AudioSourceType { /** * default audio source type. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ AUDIO_SOURCE_TYPE_DEFAULT = 0, /** * source type mic. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ AUDIO_SOURCE_TYPE_MIC = 1, } | SystemCapability.Multimedia.Media.VideoRecorder | SystemCapability.Multimedia.Media.AVRecorder | 是 | 否 | -| media.VideoSourceType | enum VideoSourceType { /** * surface raw data. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ VIDEO_SOURCE_TYPE_SURFACE_YUV = 0, /** * surface ES data. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ VIDEO_SOURCE_TYPE_SURFACE_ES = 1, } | SystemCapability.Multimedia.Media.VideoRecorder | SystemCapability.Multimedia.Media.AVRecorder | 是 | 否 | - -**适配指导** - -请参考各接口的[API参考](../../../application-dev/reference/apis/js-apis-media.md) - -## cl.media.3 错误码变更 - -新增标准的错误枚举类型[AVErrorCode9](../../../application-dev/reference/apis/js-apis-media.md#averrorcode)9+替代原有错误枚举类型[MediaErrorCode](../../../application-dev/reference/apis/js-apis-media.md#mediaerrorcode)8+。 - -**变更影响** - -以往接口返回错误码枚举类型为[MediaErrorCode](../../../application-dev/reference/apis/js-apis-media.md#mediaerrorcode)8+不变。新增接口错误码类型均采用[AVErrorCode9](../../../application-dev/reference/apis/js-apis-media.md#averrorcode)9+。 - -**关键的接口/组件变更** - -新增接口如下: - -| 类名 | 新增错误码声明 | -| ----------------- | ------------------------------------------------------------ | -| media.AVErrorCode | enum AVErrorCode { /** * operation success. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_OK = 0, /** * permission denied. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_NO_PERMISSION = 201, /** * invalid parameter. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_INVALID_PARAMETER = 401, /** * the api is not supported in the current version * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_UNSUPPORT_CAPABILITY = 801, /** * the system memory is insufficient or the number of services reaches the upper limit * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_NO_MEMORY = 5400101, /** * current status does not allow or do not have permission to perform this operation * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_OPERATE_NOT_PERMIT = 5400102, /** * data flow exception information * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_IO = 5400103, /** * system or network response timeout. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_TIMEOUT = 5400104, /** * service process died. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_SERVICE_DIED = 5400105, /** * unsupported media format * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_UNSUPPORT_FORMAT = 5400106, } | - -停止维护接口如下: - -| 类名 | 停止维护错误码声明 | -| -------------------- | ------------------------------------------------------------ | -| media.MediaErrorCode | enum MediaErrorCode { /** * operation success. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_OK = 0, /** * malloc or new memory failed. maybe system have no memory. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_NO_MEMORY = 1, /** * no permission for the operation. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_OPERATION_NOT_PERMIT = 2, /** * invalid argument. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_INVALID_VAL = 3, /** * an I/O error occurred. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_IO = 4, /** * operation time out. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_TIMEOUT = 5, /** * unknown error. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_UNKNOWN = 6, /** * media service died. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_SERVICE_DIED = 7, /** * operation is not permit in current state. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_INVALID_STATE = 8, /** * operation is not supported in current version. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_UNSUPPORTED = 9, } | \ 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-nfc.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-nfc.md new file mode 100644 index 0000000000000000000000000000000000000000..506de8014aa3d4ea26c6a36c63e51eaa133e1499 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-nfc.md @@ -0,0 +1,61 @@ +# 公共通信子系统NFC JS API变更Changelog + +OpenHarmony 3.2.10.2(Mr)版本相较于OpenHarmony 3.2.beta4版本,分布式数据管理子系统的API变更如下 + +## cl.nfc.1 接口变更 +NFC部分API6到API8部分JS接口不支持抛出错误码,需要删除废弃,然后使用新的API9替换。 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响部分API6到API8部分JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| api/@ohos.nfc.cardEmulation.d.ts | cardEmulation | FeatureType | 废弃 | +| api/@ohos.nfc.cardEmulation.d.ts | cardEmulation | isSupported | 废弃 | +| api/@ohos.nfc.cardEmulation.d.ts | cardEmulation | hasHceCapability | 新增 | +| api/@ohos.nfc.controller.d.ts | nfcController | isNfcAvailable | 废弃 | +| api/@ohos.nfc.controller.d.ts | nfcController | openNfc | 废弃 | +| api/@ohos.nfc.controller.d.ts | nfcController | closeNfc | 废弃 | +| api/@ohos.nfc.controller.d.ts | nfcController | enableNfc | 新增 | +| api/@ohos.nfc.controller.d.ts | nfcController | disableNfc | 新增 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcATag | 废弃 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcBTag | 废弃 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcFTag | 废弃 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcVTag | 废弃 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcA | 新增 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcB | 新增 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcF | 新增 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcV | 新增 | +| api/tag/tagSession.d.ts | TagSession | getTagInfo | 废弃 | +| api/tag/tagSession.d.ts | TagSession | connectTag | 废弃 | +| api/tag/tagSession.d.ts | TagSession | reset | 废弃 | +| api/tag/tagSession.d.ts | TagSession | isTagConnected | 废弃 | +| api/tag/tagSession.d.ts | TagSession | setSendDataTimeout | 废弃 | +| api/tag/tagSession.d.ts | TagSession | getSendDataTimeout | 废弃 | +| api/tag/tagSession.d.ts | TagSession | sendData | 废弃 | +| api/tag/tagSession.d.ts | TagSession | getMaxSendLength | 废弃 | +| api/tag/tagSession.d.ts | TagSession | connect | 新增 | +| api/tag/tagSession.d.ts | TagSession | resetConnection | 新增 | +| api/tag/tagSession.d.ts | TagSession | isConnected | 新增 | +| api/tag/tagSession.d.ts | TagSession | setTimeout | 新增 | +| api/tag/tagSession.d.ts | TagSession | getTimeout | 新增 | +| api/tag/tagSession.d.ts | TagSession | transmit | 新增 | +| api/tag/tagSession.d.ts | TagSession | getMaxTransmitSize | 新增 | + +**适配指导** + +查看API开发指南: +[cardEmulation-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md) + +[nfcController-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-nfcController.md) + +[tag-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md) + +[TagSession-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-tagSession.md) +``` + 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-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..c9ea0328d415ce1504c57eeabe79e3bb3dabcbc9 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-url.md @@ -0,0 +1,70 @@ +# 公共基础类库子系统JS API变更Changelog + +OpenHarmony 3.2.10.1(Mr)版本相较于OpenHarmony 3.2.beta4版本,url子系统的API变更如下 + +## 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