提交 3a6b4d5c 编写于 作者: N ningning

update changelog

Signed-off-by: Nningning <3248127340@qq.com>
上级 b95b1e1a
# 分布式数据管理子系统JS API变更Changelog
OpenHarmony 3.2.10.1(Mr)版本相较于OpenHarmony 3.2.beta4版本,分布式数据管理子系统的API变更如下
## cl.distributeddatamgr.1 接口变更
distributeddatamgr子系统kv_store组件接口存在变更:
由于执行时间固定且耗时短,不需要异步等待执行结果,createKVManager方法需要改为同步接口。因此旧的接口function createKVManager(config: KVManagerConfig): Promise\<KVManager\>; 与 function createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void; 改为 function createKVManager(config: KVManagerConfig): KVManager;
开发者需要根据以下说明对应用进行适配。
**变更影响**
影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。
**关键的接口/组件变更**
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| @ohos.distributedKVStore | distributedKVStore | function createKVManager(config: KVManagerConfig): Promise\<KVManager\>; | 删除 |
| @ohos.distributedKVStore | distributedKVStore | function createKVManager(config: KVManagerConfig): KVManager; | 变更 |
**适配指导**
应用中调用createKVManager创建KVManager对象实例可参考下列代码
Stage模型下的示例:
```ts
import AbilityStage from '@ohos.application.Ability'
let kvManager;
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage onCreate")
let context = this.context
const kvManagerConfig = {
context: context,
bundleName: 'com.example.datamanagertest',
}
try {
kvManager = distributedKVStore.createKVManager(kvManagerConfig);
} catch (e) {
console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`);
}
}
}
```
FA模型下的示例:
```ts
import featureAbility from '@ohos.ability.featureAbility'
let kvManager;
let context = featureAbility.getContext()
const kvManagerConfig = {
context: context,
bundleName: 'com.example.datamanagertest',
}
try {
kvManager = distributedKVStore.createKVManager(kvManagerConfig);
} catch (e) {
console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`);
}
```
## cl.distributeddatamgr.2 function getRdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts
**变更影响**
getRdbStoreV9接口标记废弃,应用需要进行适配。
**关键的接口/组件变更**
如下接口:
```ts
function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number, callback: AsyncCallback<RdbStoreV9>): void;
function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number): Promise<RdbStoreV9>;
```
从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts:
```
function getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback<RdbStore>): void;
function getRdbStore(context: Context, config: StoreConfig): Promise<RdbStore>;
```
**适配指导**
* `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`
* 按上述接口变更对齐修改所调用的方法名称即可。
## cl.distributeddatamgr.3 function deleteRdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts
**变更影响**
deleteRdbStoreV9接口标记废弃,应用需要进行适配。
**关键的接口/组件变更**
如下接口:
```ts
function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback<void>): void;
function deleteRdbStoreV9(context: Context, name: string): Promise<void>;
```
从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts:
```
function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback<void>): void;
function deleteRdbStoreV9(context: Context, name: string): Promise<void>;
```
**适配指导**
* `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`
* 按上述接口变更对齐修改所调用的方法名称即可。
## cl.distributeddatamgr.4 interface StoreConfigV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts
**变更影响**
StoreConfigV9接口标记废弃,应用需要进行适配。
**关键的接口/组件变更**
interface StoreConfigV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface StoreConfig。
**适配指导**
* `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`
* 按上述接口变更对齐修改所调用的接口名称即可。
## cl.distributeddatamgr.5 enum SecurityLevel 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts
**变更影响**
SecurityLevel接口标记废弃,应用需要进行适配。
**关键的接口/组件变更**
enum SecurityLevel 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts。
**适配指导**
* `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`
* 按上述接口变更对齐修改所调用的接口名称即可。
## cl.distributeddatamgr.6 interface RdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts
**变更影响**
RdbStoreV9接口标记废弃,应用需要进行适配。
**关键的接口/组件变更**
interface RdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface RdbStore。
**适配指导**
* `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`
* 按上述接口变更对齐修改所调用的接口名称即可。
## cl.distributeddatamgr.7 class RdbPredicatesV9 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts
**变更影响**
RdbPredicatesV9接口标记废弃,应用需要进行适配。
**关键的接口/组件变更**
class RdbPredicatesV9 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface RdbPredicates。
**适配指导**
* `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`
* 按上述接口变更对齐修改所调用的接口名称即可。
## cl.distributeddatamgr.8 interface ResultSetV9 从api/@ohos.data.relationalStore.d.ts 迁移至@ohos.data.relationalStore.d.ts
**变更影响**
ResultSetV9接口标记废弃,应用需要进行适配。
**关键的接口/组件变更**
interface ResultSetV9 从api/data/rdb/resultSet.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface ResultSet。
**适配指导**
* `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`
* ResultSetV9实例仅通过getRdbStoreV9方法获取,参考cl.distributeddatamgr.2变更后,代码可自动适配ResultSet。
## cl.multimedia.av_session.001 av_session所有接口更换为系统接口
所有av_session的接口变更为SystemApi。
**变更影响**
非系统应用无法调用系统接口,如调用方为非系统应用或未申请SystemApi相关权限,将无法调用接口。
**关键的接口/组件变更**
所有接口均变更为SystemApi,接口明细如下:
| 接口、枚举或变量名 | 类型 | 是否为SystemApi |
| -------- | -------- | ------- |
| SessionToken | interface | 是 |
| AVMetadata | interface | 是 |
| AVPlaybackState | interface | 是 |
| PlaybackPosition | interface | 是 |
| OutputDeviceInfo | interface | 是 |
| AVSessionDescriptor | interface | 是 |
| AVSessionController | interface | 是 |
| AVControlCommand | interface | 是 |
| createAVSession | function | 是 |
| getAllSessionDescriptors | function | 是 |
| createController | function | 是 |
| castAudio | function | 是 |
| on | function | 是 |
| off | function | 是 |
| sendSystemAVKeyEvent | function | 是 |
| sendSystemControlCommand | function | 是 |
| sessionId | variable | 是 |
| setAVMetadata | function | 是 |
| setAVPlaybackState | function | 是 |
| setLaunchAbility | function | 是 |
| getController | function | 是 |
| getOutputDevice | function | 是 |
| activate | function | 是 |
| deactivate | function | 是 |
| destroy | function | 是 |
| getAVPlaybackState | function | 是 |
| getAVMetadata | function | 是 |
| getOutputDevice | function | 是 |
| sendAVKeyEvent | function | 是 |
| getLaunchAbility | function | 是 |
| getRealPlaybackPositionSync | function | 是 |
| isActive | function | 是 |
| getValidCommands | function | 是 |
| sendControlCommand | function | 是 |
| AVSessionType | type | 是 |
| AVControlCommandType | type | 是 |
| LoopMode | enum | 是 |
| PlaybackState | enum | 是 |
| AVSessionErrorCode | enum | 是 |
# 媒体子系统 JS API 变更 Changelog
OpenHarmony3.2.10.3 相对 OpenHarmony3.2 Beta4 版本,媒体子系统 camera 部件 API 变更如下
## cl.subsystemname.1 camera 接口变更
1. camera 部件在 API9 版本全量改为 SystemAPI
2. 基于以下原因新增部分功能接口以及废弃部分接口:
提升开发者使用相机接口的便利。
帮助开发者快速掌握相机开发接口,快速投入到开发当中。
易于后续版本中框架功能的扩展,降低框架模块之间的耦合度。
具体参考下方变更内容,开发者需要根据以下说明对应用进行适配。
**变更影响**
影响 API9 版本的 JS 接口,应用需要进行适配才可以在新版本 SDK 环境正常实现功能。
**关键的接口/组件变更**
| 模块名 | 类名 | 方法/属性/枚举/常量 | 是否为 SystemApi | 变更类型 |
| ---------------------- | ----------------------- | ------------------------------------------------------------ | --------------- | -------- |
| ohos.multimedia.camera | camera | function getCameraManager(context: Context): CameraManager; | 是 | 新增 |
| ohos.multimedia.camera | camera | function getCameraManager(context: Context, callback: AsyncCallback<CameraManager>): void;<br/>function getCameraManager(context: Context): Promise<CameraManager>; | 是 | 废弃 |
| ohos.multimedia.camera | CameraErrorCode | INVALID_ARGUMENT = 7400101,<br/>OPERATION_NOT_ALLOWED = 7400102,<br/>SESSION_NOT_CONFIG = 7400103,<br/>SESSION_NOT_RUNNING = 7400104,<br/>SESSION_CONFIG_LOCKED = 7400105,<br/>DEVICE_SETTING_LOCKED = 7400106,<br/>CONFILICT_CAMERA = 7400107,<br/>DEVICE_DISABLED = 7400108,<br/>SERVICE_FATAL_ERROR = 7400201 | 是 | 新增 |
| ohos.multimedia.camera | CameraManager | getSupportedCameras(): Array<CameraDevice>;<br/>getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability;<br/>createCameraInput(camera: CameraDevice): CameraInput;<br/>createCameraInput(position: CameraPosition, type: CameraType): CameraInput;<br/>createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput;<br/>createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput;<br/>createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput;<br/>createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>): MetadataOutput;<br/>createCaptureSession(): CaptureSession; | 是 | 新增 |
| ohos.multimedia.camera | CameraManager | getSupportedCameras(callback: AsyncCallback<Array<CameraDevice>>): void;<br/>getSupportedCameras(): Promise<Array<CameraDevice>>;<br/>getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback<CameraOutputCapability>): void;<br/>getSupportedOutputCapability(camera: CameraDevice): Promise<CameraOutputCapability>;<br/>createCameraInput(camera: CameraDevice, callback: AsyncCallback<CameraInput>): void;<br/>createCameraInput(camera: CameraDevice): Promise<CameraInput>;<br/>createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback<CameraInput>): void;<br/>createCameraInput(position: CameraPosition, type: CameraType): Promise<CameraInput>;<br/>createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback<PreviewOutput>): void;<br/>createPreviewOutput(profile: Profile, surfaceId: string): Promise<PreviewOutput>;<br/>createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback<PhotoOutput>): void;<br/>createPhotoOutput(profile: Profile, surfaceId: string): Promise<PhotoOutput>;<br/>createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback<VideoOutput>): void;<br/>createVideoOutput(profile: VideoProfile, surfaceId: string): Promise<VideoOutput>;<br/>createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>, callback: AsyncCallback<MetadataOutput>): void;<br/>createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>): Promise<MetadataOutput>;<br/>createCaptureSession(callback: AsyncCallback<CaptureSession>): void;<br/>createCaptureSession(): Promise<CaptureSession>; | 是 | 废弃 |
| ohos.multimedia.camera | CameraType | CAMERA_TYPE_DEFAULT = 0 | 是 | 新增 |
| ohos.multimedia.camera | CameraType | CAMERA_TYPE_UNSPECIFIED = 0 | 是 | 废弃 |
| ohos.multimedia.camera | CameraInput | on(type: 'error', camera: CameraDevice, callback: ErrorCallback<BusinessError>): void; | 是 | 新增 |
| ohos.multimedia.camera | CameraInput | release(callback: AsyncCallback<void>): void;<br/>release(): Promise<void>;<br/>on(type: 'error', camera: CameraDevice, callback: ErrorCallback<CameraInputError>): void; | 是 | 废弃 |
| ohos.multimedia.camera | CameraInputErrorCode | ERROR_UNKNOWN = -1<br/>ERROR_NO_PERMISSION = 0<br/>ERROR_DEVICE_PREEMPTED = 1<br/>ERROR_DEVICE_DISCONNECTED = 2<br/>ERROR_DEVICE_IN_USE = 3<br/>ERROR_DRIVER_ERROR = 4 | 是 | 废弃 |
| ohos.multimedia.camera | CameraInputError | code: CameraInputErrorCode | 是 | 废弃 |
| ohos.multimedia.camera | CaptureSession | beginConfig(): void;<br/>addInput(cameraInput: CameraInput): void;<br/>removeInput(cameraInput: CameraInput): void;<br/>addOutput(cameraOutput: CameraOutput): void;<br/>removeOutput(cameraOutput: CameraOutput): void;<br/>hasFlash(): boolean;<br/>isFlashModeSupported(flashMode: FlashMode): boolean;<br/>getFlashMode(): FlashMode;<br/>setFlashMode(flashMode: FlashMode): void;<br/>isExposureModeSupported(aeMode: ExposureMode): boolean;<br/>getExposureMode(): ExposureMode;<br/>setExposureMode(aeMode: ExposureMode): void;<br/>getMeteringPoint(): Point;<br/>setMeteringPoint(point: Point): void;<br/>getExposureBiasRange(): Array<number>;<br/>setExposureBias(exposureBias: number): void;<br/>getExposureValue(): number;<br/>isFocusModeSupported(afMode: FocusMode): boolean;<br/>getFocusMode(): FocusMode;<br/>setFocusMode(afMode: FocusMode): void;<br/>setFocusPoint(point: Point): void;<br/>getFocusPoint(): Point;<br/>getFocalLength(): number;<br/>getZoomRatioRange(): Array<number>;<br/>getZoomRatio(): number;<br/>setZoomRatio(zoomRatio: number): void;<br/>isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean;<br/>getActiveVideoStabilizationMode(): VideoStabilizationMode;<br/>setVideoStabilizationMode(mode: VideoStabilizationMode): void;<br/>on(type: 'error', callback: ErrorCallback<BusinessError>): void; | 是 | 新增 |
| ohos.multimedia.camera | CaptureSession | beginConfig(callback: AsyncCallback<void>): void;<br/>beginConfig(): Promise<void>;<br/>addInput(cameraInput: CameraInput, callback: AsyncCallback<void>): void;<br/>addInput(cameraInput: CameraInput): Promise<void>;<br/>removeInput(cameraInput: CameraInput, callback: AsyncCallback<void>): void;<br/>removeInput(cameraInput: CameraInput): Promise<void>;<br/>addOutput(cameraOutput: CameraOutput, callback: AsyncCallback<void>): void;<br/>addOutput(cameraOutput: CameraOutput): Promise<void>;<br/>removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback<void>): void;<br/>removeOutput(cameraOutput: CameraOutput): Promise<void>;<br/>hasFlash(callback: AsyncCallback<boolean>): void;<br/>hasFlash(): Promise<boolean>;<br/>isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback<boolean>): void;<br/>isFlashModeSupported(flashMode: FlashMode): Promise<boolean>;<br/>getFlashMode(callback: AsyncCallback<FlashMode>): void;<br/>getFlashMode(): Promise<FlashMode>;<br/>setFlashMode(flashMode: FlashMode, callback: AsyncCallback<void>): void;<br/>setFlashMode(flashMode: FlashMode): Promise<void>;<br/>isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback<boolean>): void;<br/>isExposureModeSupported(aeMode: ExposureMode): Promise<boolean>;<br/>getExposureMode(callback: AsyncCallback<ExposureMode>): void;<br/>getExposureMode(): Promise<ExposureMode>;<br/>setExposureMode(aeMode: ExposureMode, callback: AsyncCallback<void>): void;<br/>setExposureMode(aeMode: ExposureMode): Promise<void>;<br/>getMeteringPoint(callback: AsyncCallback<Point>): void;<br/>getMeteringPoint(): Promise<Point>;<br/>setMeteringPoint(point: Point, callback: AsyncCallback<void>): void;<br/>setMeteringPoint(point: Point): Promise<void>;<br/>getExposureBiasRange(callback: AsyncCallback<Array<number>>): void;<br/>getExposureBiasRange(): Promise<Array<number>>;<br/>setExposureBias(exposureBias: number, callback: AsyncCallback<void>): void;<br/>setExposureBias(exposureBias: number): Promise<void>;<br/>getExposureValue(callback: AsyncCallback<number>): void;<br/>getExposureValue(): Promise<number>;<br/>isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback<boolean>): void;<br/>isFocusModeSupported(afMode: FocusMode): Promise<boolean>;<br/>getFocusMode(callback: AsyncCallback<FocusMode>): void;<br/>getFocusMode(): Promise<FocusMode>;<br/>setFocusMode(afMode: FocusMode, callback: AsyncCallback<void>): void;<br/>setFocusMode(afMode: FocusMode): Promise<void>;<br/>setFocusPoint(point: Point, callback: AsyncCallback<void>): void;<br/>setFocusPoint(point: Point): Promise<void>;<br/>getFocusPoint(callback: AsyncCallback<Point>): void;<br/>getFocusPoint(): Promise<Point>;<br/>getFocalLength(callback: AsyncCallback<number>): void;<br/>getFocalLength(): Promise<number>;<br/>getZoomRatioRange(callback: AsyncCallback<Array<number>>): void;<br/>getZoomRatioRange(): Promise<Array<number>>;<br/>getZoomRatio(callback: AsyncCallback<number>): void;<br/>getZoomRatio(): Promise<number>;<br/>setZoomRatio(zoomRatio: number, callback: AsyncCallback<void>): void;<br/>setZoomRatio(zoomRatio: number): Promise<void>;<br/>isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback<boolean>): void;<br/>isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise<boolean>;<br/>getActiveVideoStabilizationMode(callback: AsyncCallback<VideoStabilizationMode>): void;<br/>getActiveVideoStabilizationMode(): Promise<VideoStabilizationMode>;<br/>setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback<void>): void;<br/>setVideoStabilizationMode(mode: VideoStabilizationMode): Promise<void>;<br/>on(type: 'error', callback: ErrorCallback<CaptureSessionError>): void; | 是 | 废弃 |
| ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_UNKNOWN = -1<br/>ERROR_INSUFFICIENT_RESOURCES = 0<br/>ERROR_TIMEOUT = 1 | 是 | 废弃 |
| ohos.multimedia.camera | CaptureSessionError | code: CaptureSessionErrorCode | 是 | 废弃 |
| ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback<BusinessError>): void; | 是 | 新增 |
| ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback<PreviewOutputError>): void; | 是 | 废弃 |
| ohos.multimedia.camera | PreviewOutputErrorCode | ERROR_UNKNOWN = -1 | 是 | 废弃 |
| ohos.multimedia.camera | PreviewOutputError | code: PreviewOutputErrorCode | 是 | 废弃 |
| ohos.multimedia.camera | PhotoOutput | capture(): Promise<void>;<br/>isMirrorSupported(): boolean;<br/>on(type: 'error', callback: ErrorCallback<BusinessError>): void; | 是 | 新增 |
| ohos.multimedia.camera | PhotoOutput | isMirrorSupported(callback: AsyncCallback<boolean>): void;<br/>isMirrorSupported(): Promise<boolean>;<br/>on(type: 'error', callback: ErrorCallback<PhotoOutputError>): void; | 是 | 废弃 |
| ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_UNKNOWN = -1<br/>ERROR_DRIVER_ERROR = 0<br/>ERROR_INSUFFICIENT_RESOURCES = 1<br/>ERROR_TIMEOUT = 2 | 是 | 废弃 |
| ohos.multimedia.camera | PhotoOutputError | code: PhotoOutputErrorCode | 是 | 废弃 |
| ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback<BusinessError>): void; | 是 | 新增 |
| ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback<VideoOutputError>): void; | 是 | 废弃 |
| ohos.multimedia.camera | VideoOutputErrorCode | ERROR_UNKNOWN = -1<br/>ERROR_DRIVER_ERROR = 0 | 是 | 废弃 |
| ohos.multimedia.camera | VideoOutputError | code: VideoOutputErrorCode | 是 | 废弃 |
| ohos.multimedia.camera | MetadataObject | readonly type: MetadataObjectType;<br/>readonly timestamp: number; | 是 | 新增 |
| ohos.multimedia.camera | MetadataObject | getType(callback: AsyncCallback<MetadataObjectType>): void;<br/>getType(): Promise<MetadataObjectType>;<br/>getTimestamp(callback: AsyncCallback<number>): void;<br/>getTimestamp(): Promise<number>;<br/>getBoundingBox(callback: AsyncCallback<Rect>): void;<br/>getBoundingBox(): Promise<Rect>; | 是 | 废弃 |
| ohos.multimedia.camera | MetadataFaceObject | readonly boundingBox: Rect | 是 | 新增 |
| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback<BusinessError>): void; | 是 | 新增 |
| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback<BusinessError>): void; | 是 | 废弃 |
| ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_UNKNOWN = -1<br/>ERROR_INSUFFICIENT_RESOURCES = 0 | 是 | 废弃 |
| ohos.multimedia.camera | MetadataOutputError | code: MetadataOutputErrorCode | 是 | 废弃 |
**适配指导**
除新增接口,和废弃接口之外,开发者需要关注变更的接口的适配:
从 Beta4 版本开始,对以下接口进行调整:
**新增接口**
1. CameraErrorCode 枚举
枚举值名称:INVALID_ARGUMENT, 值:7400101;
枚举值名称:OPERATION_NOT_ALLOWED, 值:7400102;
枚举值名称:SESSION_NOT_CONFIG, 值:7400103;
枚举值名称:SESSION_NOT_RUNNING, 值:7400104;
枚举值名称:SESSION_CONFIG_LOCKED, 值:7400105;
枚举值名称:DEVICE_SETTING_LOCKED, 值:7400106;
枚举值名称:CONFILICT_CAMERA, 值:7400107;
枚举值名称:DEVICE_DISABLED, 值:7400108;
枚举值名称:SERVICE_FATAL_ERROR, 值:7400201;
2. PhotoOutput 接口新增 capture(): Promise<void>;
3. MetadataObject 接口中新增 readonly type: MetadataObjectType;
4. MetadataObject 接口中新增 readonly timestamp: number;
5. MetadataObject 接口中新增 readonly boundingBox: Rect;
**废弃接口**
1. CameraInput 中废弃接口 release(callback: AsyncCallback<void>): void; 以及 release(): Promise<void>;
2. 废弃枚举 CameraInputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_NO_PERMISSION = 0,ERROR_DEVICE_PREEMPTED = 1,ERROR_DEVICE_DISCONNECTED = 2,ERROR_DEVICE_IN_USE = 3,ERROR_DRIVER_ERROR = 4);
3. 废弃接口 CameraInputError 以及接口属性 code:CameraInputErrorCode;
4. 废弃枚举 CaptureSessionErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_INSUFFICIENT_RESOURCES = 0,ERROR_TIMEOUT = 1);
5. 废弃接口 CaptureSessionError 以及接口属性 code: CaptureSessionErrorCode;
6. 废弃枚举 PreviewOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1);
7. 废弃接口 PreviewOutputError 以及接口属性 code: PreviewOutputErrorCode;
8. 废弃枚举 PhotoOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_DRIVER_ERROR = 0,ERROR_INSUFFICIENT_RESOURCES = 1,ERROR_TIMEOUT = 2);
9. 废弃接口 PhotoOutputError 以及接口属性 code:PhotoOutputErrorCode;
10. 废弃枚举 VideoOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_DRIVER_ERROR = 0);
11. 废弃接口 VideoOutputError 以及接口属性 code:VideoOutputErrorCode;
12. 废弃接口 MetadataObject 中 getType(callback: AsyncCallback<MetadataObjectType>): void;
13. 废弃接口 MetadataObject 中 getType(): Promise<MetadataObjectType>;
14. 废弃接口 MetadataObject 中 getTimestamp(callback: AsyncCallback<number>): void;
15. 废弃接口 MetadataObject 中 getTimestamp(): Promise<number>;
16. 废弃接口 MetadataObject 中 getBoundingBox(callback: AsyncCallback<Rect>): void;
17. 废弃接口 MetadataObject 中 getBoundingBox(): Promise<Rect>;
18. 废弃枚举 MetadataOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_INSUFFICIENT_RESOURCES = 0);
19. 废弃接口 MetadataOutputError 以及接口属性 code:MetadataOutputErrorCode;
**接口变更**
1. camera 模块中接口 getCameraManager 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getCameraManager(context: Context, callback: AsyncCallback<CameraManager>): void; 以及 getCameraManager(context: Context): Promise<CameraManager>; 变更为 getCameraManager(context: Context): CameraManager;
参考代码如下:
```
let cameraManager = camera.getCameraManager(context);
```
2. CameraManager 中接口 getSupportedCameras 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getSupportedCameras(callback: AsyncCallback<Array<CameraDevice>>): void; 以及 getSupportedCameras(): Promise<Array<CameraDevice>>; 变更为 getSupportedCameras(): Array<CameraDevice>;
参考代码如下:
```
let cameras = cameraManager.getSupportedCameras();
```
3. CameraManager 中接口 getSupportedOutputCapability 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback<CameraOutputCapability>): void; 以及 getSupportedOutputCapability(camera: CameraDevice): Promise<CameraOutputCapability>; 变更为 getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability;
参考代码如下:
```
let cameraDevice = cameras[0];
let CameraOutputCapability = cameraManager.getSupportedOutputCapability(cameraDevice);
```
4. CameraManager 中接口 createCameraInput(camera: CameraDevice) 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createCameraInput(camera: CameraDevice, callback: AsyncCallback<CameraInput>): void; 以及 createCameraInput(camera: CameraDevice): Promise<CameraInput>; 变更为 createCameraInput(camera: CameraDevice): CameraInput;
参考代码如下:
```
let cameraDevice = cameras[0];
let cameraInput = cameraManager.createCameraInput(cameraDevice);
```
5. CameraManager 中接口 createCameraInput(position: CameraPosition, type: CameraType) 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback<CameraInput>): void; 以及 createCameraInput(position: CameraPosition, type: CameraType): Promise<CameraInput>; 变更为 createCameraInput(position: CameraPosition, type: CameraType): CameraInput;
参考代码如下:
```
let cameraDevice = cameras[0];
let position = cameraDevice.cameraPosition;
let type = cameraDevice.cameraType;
let cameraInput = cameraManager.createCameraInput(position, type);
```
6. CameraManager 中接口 createPreviewOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback<PreviewOutput>): void; 以及 createPreviewOutput(profile: Profile, surfaceId: string): Promise<PreviewOutput>; 变更为 createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput;
参考代码如下:
```
let profile = cameraoutputcapability.previewProfiles[0];
let previewOutput = cameraManager.createPreviewOutput(profile, surfaceId);
```
7. CameraManager 中接口 createPhotoOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback<PhotoOutput>): void; 以及 createPhotoOutput(profile: Profile, surfaceId: string): Promise<PhotoOutput>; 变更为 createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput;
参考代码如下:
```
let profile = cameraoutputcapability.photoProfiles[0];
let photoOutput = cameraManager.createPhotoOutput(profile, surfaceId);
```
8. CameraManager 中接口 createVideoOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback<VideoOutput>): void; 以及 createVideoOutput(profile: VideoProfile, surfaceId: string): Promise<VideoOutput>; 变更为 createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput;
参考代码如下:
```
let profile = cameraoutputcapability.videoProfiles[0];
let videoOutput = cameraManager.createVideoOutput(profile, surfaceId);
```
9. CameraManager 中接口 createMetadataOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>, callback: AsyncCallback<MetadataOutput>): void; 以及 createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>): Promise<MetadataOutput>; 变更为 createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>): MetadataOutput;
参考代码如下:
```
let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes;
let metadataOutput = cameraManager.createMetadataOutput(metadataObjectTypes);
```
10. CameraManager 中接口 createCaptureSession 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createCaptureSession(callback: AsyncCallback<CaptureSession>): void; 以及 createCaptureSession(): Promise<CaptureSession>; 变更为 createCaptureSession(): CaptureSession;
参考代码如下:
```
let captureSession = cameraManager.createCaptureSession();
```
11. 枚举 CameraType 中,枚举值名称 CAMERA_TYPE_UNSPECIFIED 变更为 CAMERA_TYPE_DEFAULT。
12. CameraInput 中,on 接口返回值类型由 CameraInputError 变更为 BusinessError,因此旧接口 on(type: 'error', camera: CameraDevice, callback: ErrorCallback<CameraInputError>): void; 变更为 on(type: 'error', camera: CameraDevice, callback: ErrorCallback<BusinessError>): void;
参考代码如下:
```
let cameraDevice = cameras[0];
cameraInput.on('error', cameraDevice, (BusinessError) => {
})
```
13. CaptureSession 中接口 beginConfig 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 beginConfig(callback: AsyncCallback<void>): void; 以及 beginConfig(): Promise<void>; 变更为 beginConfig(): void;
参考代码如下:
```
captureSession.beginConfig();
```
14. CaptureSession 中接口 addInput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 addInput(cameraInput: CameraInput, callback: AsyncCallback<void>): void; 以及 addInput(cameraInput: CameraInput): Promise<void>; 变更为 addInput(cameraInput: CameraInput): void;
参考代码如下:
```
captureSession.addInput(cameraInput);
```
15. CaptureSession 中接口 removeInput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 removeInput(cameraInput: CameraInput, callback: AsyncCallback<void>): void; 以及 removeInput(cameraInput: CameraInput): Promise<void>; 变更为 removeInput(cameraInput: CameraInput): void;
参考代码如下:
```
captureSession.removeInput(cameraInput);
```
16. CaptureSession 中接口 addOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 addOutput(cameraOutput: CameraOutput, callback: AsyncCallback<void>): void; 以及 addOutput(cameraOutput: CameraOutput): Promise<void>; 变更为 addOutput(cameraOutput: CameraOutput): void;
参考代码如下:
```
captureSession.addOutput(previewOutput);
```
17. CaptureSession 中接口 removeOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback<void>): void; 以及 removeOutput(cameraOutput: CameraOutput): Promise<void>; 变更为 removeOutput(cameraOutput: CameraOutput): void;
参考代码如下:
```
captureSession.removeOutput(previewOutput);
```
18. CaptureSession 中接口 hasFlash 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 hasFlash(callback: AsyncCallback<boolean>): void; 以及 hasFlash(): Promise<boolean>; 变更为 hasFlash(): boolean;
参考代码如下:
```
let status = captureSession.hasFlash();
```
19. CaptureSession 中接口 isFlashModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback<boolean>): void; 以及 isFlashModeSupported(flashMode: FlashMode): Promise<boolean>; 变更为 isFlashModeSupported(flashMode: FlashMode): boolean;
参考代码如下:
```
let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO);
```
20. CaptureSession 中接口 getFlashMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFlashMode(callback: AsyncCallback<FlashMode>): void; 以及 getFlashMode(): Promise<FlashMode>; 变更为 getFlashMode(): FlashMode;
参考代码如下:
```
let flashMode = captureSession.getFlashMode();
```
21. CaptureSession 中接口 isExposureModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback<boolean>): void; 以及 isExposureModeSupported(aeMode: ExposureMode): Promise<boolean>; 变更为 isExposureModeSupported(aeMode: ExposureMode): boolean;
参考代码如下:
```
let isSupported = captureSession.isExposureModeSupported(camera.ExposureMode.EXPOSURE_MODE_LOCKED);
```
22. CaptureSession 中接口 getExposureMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getExposureMode(callback: AsyncCallback<ExposureMode>): void; 以及 getExposureMode(): Promise<ExposureMode>; 变更为 getExposureMode(): ExposureMode;
参考代码如下:
```
let exposureMode = captureSession.getExposureMode();
```
23. CaptureSession 中接口 setExposureMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setExposureMode(aeMode: ExposureMode, callback: AsyncCallback<void>): void; 以及 setExposureMode(aeMode: ExposureMode): Promise<void>; 变更为 setExposureMode(aeMode: ExposureMode): void;
参考代码如下:
```
captureSession.setExposureMode(camera.ExposureMode.EXPOSURE_MODE_LOCKED);
```
24. CaptureSession 中接口 getMeteringPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getMeteringPoint(callback: AsyncCallback<Point>): void; 以及 getMeteringPoint(): Promise<Point>; 变更为 getMeteringPoint(): Point;
参考代码如下:
```
let exposurePoint = captureSession.getMeteringPoint();
```
25. CaptureSession 中接口 setMeteringPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setMeteringPoint(point: Point, callback: AsyncCallback<void>): void; 以及 setMeteringPoint(point: Point): Promise<void>; 变更为 setMeteringPoint(point: Point): void;
参考代码如下:
```
let Point2 = {x: 2, y: 2};
captureSession.setMeteringPoint(Point2);
```
26. CaptureSession 中接口 getExposureBiasRange 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getExposureBiasRange(callback: AsyncCallback<Array<number>>): void; 以及 getExposureBiasRange(): Promise<Array<number>>; 变更为 getExposureBiasRange(): Array<number>;
参考代码如下:
```
let biasRangeArray = captureSession.getExposureBiasRange();
```
27. CaptureSession 中接口 setExposureBias 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setExposureBias(exposureBias: number, callback: AsyncCallback<void>): void; 以及 setExposureBias(exposureBias: number): Promise<void>; 变更为 setExposureBias(exposureBias: number): void;
参考代码如下:
```
let exposureBias = biasRangeArray[0];
captureSession.setExposureBias(exposureBias);
```
28. CaptureSession 中接口 getExposureValue 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getExposureValue(callback: AsyncCallback<number>): void; 以及 getExposureValue(): Promise<number>; 变更为 getExposureValue(): number;
参考代码如下:
```
let exposureValue = captureSession.getExposureValue();
```
29. CaptureSession 中接口 isFocusModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback<boolean>): void; 以及 isFocusModeSupported(afMode: FocusMode): Promise<boolean>; 变更为 isFocusModeSupported(afMode: FocusMode): boolean;
参考代码如下:
```
let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO);
```
30. CaptureSession 中接口 getFocusMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFocusMode(callback: AsyncCallback<FocusMode>): void; 以及 getFocusMode(): Promise<FocusMode>; 变更为 getFocusMode(): FocusMode;
参考代码如下:
```
let afMode = captureSession.getFocusMode();
```
31. CaptureSession 中接口 setFocusMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setFocusMode(afMode: FocusMode, callback: AsyncCallback<void>): void; 以及 setFocusMode(afMode: FocusMode): Promise<void>; 变更为 setFocusMode(afMode: FocusMode): void;
参考代码如下:
```
captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_AUTO);
```
32. CaptureSession 中接口 setFocusPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setFocusPoint(point: Point, callback: AsyncCallback<void>): void; 以及 setFocusPoint(point: Point): Promise<void>; 变更为 setFocusPoint(point: Point): void;
参考代码如下:
```
let Point2 = {x: 2, y: 2};
captureSession.setFocusPoint(Point2);
```
33. CaptureSession 中接口 getFocusPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFocusPoint(callback: AsyncCallback<Point>): void; 以及 getFocusPoint(): Promise<Point>; 变更为 getFocusPoint(): Point;
参考代码如下:
```
let point = captureSession.getFocusPoint();
```
34. CaptureSession 中接口 getFocalLength 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFocalLength(callback: AsyncCallback<number>): void; 以及 getFocalLength(): Promise<number>; 变更为 getFocalLength(): number;
参考代码如下:
```
let focalLength = captureSession.getFocalLength();
```
35. CaptureSession 中接口 getZoomRatioRange 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getZoomRatioRange(callback: AsyncCallback<Array<number>>): void; 以及 getZoomRatioRange(): Promise<Array<number>>; 变更为 getZoomRatioRange(): Array<number>;
参考代码如下:
```
let zoomRatioRange = captureSession.getZoomRatioRange();
```
36. CaptureSession 中接口 getZoomRatio 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getZoomRatio(callback: AsyncCallback<number>): void; 以及 getZoomRatio(): Promise<number>; 变更为 getZoomRatio(): number;
参考代码如下:
```
let zoomRatio = captureSession.getZoomRatio();
```
37. CaptureSession 中接口 setZoomRatio 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setZoomRatio(zoomRatio: number, callback: AsyncCallback<void>): void; 以及 setZoomRatio(zoomRatio: number): Promise<void>; 变更为 setZoomRatio(zoomRatio: number): void;
参考代码如下:
```
let zoomRatio = zoomRatioRange[0];
captureSession.setZoomRatio(zoomRatio);
```
38. CaptureSession 中接口 isVideoStabilizationModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback<boolean>): void; 以及 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise<boolean>; 变更为 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean;
参考代码如下:
```
let isSupported = captureSession.isVideoStabilizationModeSupported(camera.VideoStabilizationMode.OFF);
```
39. CaptureSession 中接口 getActiveVideoStabilizationMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getActiveVideoStabilizationMode(callback: AsyncCallback<VideoStabilizationMode>): void; 以及 getActiveVideoStabilizationMode(): Promise<VideoStabilizationMode>; 变更为 getActiveVideoStabilizationMode(): VideoStabilizationMode;
参考代码如下:
```
let vsMode = captureSession.getActiveVideoStabilizationMode();
```
40. CaptureSession 中接口 setVideoStabilizationMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback<void>): void; 以及 setVideoStabilizationMode(mode: VideoStabilizationMode): Promise<void>; 变更为 setVideoStabilizationMode(mode: VideoStabilizationMode): void;
参考代码如下:
```
captureSession.setVideoStabilizationMode(camera.VideoStabilizationMode.OFF);
```
41. CaptureSession 中,on(type: 'error') callback 类型由 ErrorCallback<CaptureSessionError> 变更为 ErrorCallback<BusinessError>,因此旧接口 on(type: 'error', callback: ErrorCallback<CaptureSessionError>): void; 变更为 on(type: 'error', callback: ErrorCallback<BusinessError>): void;
参考代码如下:
```
captureSession.on('error', (BusinessError) => {
})
```
42. PreviewOutput 中,on(type: 'error') callback 类型由 ErrorCallback<PreviewOutputError> 变更为 ErrorCallback<BusinessError>,因此旧接口 on(type: 'error', callback: ErrorCallback<PreviewOutputError>): void; 变更为 on(type: 'error', callback: ErrorCallback<BusinessError>): void;
参考代码如下:
```
previewOutput.on('error', (BusinessError) => {
})
```
43. PhotoOutput 中接口 isMirrorSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isMirrorSupported(callback: AsyncCallback<boolean>): void; 以及 isMirrorSupported(): Promise<boolean>; 变更为 isMirrorSupported(): boolean;
参考代码如下:
```
let isSupported = photoOutput.isMirrorSupported();
```
44. PhotoOutput 中,on(type: 'error') callback 类型由 ErrorCallback<PhotoOutputError> 变更为 ErrorCallback<BusinessError>,因此旧接口 on(type: 'error', callback: ErrorCallback<PhotoOutputError>): void; 变更为 on(type: 'error', callback: ErrorCallback<BusinessError>): void;
参考代码如下:
```
PhotoOutput.on('error', (BusinessError) => {
})
```
45. VideoOutput 中,on(type: 'error') callback 类型由 ErrorCallback<VideoOutputError> 变更为 ErrorCallback<BusinessError>,因此旧接口 on(type: 'error', callback: ErrorCallback<VideoOutputError>): void; 变更为 on(type: 'error', callback: ErrorCallback<BusinessError>): void;
参考代码如下:
```
VideoOutput.on('error', (BusinessError) => {
})
```
46. MetadataOutput 中,on(type: 'error') callback 类型由 ErrorCallback<MetadataOutputError> 变更为 ErrorCallback<BusinessError>,因此旧接口 on(type: 'error', callback: ErrorCallback<MetadataOutputError>): void; 变更为 on(type: 'error', callback: ErrorCallback<BusinessError>): void;
参考代码如下:
```
MetadataOutput.on('error', (BusinessError) => {
})
```
\ No newline at end of file
# arkui子系统ChangeLog
## cl.arkui.1 状态变量数据类型声明使用限制。
1. 所有的状态装饰器变量需要显式声明变量类型,不允许声明any,不支持Date数据类型。
示例:
```ts
// xxx.ets
@Entry
@Component
struct DatePickerExample {
// 错误写法: @State isLunar: any = false
@State isLunar: boolean = false
// 错误写法: @State selectedDate: Date = new Date('2021-08-08')
private selectedDate: Date = new Date('2021-08-08')
build() {
Column() {
Button('切换公历农历')
.margin({ top: 30 })
.onClick(() => {
this.isLunar = !this.isLunar
})
DatePicker({
start: new Date('1970-1-1'),
end: new Date('2100-1-1'),
selected: this.selectedDate
})
.lunar(this.isLunar)
.onChange((value: DatePickerResult) => {
this.selectedDate.setFullYear(value.year, value.month, value.day)
console.info('select current date is: ' + JSON.stringify(value))
})
}.width('100%')
}
}
```
![datePicker](../../../application-dev/reference/arkui-ts/figures/datePicker.gif)
2. @State、@Provide、 @Link和@Consume四种状态变量的数据类型声明只能由简单数据类型或引用数据类型的其中一种构成。
类型定义中的Length、ResourceStr、ResourceColor三个类型是简单数据类型或引用数据类型的组合,所以不能被以上四种状态装饰器变量使用。
Length、ResourceStr、ResourceColor的定义请看文档[arkui-ts类型定义](../../../application-dev/reference/arkui-ts/ts-types.md)。
示例:
```ts
// xxx.ets
@Entry
@Component
struct IndexPage {
// 错误写法: @State message: string | Resource = 'Hello World'
@State message: string = 'Hello World'
// 错误写法: @State message: ResourceStr = $r('app.string.hello')
@State resourceStr: Resource = $r('app.string.hello')
build() {
Row() {
Column() {
Text(`${this.message}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
```
![hello](../../../application-dev/quick-start/figures/hello.PNG)
**变更影响**
1. 如果状态装饰器变量没有显式声明变量类型,声明any,编译拦截报错;
```ts
// ArkTS:ERROR Please define an explicit type, not any.
@State isLunar: any = false
```
2. 状态装饰器变量声明变量类型为Date,编译拦截报错;
```ts
// ArkTS:ERROR The @State property 'selectedDate' cannot be a 'Date' object.
@State selectedDate: Date = new Date('2021-08-08')
```
3. @State、@Provide、 @Link和@Consume四种状态变量使用框架提供的Length、ResourceStr、ResourceColor,
编译拦截报错。
```ts
/* ArkTS:ERROR The state variable type here is 'ResourceStr', it contains both a simple type and an object type,
which are not allowed to be defined for state variable of a struct.*/
@State message: ResourceStr = $r('app.string.hello')
```
**关键的接口/组件变更**
不涉及。
**适配指导**
1. 状态装饰器变量声明具体的变量类型替代any;
2. 使用Date对象的状态装饰器变量,修改为不加状态装饰器修饰的常规变量;
3. 因为Length(string|number|Resource), ResourceStr(string|Resource), ResourceColor(string|number|Color|Resource)
的三个类型是简单数据类型或引用数据类型的组合,使用@State、@Provide、 @Link和@Consume四种状态变量场景参考以下修改:
```ts
// 错误写法:
@State message: ResourceStr = $r('app.string.hello')
// 修正后的写法:
@State resourceStr: Resource = $r('app.string.hello')
```
## cl.arkui.2 自定义组件成员变量初始化的规则与约束。
通过构造函数方法初始化成员变量,需要遵循如下规则:
| **从父组件中的变量(右)到子组件中的变量(下)** | **regular** | **@State** | **@Link** | **@Prop** | **@Provide** | **@Consume** | **@ObjectLink** |
|---------------------------------|----------------------------|------------|-----------|-----------|--------------|--------------|------------------|
| **regular** | 支持 | 支持 | 支持 | 支持 | 不支持 | 不支持 | 支持 |
| **@State** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
| **@Link** | 不支持 | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) |
| **@Prop** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
| **@Provide** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 |
| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 |
| **从父组件中的变量(右)到子组件中的变量(下)** | **@StorageLink** | **@StorageProp** | **@LocalStorageLink** | **@LocalStorageProp** |
|------------------|------------------|------------------|-----------------------|------------------------|
| **regular** | 支持 | 不支持 | 不支持 | 不支持 |
| **@State** | 支持 | 支持 | 支持 | 支持 |
| **@Link** | 支持(1) | 支持(1) | 支持(1) | 支持(1) |
| **@Prop** | 支持 | 支持 | 支持 | 支持 |
| **@Provide** | 支持 | 支持 | 支持 | 支持 |
| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 |
| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 |
> **说明**
>
> **支持(1)**:必须使用`$`, 例如 `this.$varA`。
> **regular**:未加修饰的常规变量。
不允许从父组件初始化`@StorageLink`, `@StorageProp`, `@LocalStorageLink`, `@LocalStorageProp`修饰的变量。
**变更影响**
1. 不允许从父组件初始化`@LocalStorageLink`, `@LocalStorageProp`修饰的变量。
```ts
@Entry
@Component
struct LocalStorageComponent {
build() {
Column() {
Child({
/* ArkTS:ERROR Property 'simpleVarName' in the custom component 'Child' cannot
initialize here (forbidden to specify). */
simpleVarName: 1,
/* ArkTS:ERROR Property 'objectName' in the custom component 'Child' cannot
initialize here (forbidden to specify). */
objectName: new ClassA("x")
})
}
}
}
@Component
struct Child {
@LocalStorageLink("storageSimpleProp") simpleVarName: number = 0;
@LocalStorageProp("storageObjectProp") objectName: ClassA = new ClassA("x");
build() {}
}
```
2. 子组件的@ObjectLink变量不支持父组件装饰器变量的直接赋值,其父组件的源必须是数组的项或对象的属性,该数组或对象必现用`@State``@Link``@Provide``@Consume``@ObjectLink`装饰器修饰。
```ts
let NextID : number = 0;
@Observed class ClassA {
public id : number;
public c: number;
constructor(c: number) {
this.id = NextID++;
this.c = c;
}
}
@Component
struct Child {
@ObjectLink varA : ClassA;
build() {
Row() {
Text('ViewA-' + this.varA.id)
}
}
}
@Component
struct Parent {
@Link linkValue: ClassA
build() {
Column() {
/* ArkTS:ERROR The @Link property 'linkValue' cannot be assigned to
the @ObjectLink property 'varA'.*/
Child({ varA: this.linkValue })
}
}
}
```
**关键的接口/组件变更**
不涉及。
**适配指导**
1. 构造子组件时,不对子组件的`@LocalStorageLink`, `@LocalStorageProp`修饰的变量进行。
如果需要在父组件中修改子组件的`@LocalStorageLink`, `@LocalStorageProp`修饰的变量,则使用LocalStorage提供的API接口方法(比如set方法)赋值。
2. @ObjectLink的使用指导请参考文档[@ObjectLink使用指导](../../../application-dev/quick-start/arkts-state-mgmt-page-level.md)
# 包管理子系统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字段。
**变更影响**<br>
对使用API version 8及之前版本SDK的应用无影响,使用API version 9的应用需要适配新模块和新接口。
**关键的接口/组件变更**<br>
ApplicationInfo结构体发生变化的字段内容如下表所示。
| 删除 | API9新增或变更 | 类型 |
| --- | --- | --- |
| entryDir | 无 | string |
**适配指导**<br>
导入包管理查询的模块,在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字段。
**变更影响**<br>
对使用API version 8及之前版本SDK的应用无影响,使用API version 9的应用需要适配新模块和新接口。
**关键的接口/组件变更**<br>
HapModuleInfo结构体发生变化的字段内容如下表所示。
| 删除 | API9新增或变更 | 类型 |
| --- | --- | --- |
| moduleSourceDir | 无 | string |
**适配指导**<br>
导入包管理查询的模块,在API9 version的HapModuleInfo结构体时不能使用moduleSourceDir字段。使用了moduleSourceDir需要进行修改,该字段属于多余字段。
# 媒体子系统ChangeLog
## cl.media.1 播放功能接口变更
新增音视频播放接口[AVPlayer](../../../application-dev/reference/apis/js-apis-media.md#avplayer9)<sup>9+</sup>, 升级了状态机和错误码,推荐用户使用。旧版音频播放接口[AudioPlayer](../../../application-dev/reference/apis/js-apis-media.md#audioplayer)<sup>6+</sup>和视频播放接口[VideoPlayer](../../../application-dev/reference/apis/js-apis-media.md#videoplayer)<sup>8+</sup>停止维护。
**变更影响**
原有的接口暂时可继续使用,但是停止维护,建议使用新接口进行开发。
**关键的接口/组件变更**
新增接口如下:
| 类名 | 新增接口声明 |
| -------------- | ------------------------------------------------------------ |
| media | createAVPlayer(callback: AsyncCallback\<AVPlayer>): void |
| media | createAVPlayer() : Promise\<AVPlayer> |
| media.AVPlayer | interface AVPlayer |
| media.AVPlayer | videoScaleType ?: VideoScaleType |
| media.AVPlayer | url ?: string |
| media.AVPlayer | surfaceId ?: string |
| media.AVPlayer | stop(callback: AsyncCallback\<void>): void |
| media.AVPlayer | stop(): Promise\<void> |
| 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>): void |
| media.AVPlayer | reset(): Promise\<void> |
| media.AVPlayer | release(callback: AsyncCallback\<void>): void |
| media.AVPlayer | release(): Promise\<void> |
| 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>): void |
| media.AVPlayer | prepare(): Promise\<void> |
| media.AVPlayer | play(callback: AsyncCallback\<void>): void |
| media.AVPlayer | play(): Promise\<void> |
| media.AVPlayer | pause(callback: AsyncCallback\<void>): void |
| media.AVPlayer | pause(): Promise\<void> |
| media.AVPlayer | on(type: 'volumeChange', callback: Callback\<number>): void |
| media.AVPlayer | on(type: 'videoSizeChange', callback: (width: number, height: number) => void): void |
| media.AVPlayer | on(type: 'timeUpdate', callback: Callback\<number>): void |
| media.AVPlayer | on(type: 'stateChange', callback: (state: AVPlayerState, reason: StateChangeReason) => void): void |
| media.AVPlayer | on(type: 'startRenderFrame', callback: Callback\<void>): void |
| media.AVPlayer | on(type: 'speedDone', callback: Callback\<number>): void |
| media.AVPlayer | on(type: 'seekDone', callback: Callback\<number>): void |
| media.AVPlayer | on(type: 'error', callback: ErrorCallback): void |
| media.AVPlayer | on(type: 'endOfStream', callback: Callback\<void>): void |
| media.AVPlayer | on(type: 'durationUpdate', callback: Callback\<number>): void |
| media.AVPlayer | on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void |
| media.AVPlayer | on(type: 'bitrateDone', callback: Callback\<number>): void |
| media.AVPlayer | on(type: 'availableBitrates', callback: (bitrates: Array\<number>) => 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\<Array\<MediaDescription>>): void |
| media.AVPlayer | getTrackDescription() : Promise\<Array\<MediaDescription>> |
| 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\<VideoPlayer>): void |
| media | createVideoPlayer() : Promise\<VideoPlayer> |
| 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\<Array\<MediaDescription>>): void |
| media.AudioPlayer | getTrackDescription() : Promise\<Array\<MediaDescription>> |
| 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\<number>): 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>): void |
| media.VideoPlayer | play(): Promise\<void> |
| media.VideoPlayer | prepare(callback: AsyncCallback\<void>): void |
| media.VideoPlayer | prepare(): Promise\<void> |
| media.VideoPlayer | release(callback: AsyncCallback\<void>): void |
| media.VideoPlayer | release(): Promise\<void> |
| media.VideoPlayer | audioInterruptMode ?: audio.InterruptMode |
| media.VideoPlayer | fdSrc: AVFileDescriptor |
| media.VideoPlayer | seek(timeMs: number, callback: AsyncCallback\<number>): void |
| media.VideoPlayer | seek(timeMs: number, mode:SeekMode, callback: AsyncCallback\<number>): void |
| media.VideoPlayer | seek(timeMs: number, mode?:SeekMode): Promise\<number> |
| media.VideoPlayer | readonly duration: number |
| media.VideoPlayer | loop: boolean |
| media.VideoPlayer | videoScaleType ?: VideoScaleType |
| media.VideoPlayer | readonly state: VideoPlayState |
| media.VideoPlayer | getTrackDescription(callback: AsyncCallback\<Array\<MediaDescription>>): void |
| media.VideoPlayer | getTrackDescription() : Promise\<Array\<MediaDescription>> |
| media.VideoPlayer | readonly height: number |
| media.VideoPlayer | on(type: 'playbackCompleted', callback: Callback\<void>): void |
| media.VideoPlayer | on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void |
| media.VideoPlayer | on(type: 'startRenderFrame', callback: Callback\<void>): 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>): void |
| media.VideoPlayer | setDisplaySurface(surfaceId: string): Promise\<void> |
| media.VideoPlayer | setVolume(vol: number, callback: AsyncCallback\<void>): void |
| media.VideoPlayer | setVolume(vol: number): Promise\<void> |
| media.VideoPlayer | url: string |
| media.VideoPlayer | pause(callback: AsyncCallback\<void>): void |
| media.VideoPlayer | pause(): Promise\<void> |
| media.VideoPlayer | readonly currentTime: number |
| media.VideoPlayer | setSpeed(speed:number, callback: AsyncCallback\<number>): void |
| media.VideoPlayer | setSpeed(speed:number): Promise\<number> |
| media.VideoPlayer | stop(callback: AsyncCallback\<void>): void |
| media.VideoPlayer | stop(): Promise\<void> |
| media.VideoPlayer | readonly width: number |
| media.VideoPlayer | reset(callback: AsyncCallback\<void>): void |
| media.VideoPlayer | reset(): Promise\<void> |
| 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)<sup>9+</sup>, 升级了状态机和错误码,推荐用户使用。旧版音频录制接口[AudioRecorder](../../../application-dev/reference/apis/js-apis-media.md#audiorecorder)<sup>6+</sup>和视频录制接口[VideoRecorder](../../../application-dev/reference/apis/js-apis-media.md#videorecorder9)<sup>9+</sup>停止维护。
新旧录制接口共用的[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)<sup>6+</sup>[VideoRecorder](../../../application-dev/reference/apis/js-apis-media.md#videorecorder9)<sup>9+</sup>暂时可继续使用,但是停止维护,建议使用新接口进行开发[AVRecorder](../../../application-dev/reference/apis/js-apis-media.md#avrecorder9)<sup>9+</sup>
**关键的接口/组件变更**
新增接口如下:
| 类名 | 新增接口声明 |
| ----------------------- | ------------------------------------------------------------ |
| media | createAVRecorder(callback: AsyncCallback\<AVRecorder>): void |
| media | createAVRecorder() : Promise\<AVRecorder> |
| media.AVRecorder | interface AVRecorder |
| media.AVRecorder | prepare(config: AVRecorderConfig, callback: AsyncCallback\<void>): void |
| media.AVRecorder | prepare(config: AVRecorderConfig): Promise\<void> |
| media.AVRecorder | release(callback: AsyncCallback\<void>): void |
| media.AVRecorder | release(): Promise\<void> |
| 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>): void |
| media.AVRecorder | resume(): Promise\<void> |
| media.AVRecorder | start(callback: AsyncCallback\<void>): void |
| media.AVRecorder | start(): Promise\<void> |
| media.AVRecorder | off(type: 'stateChange'): void |
| media.AVRecorder | off(type: 'error'): void |
| media.AVRecorder | pause(callback: AsyncCallback\<void>): void |
| media.AVRecorder | pause(): Promise\<void> |
| media.AVRecorder | stop(callback: AsyncCallback\<void>): void |
| media.AVRecorder | stop(): Promise\<void> |
| media.AVRecorder | reset(callback: AsyncCallback\<void>): void |
| media.AVRecorder | reset(): Promise\<void> |
| media.AVRecorder | getInputSurface(callback: AsyncCallback\<string>): void |
| media.AVRecorder | getInputSurface(): Promise\<string> |
| 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\<VideoRecorder>): void |
| media | createVideoRecorder(): Promise\<VideoRecorder> |
| 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>): void |
| media.VideoRecorder | prepare(config: VideoRecorderConfig): Promise\<void> |
| media.VideoRecorder | release(callback: AsyncCallback\<void>): void |
| media.VideoRecorder | release(): Promise\<void> |
| media.VideoRecorder | readonly state: VideoRecordState |
| media.VideoRecorder | on(type: 'error', callback: ErrorCallback): void |
| media.VideoRecorder | resume(callback: AsyncCallback\<void>): void |
| media.VideoRecorder | resume(): Promise\<void> |
| media.VideoRecorder | start(callback: AsyncCallback\<void>): void |
| media.VideoRecorder | start(): Promise\<void> |
| media.VideoRecorder | pause(callback: AsyncCallback\<void>): void |
| media.VideoRecorder | pause(): Promise\<void> |
| media.VideoRecorder | stop(callback: AsyncCallback\<void>): void |
| media.VideoRecorder | stop(): Promise\<void> |
| media.VideoRecorder | reset(callback: AsyncCallback\<void>): void |
| media.VideoRecorder | reset(): Promise\<void> |
| media.VideoRecorder | getInputSurface(callback: AsyncCallback\<string>): void |
| media.VideoRecorder | getInputSurface(): Promise\<string> |
| 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)<sup>9+</sup>替代原有错误枚举类型[MediaErrorCode](../../../application-dev/reference/apis/js-apis-media.md#mediaerrorcode)<sup>8+</sup>
**变更影响**
以往接口返回错误码枚举类型为[MediaErrorCode](../../../application-dev/reference/apis/js-apis-media.md#mediaerrorcode)<sup>8+</sup>不变。新增接口错误码类型均采用[AVErrorCode9](../../../application-dev/reference/apis/js-apis-media.md#averrorcode)<sup>9+</sup>
**关键的接口/组件变更**
新增接口如下:
| 类名 | 新增错误码声明 |
| ----------------- | ------------------------------------------------------------ |
| 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
# 用户IAM子系统Changelog
## cl.useriam.1 API9返回值命名变更
用户IAM API9的返回值枚举类类名发生变更,从 ResultCodeV9 更名为 UserAuthResultCode
**变更影响**
基于此版本以前开发的应用不受影响,以后的需适配错误码的类名,否则会影响业务逻辑。
**关键接口/组件变更**
无接口/组件变更
**适配指导**
需要修改返回值调用类名从 ResultCodeV9 改为 UserAuthResultCode
\ No newline at end of file
# 窗口子系统ChangeLog
## cl.window.1 WindowStage生命周期监听类型名称变更
WindowStage生命周期的监听类型枚举定义自3.2.10.5版本起进行了变更。
**变更影响**
3.2.10.5版本之前使用FOREGROUND/BACKGROUND类型开发的应用生命周期监听,在3.2.10.5版本之后失效。
**关键接口/组件变更**
## WindowStageEventType<sup>9+</sup>
变更前:
| 名称 | 值 | 说明 |
| ---------- | ---- | ---------- |
| FOREGROUND | 1 | 切到前台。 |
| BACKGROUND | 4 | 切到后台。 |
变更后:
| 名称 | 值 | 说明 |
| ------ | ---- | ---------- |
| SHOWN | 1 | 切到前台。 |
| HIDDEN | 4 | 切到后台。 |
**适配指导**
在注册生命周期监听回调时,将前后台事件类型改为SHOWN/HIDDEN:
```
import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
try {
windowStage.on('windowStageEvent', (stageEventType) => {
switch (stageEventType) {
case window.WindowStageEventType.SHOWN:
console.log("windowStage shown");
break;
case window.WindowStageEventType.ACTIVE:
console.log("windowStage active");
break;
case window.WindowStageEventType.INACTIVE:
console.log("windowStage inActive");
break;
case window.WindowStageEventType.HIDDEN:
console.log("windowStage hidden");
break;
default:
break;
}
} )
} catch (exception) {
console.error('Failed to enable the listener for window stage event changes. Cause:' +
JSON.stringify(exception));
};
}
};
```
# 多模输入changeLog
## cl.multimodalinput.1 API错误信息返回方式变更
下列模块内部接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。在API9进行变更。
- 输入设备管理模块:三方接口,@ohos.multimodalInput.inputDevice.d.ts
- 组合按键订阅模块:系统接口,@ohos.multimodalInput.inputConsumer.d.ts
- 键鼠穿越功能模块:系统接口,@ohos.multimodalInput.inputDeviceCooperate.d.ts
- 按键注入模块:系统接口,@ohos.multimodalInput.inputEventClient.d.ts
- 输入监听模块:系统接口,@ohos.multimodalInput.inputMonitor.d.ts
- 鼠标指针管理模块:系统接口和三方接口,@ohos.multimodalInput.pointer.d.ts
以上模块中的异步接口变更为参数检查错误同步抛出,业务逻辑错误通过AsyncCallback或Promise的error对象抛出,同步接口不作变更。
**变更影响**
基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。
**关键接口/组件变更**
- supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: AsyncCallback&lt;Array&lt;boolean&gt;&gt;): void;
- supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;): Promise&lt;Array&lt;boolean&gt;&gt;;
- getKeyboardType(deviceId: number, callback: AsyncCallback&lt;KeyboardType&gt;): void; &gt;
- getKeyboardType(deviceId: number): Promise&lt;KeyboardType&gt;;
- setPointerSpeed(speed: number, callback: AsyncCallback&lt;void&gt;): void;
- setPointerSpeed(speed: number): Promise&lt;void&gt;;
- getPointerSpeed(callback: AsyncCallback&lt;number&gt;): void;
- getPointerSpeed(): Promise&lt;number&gt;;
- setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback&lt;void&gt;): void;
- setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise&lt;void&gt;;
- getPointerStyle(windowId: number, callback: AsyncCallback&lt;PointerStyle&gt;): void;
- getPointerStyle(windowId: number): Promise&lt;PointerStyle&gt;;
- setPointerVisible(visible: boolean, callback: AsyncCallback&lt;void&gt;): void;
- setPointerVisible(visible: boolean): Promise&lt;void&gt;;
- isPointerVisible(callback: AsyncCallback&lt;boolean&gt;): void;
- isPointerVisible(): Promise&lt;boolean&gt;;
- on(type:"touch", receiver:TouchEventReceiver):void;
- on(type:"mouse", receiver:Callback&lt;MouseEvent&gt;):void;
- off(type:"touch", receiver?:TouchEventReceiver):void;
- off(type:"mouse", receiver?:Callback&lt;MouseEvent&gt;):void;
- injectEvent({KeyEvent: KeyEvent}): void;
- enable(enable: boolean, callback: AsyncCallback&lt;void&gt;): void;
- enable(enable: boolean): Promise&lt;void&gt;;
- start(sinkDeviceDescriptor: string, srcInputDeviceId: number, callback: AsyncCallback&lt;void&gt;): void;
- start(sinkDeviceDescriptor: string, srcInputDeviceId: number): Promise&lt;void&gt;;
- stop(callback: AsyncCallback&lt;void&gt;): void;
- stop(): Promise&lt;void&gt;;
- getState(deviceDescriptor: string, callback: AsyncCallback&lt;{ state: boolean }&gt;): void;
- getState(deviceDescriptor: string): Promise&lt;{ state: boolean }&gt;;
- on(type: 'cooperation', callback: AsyncCallback&lt;{ deviceDescriptor: string, eventMsg: EventMsg }&gt;): void;
- off(type: 'cooperation', callback?: AsyncCallback&lt;void&gt;): void;
- on(type: "key", keyOptions: KeyOptions, callback: Callback&lt;KeyOptions&gt;): void;
- off(type: "key", keyOptions: KeyOptions, callback?: Callback&lt;KeyOptions&gt;): void;
以下接口标记废除:
- getDeviceIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void;
- getDeviceIds(): Promise&lt;Array&lt;number&gt;&gt;;
- getDevice(deviceId: number, callback: AsyncCallback&lt;InputDeviceData&gt;): void;
- getDevice(deviceId: number): Promise&lt;InputDeviceData&gt;;
替代接口如下:
- getDeviceList(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void;
- getDeviceList(): Promise&lt;Array&lt;number&gt;&gt;;
- getDeviceInfo(deviceId: number, callback: AsyncCallback&lt;InputDeviceData&gt;): void;
- getDeviceInfo(deviceId: number): Promise&lt;InputDeviceData&gt;;
以下接口发生变更
变更前:
- supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: Callback&lt;Array&lt;boolean&gt;&gt;): void;
- getKeyboardType(deviceId: number, callback: Callback&lt;KeyboardType&gt;): void;
变更后:
- supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: AsyncCallback&lt;Array&lt;boolean&gt;&gt;): void;
- getKeyboardType(deviceId: number, callback: AsyncCallback&lt;KeyboardType&gt;): void;
**适配指导**
以setPointerVisible为例,示例代码如下:
```ts
import pointer from '@ohos.multimodalInput.pointer';
pointer.setPointerVisible(true, (error) => {
console.log(`Set pointer visible success`);
});
try {
pointer.setPointerVisible(true, (error) => {
if (error) {
console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Set pointer visible success`);
});
} catch (error) {
console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
# 元能力子系统ChangeLog
## cl.ability.1 应用组件启动规则变更
元能力子系统应用组件启动规则在如下场景中存在变更:
- 应用位于后台启动应用组件
- 跨应用启动invisible应用组件
- 跨应用启动FA模型的serviceAbility与dataAbility
- 使用startAbilityByCall接口
开发者需要根据以下说明对应用进行适配。
**变更影响**
若未适配新规则,在上述场景下将无法启动应用组件
> **注意,启动应用组件是指一切启动或连接Ability的行为:**
<br> 1. 启动Ability,如使用startAbility、startServiceExtensionAbility、startAbilityByCall等接口。
<br> 2. 连接Ability,如使用connectAbility、connectServiceExtensionAbility、acquireDataAbilityHelper、createDataShareHelper等接口。
**关键的接口/组件变更**
- 涉及的应用组件
- Stage模型
- Ability
- ServiceExtension
- DataShareExtension
- FA模型
- PageAbility
- ServiceAbility
- DataAbility
- 涉及接口
- Stage模型
- startAbility(want: Want, callback: AsyncCallback<void>): void;
- startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
- startAbility(want: Want, options?: StartOptions): Promise<void>;
- startAbilityByCall(want: Want): Promise<Caller>;
- startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void;
- startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback<void>): void;
- startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise<void>;
- startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void;
- startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void;
- startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>;
- startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback<AbilityResult>): void;
- startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback<void>): void;
- startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise<AbilityResult>;
- startServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void;
- startServiceExtensionAbility(want: Want): Promise<void>;
- startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void;
- startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>;
- stopServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void;
- stopServiceExtensionAbility(want: Want): Promise<void>;
- stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void;
- stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>;
- connectAbility(want: Want, options: ConnectOptions): number;
- connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;
- createDataShareHelper(context: Context, uri: string, callback: AsyncCallback<DataShareHelper>): void
- FA模型
- startAbility(parameter: StartAbilityParameter, callback: AsyncCallback<number>): void;
- startAbility(parameter: StartAbilityParameter): Promise<number>;
- startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback<AbilityResult>): void;
- startAbilityForResult(parameter: StartAbilityParameter): Promise<AbilityResult>;
- acquireDataAbilityHelper(uri: string): DataAbilityHelper;
- connectAbility(request: Want, options:ConnectOptions ): number;
**适配指导**
不同场景下的启动规则说明如下:
- **应用后台启动应用组件**
- OpenHarmony 3.2-beta3 版本规则:
- 应用位于后台时,启动应用组件不受任何限制。
- OpenHarmony 3.2-beta4 版本新规则:
- 当应用位于后台时,启动应用组件需鉴权,需申请的权限如下:
- ```json
{
"name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"grantMode": "system_grant",
"availableLevel": "system_basic",
"provisionEnable": true,
"distributedSceneEnable": false
}
```
> **注:**
<br> 1. 即使启动同应用的组件,也受该规则限制。
<br> 2. 对于API8以及之前的SDK,启动serviceAbility和dataAbility不受此规则限制。
- **跨应用启动invisible应用组件**
- OpenHarmony 3.2-beta3 版本规则:
- 对于APL为normal的应用,无法跨应用启动invisible的应用组件
- OpenHarmony 3.2-beta4 版本新规则:
- 所有应用,若需要跨应用启动invisible的应用组件,需鉴权,需申请的权限如下:
- ```json
{
"name": "ohos.permission.START_INVISIBLE_ABILITY",
"grantMode": "system_grant",
"availableLevel": "system_core",
"provisionEnable": true,
"distributedSceneEnable": false
}
```
- **跨应用启动FA模型的serviceAbility与dataAbility**
- OpenHarmony 3.2-beta3 版本规则:
- 可任意跨应用启动serviceAbility与dataAbility
- OpenHarmony 3.2-beta4 版本新规则:
- serviceAbility与dataAbility的提供方应用需配置关联启动,否则无法被跨应用拉起。(普通应用无法配置关联启动)
- **startAbilityByCall接口**
- OpenHarmony 3.2-beta3 版本规则:
- 可任意进行Call调用
- OpenHarmony 3.2-beta4 版本新规则:
- 不支持同应用startAbilityByCall调用
- 跨应用startAbilityByCall调用需鉴权,需申请的权限如下:
- ```json
{
"name": "ohos.permission.ABILITY_BACKGROUND_COMMUNICATION",
"grantMode": "system_grant",
"availableLevel": "system_basic",
"provisionEnable": true,
"distributedSceneEnable": false
}
```
> **注:**
<br> 使用startAbilityByCall接口同时也受上述后台启动、跨应用启动invisible规则的限制。
## cl.ability.2 跨设备应用组件启动规则变更(仅支持系统应用)
元能力子系统跨设备应用组件启动规则在如下场景中存在变更:
- 应用位于后台启动应用组件
- 跨应用启动invisible应用组件
- 跨应用启动FA模型的serviceAbility
开发者需要根据以下说明对应用进行适配。
**变更影响**
若未适配新规则,在上述场景下将无法启动应用组件
> **注意,启动应用组件是指一切启动或连接Ability的行为:**
<br> 1. 启动Ability,如使用startAbility、startAbilityForResult、startAbilityByCall等接口。
<br> 2. 连接Ability,如使用connectAbility等接口。
**关键的接口/组件变更**
- 涉及的应用组件
- Stage模型
- Ability
- ServiceExtension
- FA模型
- PageAbility
- ServiceAbility
- 涉及接口
- Stage模型
- startAbility(want: Want, callback: AsyncCallback<void>): void;
- startAbilityByCall(want: Want): Promise<Caller>;
- startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void;
- connectAbility(want: Want, options: ConnectOptions): number;
- FA模型
- startAbility(parameter: StartAbilityParameter, callback: AsyncCallback<number>): void;
- startAbility(parameter: StartAbilityParameter): Promise<number>;
- startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback<AbilityResult>): void;
- startAbilityForResult(parameter: StartAbilityParameter): Promise<AbilityResult>;
- connectAbility(request: Want, options:ConnectOptions ): number;
**适配指导**
不同场景下的启动规则说明如下:
- **应用后台启动应用组件**
- OpenHarmony 3.2-beta3 版本规则:
- 应用位于后台时,启动应用组件不受任何限制。
- OpenHarmony 3.2-beta4 版本新规则:
- 当应用位于后台时,启动应用组件需鉴权,需申请的权限如下:
- ```json
{
"name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"grantMode": "system_grant",
"availableLevel": "system_basic",
"provisionEnable": true,
"distributedSceneEnable": false
}
```
> **注:**
<br> 1. 即使启动同应用的组件,也受该规则限制。
<br> 2. 对于API8以及之前的SDK,启动serviceAbility不受此规则限制。
- **跨应用启动invisible应用组件**
- OpenHarmony 3.2-beta3 版本规则:
- 无法跨应用启动invisible的应用组件
- OpenHarmony 3.2-beta4 版本新规则:
- 若需要跨应用启动invisible的应用组件,需鉴权,需申请的权限如下:
- ```json
{
"name": "ohos.permission.START_INVISIBLE_ABILITY",
"grantMode": "system_grant",
"availableLevel": "system_core",
"provisionEnable": true,
"distributedSceneEnable": false
}
```
- **跨应用启动FA模型的serviceAbility**
- OpenHarmony 3.2-beta3 版本规则:
- 可任意跨应用启动serviceAbility
- OpenHarmony 3.2-beta4 版本新规则:
- serviceAbility的提供方应用需配置关联启动,否则无法被跨应用拉起。(普通应用无法配置关联启动)
- 关联启动配置
- ```json
{
"bundleName": "",
"app_signature": ["xxxxxxxxxxxxxxxxxxx"],
"associatedWakeUp": true
}
```
## cl.ability.3 API异常处理方式变更
元能力部分接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。
**变更影响**
基于此前版本开发的应用,需适配变更接口的错误信息返回方式,否则会影响原有业务逻辑。
**关键接口/组件变更**
为适配统一的API异常处理方式,对元能力相关接口进行废弃(下表中 原接口 列内容),并新增对应接口(下表中 新接口 列内容)。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。
| 原接口 | 新接口 |
| ----------------------------------------------- | ----------------------------------------------- |
| @ohos.ability.wantConstant.d.ts | @ohos.app.ability.wantConstant.d.ts |
| @ohos.application.Ability.d.ts | @ohos.app.ability.UIAbility.d.ts |
| @ohos.application.AbilityConstant.d.ts | @ohos.app.ability.AbilityConstant.d.ts |
| @ohos.application.abilityDelegatorRegistry.d.ts | @ohos.app.ability.abilityDelegatorRegistry.d.ts |
| @ohos.application.AbilityLifecycleCallback.d.ts | @ohos.app.ability.AbilityLifecycleCallback.d.ts |
| @ohos.application.abilityManager.d.ts | @ohos.app.ability.abilityManager.d.ts |
| @ohos.application.AbilityStage.d.ts | @ohos.app.ability.AbilityStage.d.ts |
| @ohos.application.appManager.d.ts | @ohos.app.ability.appManager.d.ts |
| @ohos.application.Configuration.d.ts | @ohos.app.ability.Configuration.d.ts |
| @ohos.application.ConfigurationConstant.d.ts | @ohos.app.ability.ConfigurationConstant.d.ts |
| @ohos.application.context.d.ts | @ohos.app.ability.common.d.ts |
| @ohos.application.EnvironmentCallback.d.ts | @ohos.app.ability.EnvironmentCallback.d.ts |
| @ohos.application.errorManager.d.ts | @ohos.app.ability.errorManager.d.ts |
| @ohos.application.ExtensionAbility.d.ts | @ohos.app.ability.ExtensionAbility.d.ts |
| @ohos.application.formBindingData.d.ts | @ohos.app.form.formBindingData.d.ts |
| @ohos.application.FormExtension.d.ts | @ohos.app.form.FormExtensionAbility.d.ts |
| @ohos.application.formHost.d.ts | @ohos.app.form.formHost.d.ts |
| @ohos.application.formInfo.d.ts | @ohos.app.form.formInfo.d.ts |
| @ohos.application.formProvider.d.ts | @ohos.app.form.formProvider.d.ts |
| @ohos.application.missionManager.d.ts | @ohos.app.ability.missionManager.d.ts |
| @ohos.application.quickFixManager.d.ts | @ohos.app.ability.quickFixManager.d.ts |
| @ohos.application.ServiceExtensionAbility.d.ts | @ohos.app.ability.ServiceExtensionAbility.d.ts |
| @ohos.application.StartOptions.d.ts | @ohos.app.ability.StartOptions.d.ts |
| @ohos.application.Want.d.ts | @ohos.app.ability.Want.d.ts |
| @ohos.wantAgent.d.ts | @ohos.app.ability.wantAgent.d.ts |
**适配指导**
如上所述,仅将老接口平移到了新的namespace中,所以可以通过修改import来解决适配问题:
如原先接口使用了@ohos.application.missionManager
```js
import missionManager from '@ohos.application.missionManager';
```
可以通过直接修改import,来切换到新的namespace上:
```js
import missionManager from '@ohos.app.ability.missionManager';
```
此外还需要适配异常处理,具体参考新接口的接口文档。
## cl.ability.4 接口变更
对元能力部分接口名进行了变更。
**关键的接口/组件变更**
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| ----------------------------------------- | ----------------------- | ------------------------------------------------------------ | -------- |
| @ohos.application.Ability | Caller | onRelease(callback: OnReleaseCallBack): **void**; | 废弃 |
| @ohos.app.ability.UIAbility | Caller | on(**type**: "release", callback: OnReleaseCallBack): **void**; | 新增 |
| @ohos.application.Ability | Ability | dump(params: Array<**string**>): Array<**string**>; | 废弃 |
| @ohos.app.ability.UIAbility | UIAbility | onDump(params: Array<**string**>): Array<**string**>; | 新增 |
| @ohos.application.appManager | appManager | **function** registerApplicationStateObserver(observer: ApplicationStateObserver): **number**; | 废弃 |
| @ohos.application.appManager | appManager | **function** registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array<**string**>): **number**; | 废弃 |
| @ohos.application.appManager | appManager | **function** unregisterApplicationStateObserver(observerId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 |
| @ohos.application.appManager | appManager | **function** unregisterApplicationStateObserver(observerId: **number**): Promise<**void**>; | 废弃 |
| @ohos.app.ability.appManager | appManager | **function** on(**type**: "applicationState", observer: ApplicationStateObserver): **number**; | 新增 |
| @ohos.app.ability.appManager | appManager | **function** on(**type**: "applicationState", observer: ApplicationStateObserver, bundleNameList: Array<**string**>): **number**; | 新增 |
| @ohos.app.ability.appManager | appManager | **function** off(**type**: "applicationState", observerId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 |
| @ohos.app.ability.appManager | appManager | **function** off(**type**: "applicationState", observerId: **number**): Promise<**void**>; | 新增 |
| @ohos.application.errorManager | errorManager | **function** registerErrorObserver(observer: ErrorObserver): **number**; | 废弃 |
| @ohos.application.errorManager | errorManager | **function** unregisterErrorObserver(observerId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 |
| @ohos.application.errorManager | errorManager | **function** unregisterErrorObserver(observerId: **number**): Promise<**void**>; | 废弃 |
| @ohos.app.ability.errorManager | errorManager | **function** on(**type**: "error", observer: ErrorObserver): **number**; | 新增 |
| @ohos.app.ability.errorManager | errorManager | **function** off(**type**: "error", observerId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 |
| @ohos.app.ability.errorManager | errorManager | **function** off(**type**: "error", observerId: **number**): Promise<**void**>; | 新增 |
| @ohos.application.missionManager | missionManager | **function** registerMissionListener(listener: MissionListener): **number**; | 废弃 |
| @ohos.application.missionManager | missionManager | **function** unregisterMissionListener(listenerId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 |
| @ohos.application.missionManager | missionManager | **function** unregisterMissionListener(listenerId: **number**): Promise<**void**>; | 废弃 |
| @ohos.app.ability.missionManager | missionManager | **function** on(**type**: "mission", listener: MissionListener): **number**; | 新增 |
| @ohos.app.ability.missionManager | missionManager | **function** off(**type**: "mission", listenerId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 |
| @ohos.app.ability.missionManager | missionManager | **function** off(**type**: "mission", listenerId: **number**): Promise<**void**>; | 新增 |
| @ohos.application.FormExtension | FormExtension | onCreate(want: Want): formBindingData.FormBindingData; | 废弃 |
| @ohos.application.FormExtension | FormExtension | onCastToNormal(formId: **string**): **void**; | 废弃 |
| @ohos.application.FormExtension | FormExtension | onUpdate(formId: **string**): **void**; | 废弃 |
| @ohos.application.FormExtension | FormExtension | onVisibilityChange(newStatus: { [key: **string**]: **number** }): **void**; | 废弃 |
| @ohos.application.FormExtension | FormExtension | onEvent(formId: **string**, message: **string**): **void**; | 废弃 |
| @ohos.application.FormExtension | FormExtension | onDestroy(formId: **string**): **void**; | 废弃 |
| @ohos.application.FormExtension | FormExtension | onShare?(formId: **string**): {[key: **string**]: **any**}; | 废弃 |
| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onAddForm(want: Want): formBindingData.FormBindingData; | 新增 |
| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onCastToNormalForm(formId: **string**): **void**; | 新增 |
| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onUpdateForm(formId: **string**): **void**; | 新增 |
| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onChangeFormVisibility(newStatus: { [key: **string**]: **number** }): **void**; | 新增 |
| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onFormEvent(formId: **string**, message: **string**): **void**; | 新增 |
| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onRemoveForm(formId: **string**): **void**; | 新增 |
| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onShareForm?(formId: **string**): {[key: **string**]: **any**}; | 新增 |
| @ohos.application.formHost.d.ts | formHost | **function** castTempForm(formId: **string**, callback: AsyncCallback<**void**>): **void**; | 废弃 |
| @ohos.application.formHost.d.ts | formHost | **function** castTempForm(formId: **string**): Promise<**void**>; | 废弃 |
| @ohos.app.form.formHost.d.ts | formHost | **function** castToNormalForm(formId: **string**, callback: AsyncCallback<**void**>): **void**; | 新增 |
| @ohos.app.form.formHost.d.ts | formHost | **function** castToNormalForm(formId: **string**): Promise<**void**>; | 新增 |
| @ohos.application.ServiceExtensionAbility | ServiceExtensionAbility | dump(params: Array<**string**>): Array<**string**>; | 废弃 |
| @ohos.app.ability.ServiceExtensionAbility | ServiceExtensionAbility | onDump(params: Array<**string**>): Array<**string**>; | 新增 |
| application/AbilityContext | AbilityContext | connectAbility(want: Want, options: ConnectOptions): **number**; | 废弃 |
| application/AbilityContext | AbilityContext | connectAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 废弃 |
| application/AbilityContext | AbilityContext | disconnectAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 |
| application/AbilityContext | AbilityContext | disconnectAbility(connection: **number**): Promise<**void**>; | 废弃 |
| application/UIAbilityContext | UIAbilityContext | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 新增 |
| application/UIAbilityContext | UIAbilityContext | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 新增 |
| application/UIAbilityContext | UIAbilityContext | disconnectServiceExtensionAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 |
| application/UIAbilityContext | UIAbilityContext | disconnectServiceExtensionAbility(connection: **number**): Promise<**void**>; | 新增 |
| application/ApplicationContext | ApplicationContext | registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): **number**; | 废弃 |
| application/ApplicationContext | ApplicationContext | unregisterAbilityLifecycleCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 |
| application/ApplicationContext | ApplicationContext | unregisterAbilityLifecycleCallback(callbackId: **number**): Promise<**void**>; | 废弃 |
| application/ApplicationContext | ApplicationContext | registerEnvironmentCallback(callback: EnvironmentCallback): **number**; | 废弃 |
| application/ApplicationContext | ApplicationContext | unregisterEnvironmentCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 |
| application/ApplicationContext | ApplicationContext | unregisterEnvironmentCallback(callbackId: **number**): Promise<**void**>; | 废弃 |
| application/ApplicationContext | ApplicationContext | on(**type**: "abilityLifecycle", callback: AbilityLifecycleCallback): **number**; | 新增 |
| application/ApplicationContext | ApplicationContext | off(**type**: "abilityLifecycle", callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 |
| application/ApplicationContext | ApplicationContext | off(**type**: "abilityLifecycle", callbackId: **number**): Promise<**void**>; | 新增 |
| application/ApplicationContext | ApplicationContext | on(**type**: "environment", callback: EnvironmentCallback): **number**; | 新增 |
| application/ApplicationContext | ApplicationContext | off(**type**: "environment", callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 |
| application/ApplicationContext | ApplicationContext | off(**type**: "environment", callbackId: **number**): Promise<**void**>; | 新增 |
| application/ServiceExtensionContext | ServiceExtensionContext | connectAbility(want: Want, options: ConnectOptions): **number**; | 废弃 |
| application/ServiceExtensionContext | ServiceExtensionContext | connectAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 废弃 |
| application/ServiceExtensionContext | ServiceExtensionContext | disconnectAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 |
| application/ServiceExtensionContext | ServiceExtensionContext | disconnectAbility(connection: **number**): Promise<**void**>; | 废弃 |
| application/ServiceExtensionContext | ServiceExtensionContext | connectServiceExtensionAbility(want: Want, options: ConnectOptions): **number**; | 新增 |
| application/ServiceExtensionContext | ServiceExtensionContext | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 新增 |
| application/ServiceExtensionContext | ServiceExtensionContext | disconnectServiceExtensionAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 |
| application/ServiceExtensionContext | ServiceExtensionContext | disconnectServiceExtensionAbility(connection: **number**): Promise<**void**>; | 新增 |
# 帐号子系统ChangeLog
## cl.account_os_account.1 帐号SystemAPI错误信息返回方式变更
已发布的部分帐号SystemAPI使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9开始作以下变更:
异步接口:通过AsyncCallback或Promise的error对象返回错误信息。
同步接口:通过抛出异常的方式返回错误信息。
**变更影响**
基于此前版本开发的应用,需适配变更接口的错误信息返回方式,否则会影响原有业务逻辑。
**关键接口/组件变更**
变更前:
- class UserAuth
- setProperty(request: SetPropertyRequest, callback: AsyncCallback&lt;number&gt;): void;
- setProperty(request: SetPropertyRequest): Promise&lt;number&gt;;
- cancelAuth(contextID: Uint8Array): number;
- class PINAuth
- registerInputer(inputer: Inputer): boolean;
- UserIdentityManager
- cancel(challenge: Uint8Array): number;
变更后:
- class UserAuth
- setProperty(request: SetPropertyRequest, callback: AsyncCallback&lt;void&gt;): void;
- setProperty(request: SetPropertyRequest): Promise&lt;void&gt;;
- cancelAuth(contextID: Uint8Array): void;
- class PINAuth
- registerInputer(inputer: Inputer): void;
- UserIdentityManager
- cancel(challenge: Uint8Array): void;
**适配指导**
异步接口以setProperty为例,示例代码如下:
```
import account_osAccount from "@ohos.account.osAccount"
userAuth.setProperty({
authType: account_osAccount.AuthType.PIN,
key: account_osAccount.SetPropertyType.INIT_ALGORITHM,
setInfo: new Uint8Array([0])
}, (err) => {
if (err) {
console.log("setProperty failed, error: " + JSON.stringify(err));
} else {
console.log("setProperty successfully");
}
});
userAuth.setProperty({
authType: account_osAccount.AuthType.PIN,
key: account_osAccount.SetPropertyType.INIT_ALGORITHM,
setInfo: new Uint8Array([0])
}).catch((err) => {
if (err) {
console.log("setProperty failed, error: " + JSON.stringify(err));
} else {
console.log("setProperty successfully");
}
});
```
同步接口以registerInputer为例,示例代码如下:
```
import account_osAccount from "@ohos.account.osAccount"
let pinAuth = new account_osAccount.PINAuth()
let inputer = {
onGetData: (authType, passwordRecipient) => {
let password = new Uint8Array([0]);
passwordRecipient.onSetData(authType, password);
}
}
try {
pinAuth.registerInputer(inputer);
} catch (err) {
console.log("registerInputer failed, error: " + JSON.stringify(err));
}
```
## cl.account_os_account.2 应用帐号鉴权服务ACTION定义变更
**变更影响**
基于此前版本开发的应用,需适配修改应用配置文件(FA模型为config.json或Stage模型为module.json5)中的ACTION才能正常对外提供应用鉴权服务。
**关键接口/组件变更**
涉及的常量:
@ohos.ability.wantConstant.ACTION_APP_ACCOUNT_AUTH
变更前:
ACTION_APP_ACCOUNT_AUTH = "account.appAccount.action.auth"
变更后:
ACTION_APP_ACCOUNT_AUTH = "ohos.appAccount.action.auth"
**适配指导**
提供应用帐号鉴权服务的三方应用,需要在相关ServiceAbility的配置文件(FA模型为config.json或Stage模型为module.json5)中适配变更后的应用帐号认证ACTION,示例如下:
```
"abilities": [
{
"name": "ServiceAbility",
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
...
"visible": true,
"skills": {
{
"actions": [
"ohos.appAccount.action.auth"
]
}
}
}]
}
# 事件通知子系统ChangeLog
## cl.notification.1 API异常处理方式变更
事件通知部分接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。
**变更影响**
基于此前版本开发的应用,需适配变更接口的错误信息返回方式,否则会影响原有业务逻辑。
**关键接口/组件变更**
为适配统一的API异常处理方式,对事件通知相关接口进行废弃(下表中 原接口 列内容),并新增对应接口(下表中 新接口 列内容)。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。
| 原接口 | 新接口 |
| ----------------------- | -------------------------------- |
| @ohos.commonEvent.d.ts | @ohos.commonEventManager.d.ts |
| @ohos.notification.d.ts | @ohos.notificationManager.d.ts |
| @ohos.notification.d.ts | @ohos.notificationSubscribe.d.ts |
**适配指导**
如上所述,仅将老接口平移到了新的namespace中,所以可以通过修改import来解决适配问题:
如原先接口使用了@ohos.commonEvent
```js
import commonEvent from '@ohos.commonEvent';
```
可以通过直接修改import,来切换到新的namespace上:
```js
import commonEvent from '@ohos.commonEventManager';
```
@ohos.notification拆分成了两个namespace,需要根据接口情况选择需要的新namespace进行适配。
此外还需要适配异常处理,具体参考新接口的接口文档。
## cl.notification.2 接口变更
对事件通知部分接口名进行了变更。
**关键的接口/组件变更**
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| @ohos.notification | notification | **function** enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 |
| @ohos.notification | notification | **function** enableNotification(bundle: BundleOption, enable: boolean): Promise<**void**>; | 废弃 |
| @ohos.notificationManager | notificationManager | **function** setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 新增 |
| @ohos.notificationManager | notificationManager | **function** setNotificationEnable(bundle: BundleOption, enable: boolean): Promise<**void**>; | 新增 |
| @ohos.notification | notification | **function** enableNotificationSlot(bundle: BundleOption, **type**: SlotType, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 |
| @ohos.notification | notification | **function** enableNotificationSlot(bundle: BundleOption, **type**: SlotType, enable: boolean): Promise<**void**>; | 废弃 |
| @ohos.notificationManager | notificationManager | **function** setNotificationEnableSlot(bundle: BundleOption, **type**: SlotType, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 新增 |
| @ohos.notificationManager | notificationManager | **function** setNotificationEnableSlot(bundle: BundleOption, **type**: SlotType, enable: boolean): Promise<**void**>; | 新增 |
| @ohos.notification | notification | **function** enableDistributed(enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 |
| @ohos.notification | notification | **function** enableDistributed(enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 |
| @ohos.notificationManager | notificationManager | **function** setDistributedEnable(enable: boolean, callback: AsyncCallback<**void**>): **void**; | 新增 |
| @ohos.notificationManager | notificationManager | **function** setDistributedEnable(enable: boolean): Promise<**void**>; | 新增 |
| @ohos.notification | notification | **function** enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 |
| @ohos.notification | notification | **function** enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise<**void**>; | 废弃 |
| @ohos.notificationManager | notificationManager | **function** setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 新增 |
| @ohos.notificationManager | notificationManager | **function** setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise<**void**>; | 新增 |
\ No newline at end of file
# 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
```
# arkui子系统ChangeLog
## cl.arkui.1 xcomponent组件接口变更
arkui子系统xcomponent组件接口存在变更:
- 去除getXComponentSurfaceId和setXComponentSurfaceSize接口的@systemapi标签
- 指定getXComponentSurfaceId,getXComponentContext和setXComponentSurfaceSize接口的返回值类型
开发者需要根据以下说明对应用进行适配。
**变更影响**
影响已发布的JS接口,应用需要进行适配才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
- getXComponentSurfaceId:改为public接口,指定返回值类型为string
- setXComponentSurfaceSize:改为public接口,指定返回值类型为void
- getXComponentContext:指定返回值类型为Object
**适配指导**
不同场景下的启动规则说明如下:
开发者适配内容:
- **getXComponentSurfaceId**
- OpenHarmony 3.2-beta3 版本规则:
- 系统接口systemapi。
- 未指定返回值
- OpenHarmony 3.2-Beta4 版本新规则:
- 公共接口。
- 指定返回值类型为string
- 开发者需要按照string类型处理返回值
- **setXComponentSurfaceSize**
- OpenHarmony 3.2-beta3 版本规则:
- 系统接口systemapi。
- 未指定返回值
- OpenHarmony 3.2-Beta4 版本新规则:
- 公共接口。
- 指定返回值类型为void
- 开发者需要按照void类型处理返回值
- **getXComponentContext**
- OpenHarmony 3.2-beta3 版本规则:
- 未指定返回值
- OpenHarmony 3.2-Beta4 版本新规则:
- 指定返回值类型为Object
- 开发者需要按照Object类型处理返回值
## cl.arkui.2 弹窗类组件接口样式变更
ArkUI子系统alertDialog, actionSheet, customDialog组件及prompt, promptAction接口存在样式变更:
- promptAction.showDialog, promptAction.showActionMenu, alertDialog, actionSheet, customDialog更新弹窗底板模糊效果
**变更影响**
默认弹窗底板模糊效果
**关键的接口/组件变更**
涉及接口: promptAction.showDialog, promptAction.showActionMenu;
涉及组件: alertDialog, actionSheet, customDialog
**适配指导**
无需适配
\ No newline at end of file
# 电话子系统ChangeLog
## cl.telephony.1 sms模块SystemAPI接口入参变更
已发布的部分电话子系统sms短信模块SystemAPI传入参数发生变化,不符合OpenHarmony接口规范。从API9开始做出以下变更:
isImsSmsSupported接口新增一个传入参数slotId,表示卡槽号。
**变更影响**
基于此前版本开发的应用,需适配变更js接口的入参,否则会影响原有功能。
**关键的接口/组件变更**
- 涉及接口
isImsSmsSupported(callback: AsyncCallback<boolean>): void;
isImsSmsSupported(): Promise<boolean>;
- 变更前:
```js
function isImsSmsSupported(callback: AsyncCallback<boolean>): void;
function isImsSmsSupported(): Promise<boolean>;
```
- 变更后:
```js
function isImsSmsSupported(slotId: number, callback: AsyncCallback<boolean>): void;
function isImsSmsSupported(slotId: number): Promise<boolean>;
```
**适配指导**
新增一个入参,示例代码如下:
callback方式
```js
let slotId = 0;
sms.isImsSmsSupported(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
promise方式
```js
let slotId = 0;
let promise = sms.isImsSmsSupported(slotId);
promise.then(data => {
console.log(`isImsSmsSupported success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`isImsSmsSupported failed, promise: err->${JSON.stringify(err)}`);
});
```
\ No newline at end of file
# 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
```
# security子系统ChangeLog
## cl.security.1 Random的setSeed功能变更,由异步接口改为同步接口
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
修改前的接口原型:
setSeed(seed : DataBlob, callback : AsyncCallback\<void>) : void;
setSeed(seed : DataBlob) : Promise\<void>;
修改后的接口原型:
setSeed(seed : DataBlob) : void;
**适配指导**
查看API参考中setSeed对应的接口适配指南:
[加解密算法库框架-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md)
## cl.security.2 interface DataArray 从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
interface DataArray从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**适配指导**
重新import并使用对应的.d.ts文件:
import cryptoCert from '@ohos.security.cert';
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.3 interface EncodingFormat从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
interface EncodingFormat从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**适配指导**
重新import并使用对应的.d.ts文件:
import cryptoCert from '@ohos.security.cert';
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.4 interface EncodingBlob 从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
interface EncodingBlob 从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**适配指导**
重新import并使用对应的.d.ts文件:
import cryptoCert from '@ohos.security.cert';
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.5 interface CertChainData从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
interface CertChainData从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**适配指导**
重新import并使用对应的.d.ts文件:
import cryptoCert from '@ohos.security.cert';
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.6 interface X509Cert从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
interface X509Cert从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**适配指导**
重新import并使用对应的.d.ts文件:
import cryptoCert from '@ohos.security.cert';
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.7 function createX509Cert从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
function createX509Cert从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**适配指导**
重新import并使用对应的.d.ts文件:
import cryptoCert from '@ohos.security.cert';
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.8 interface X509CrlEntry从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
interface X509CrlEntry从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**适配指导**
重新import并使用对应的.d.ts文件:
import cryptoCert from '@ohos.security.cert';
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.9 interface X509Crl从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
interface X509Crl从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**适配指导**
重新import并使用对应的.d.ts文件:
import cryptoCert from '@ohos.security.cert';
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.10 function createX509Crl从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
function createX509Crl从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**适配指导**
重新import并使用对应的.d.ts文件:
import cryptoCert from '@ohos.security.cert';
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.11 interface CertChainValidator从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
interface CertChainValidator从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**适配指导**
重新import并使用对应的.d.ts文件:
import cryptoCert from '@ohos.security.cert';
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.12 function createCertChainValidator从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
function createCertChainValidator从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts
**适配指导**
重新import并使用对应的.d.ts文件:
import cryptoCert from '@ohos.security.cert';
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.13 X509Cert 的getPublicKey功能变更,由异步接口改为同步接口
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
修改前的接口原型:
getPublicKey(callback : AsyncCallback\<PubKey>) : void;
getPublicKey() : Promise\<PubKey>;
修改后的接口原型:
getPublicKey() : cryptoFramework.PubKey;
**适配指导**
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.14 X509Cert 的checkValidityWithDate功能变更,由异步接口改为同步接口
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
修改前的接口原型:
checkValidityWithDate(date: string, callback : AsyncCallback\<void>) : void;
checkValidityWithDate(date: string) : Promise\<void>;
修改后的接口原型:
checkValidityWithDate(date: string) : void;
**适配指导**
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.15 X509CrlEntry 的getCertIssuer功能变更,由异步接口改为同步接口
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
修改前的接口原型:
getCertIssuer(callback : AsyncCallback\<DataBlob>) : void;
getCertIssuer() : Promise\<DataBlob>;
修改后的接口原型:
getCertIssuer() : DataBlob;
**适配指导**
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.16 X509CrlEntry 的getRevocationDate功能变更,由异步接口改为同步接口
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
修改前的接口原型:
getRevocationDate(callback : AsyncCallback\<string>) : void;
getRevocationDate() : Promise\<string>;
修改后的接口原型:
getRevocationDate() : string;
**适配指导**
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.17 X509Crl 的isRevoked功能变更,由异步接口改为同步接口
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
修改前的接口原型:
isRevoked(cert : X509Cert, callback : AsyncCallback\<boolean>) : void;
isRevoked(cert : X509Cert) : Promise\<boolean>;
修改后的接口原型:
isRevoked(cert : X509Cert) : boolean;
**适配指导**
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.18 X509Crl 的getRevokedCert功能变更,由异步接口改为同步接口
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
修改前的接口原型:
getRevokedCert(serialNumber : number, callback : AsyncCallback\<X509CrlEntry>) : void;
getRevokedCert(serialNumber : number) : Promise\<X509CrlEntry>;
修改后的接口原型:
getRevokedCert(serialNumber : number) : X509CrlEntry;
**适配指导**
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.19 X509Crl 的getRevokedCertWithCert功能变更,由异步接口改为同步接口
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
修改前的接口原型:
getRevokedCertWithCert(cert : X509Cert, callback : AsyncCallback\<X509CrlEntry>) : void;
getRevokedCertWithCert(cert : X509Cert) : Promise\<X509CrlEntry>;
修改后的接口原型:
getRevokedCertWithCert(cert : X509Cert) : X509CrlEntry;
**适配指导**
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
## cl.security.20 X509Crl 的getTbsInfo功能变更,由异步接口改为同步接口
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
修改前的接口原型:
getTbsInfo(callback : AsyncCallback\<DataBlob>) : void;
getTbsInfo() : Promise\<DataBlob>;
修改后的接口原型:
getTbsInfo() : DataBlob;
**适配指导**
查看API参考中对应的接口适配指南:
[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
# 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
```
# 测试子系统ChangeLog
## cl.testfwk_arkxtest.1 Rect控件边框信息类接口名称变更
表示控件边框信息的枚举类型Rect定义自4.0.2.1版本起进行了变更。
## 变更影响
此变更影响@ohos.uitest提供的Rect接口。用户此前在测试用例开发中使用了@ohos.uitest-api9 中Rect接口的,需要进行适配才可以在新版本SDK环境正常编译通过。
## 关键的接口/组件变更
### Rect<sup>9+</sup>
变更前:
| 名称 | 值 | 说明 |
| ------- | ---- | ------------------------- |
| leftX | 1 | 控件边框的左上角的X坐标。 |
| topY | 2 | 控件边框的左上角的Y坐标。 |
| rightX | 3 | 控件边框的右下角的X坐标。 |
| bottomY | 4 | 控件边框的右下角的Y坐标。 |
变更后:
| 名称 | 值 | 说明 |
| ------ | ---- | ------------------------- |
| left | 1 | 控件边框的左上角的X坐标。 |
| top | 2 | 控件边框的左上角的Y坐标。 |
| right | 3 | 控件边框的右下角的X坐标。 |
| bottom | 4 | 控件边框的右下角的Y坐标。 |
## 适配指导
### 适配接口名称变更
可按照如下规则做类名替换:
- `leftX-->left`
- `topY-->top`
- `rightX-->right`
- `bottomY-->bottom`
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册