未验证 提交 cbfa8a75 编写于 作者: O openharmony_ci 提交者: Gitee

!19422 整改4.0beta1 changelog

Merge pull request !19422 from YanPei/master
# Readme
- [元能力](changelogs-ability.md)
- [程序访问控制](changelogs-accesstoken.md)
- [帐号](changelogs-account_os_account.md)
- [通知](changelogs-ans.md)
- [语言编译运行时](changelogs-arkcompiler.md)
- [ArkUI](changelogs-arkui.md)
- [蓝牙](changelogs-bluetooth.md)
- [包管理](changelogs-bundlemanager.md)
- [事件](changelogs-ces.md)
- [分布式数据管理](changelogs-distributeddatamgr.md)
- [文件管理](changelogs-filemanagement.md)
- [位置](changelogs-geoLocationManager.md)
- [全球化](changelogs-global.md)
- [安全-huks](changelogs-huks.md)
- [输入法框架](changelogs-imf.md)
- [媒体](changelogs-media.md)
- [Misc软件](changelogs-miscdevice.md)
- [剪贴板](changelogs-pasteboard.md)
- [电源](changelogs-power.md)
- [资源调度](changelogs-resourceschedule.md)
- [主题框架-锁屏](changelogs-screenlock.md)
- [安全基础能力](changelogs-security.md)
- [泛Sensor](changelogs-sensor.md)
- [分布式软总线](changelogs-softbus.md)
- [启动服务](changelogs-startup.md)
- [电话服务](changelogs-telephony.md)
- [测试框架](changelogs-testfwk_arkxtest.md)
- [USB](changelogs-usb.md)
- [主题框架-壁纸](changelogs-wallpaper.md)
- [Web](changelogs-web.md)
- [WIFI](changelogs-wifiManager.md)
\ No newline at end of file
| 子系统 | 变更类型 | 变更说明 |
| :------------- | ------------ | ------------------------------------------------------------ |
| 通用 | 校验增强 | [System API校验权限增强,只有系统应用允许使用system-api,三方应用使用system-api将返回202错误](changelogs-common.md) |
| 元能力 | 行为变更 | [apprecovery接口中RestartFlag枚举命名从特定故障发生后不重启改成了特定故障发生后重启](changelogs-ability.md) |
| 语言编译运行时 | 解析规则变更 | [LLVM解析格式变更,对于业务依赖version-script或gcc-toolchain选项的开发者,在沿用LLVM12配置文件或选项时,部分规则发生变化,可能会解析失败](changelogs-arkcompiler.md) |
| 语言编译运行时 | 校验增强 | [LLVM新增告警及已有告警增强,LLVM从12升级15,新增告警/对已有的告警校验增强](changelogs-arkcompiler.md) |
| 语言编译运行时 | 校验增强 | [LLVM emu-tls变更,对于LLVM12/LLVM15工具链混用的开发者,会产生libc++.so emu-tls符号无法找到的问题](changelogs-arkcompiler.md) |
| 语言编译运行时 | 校验增强 | [LLVM12~15官方变更差异继承新增特性及内部接口变更](changelogs-arkcompiler.md) |
| ArkUI | 行为变更 | [修复Stack布局问题](changelogs-arkui.md) |
| ArkUI | 默认值变更 | [List组件和Gird组件滚动条默认状态变更](changelogs-arkui.md) |
| ArkUI | UX变更 | [Button组件hover状态效果变更,由100-105%放大效果变更为0-5%](changelogs-arkui.md) |
| ArkUI | UX变更 | [toast组件多行文本对齐方式由居中对齐变更为左对齐](changelogs-arkui.md) |
| 包管理 | 机制变更 | [安装hap时,hap中的文件不在解压到安装目录](changelogs-bundlemanager.md) |
| 全球化 | 接口扩展 | [getStringSync、getStringByNameSync接口能力扩展](changelogs-global.md) |
| 全球化 | 行为变更 | [资源获取rawfile文件描述符接口含义变更相较于之前的版本返回值发生了变化](changelogs-global.md) |
| 安全-huks | 行为变更 | [解决在派生密钥/协商密钥时需传入HuksKeyStorageType中定义的类型](changelogs-huks.md) |
| 安全-huks | 权限变更 | [attestKeyitem是基于设备证书链封装业务公钥对用户指定的密钥进行证明](changelogs-huks.md) |
| Web | 新增入参 | [setResponseData接口支持Resource类型](changelogs-web.md) |
| 资源调度 | 行为变更 | [提醒代理支持系统应用设置自定义按钮,并且自定义按钮可跳转指定应用界面](changelogs-resourceschedule.md) |
# 程序访问控制子系统ChangeLog
OpenHarmony 4.0.3.2 版本相较于OpenHarmony 之前的版本,程序访问控制子系统的API变更如下。
## cl.access_token.1 getPermissionUsedRecords命名变更
接口getPermissionUsedRecords由于命名规范问题,名称变更为getPermissionUsedRecord。
**变更影响**
接口getPermissionUsedRecords,在4.0.3.3版本及后续版本中无法继续正常使用。
**关键的接口/组件变更**
- 涉及接口
function getPermissionUsedRecords
- 变更前:
```ts
function getPermissionUsedRecords
```
- 变更后:
```ts
function getPermissionUsedRecord
```
**适配指导**
请使用getPermissionUsedRecord替换getPermissionUsedRecords
\ No newline at end of file
# 帐号子系统ChangeLog
## cl.account_os_account.1 分布式帐号昵称和头像规格扩大
已有分布式帐号的昵称长度和头像大小的规格过小,无法满足其他昵称较长、头像较大的使用场景。
因此,将分布式帐号昵称长度和头像大小的规格扩大。
**变更影响**
该接口变更前向兼容,基于此前版本开发的应用可按照最新规格使用该接口,原有逻辑不受影响。
**关键接口/组件变更**
变更前:
- 昵称长度限制为20个字符,头像大小限制为3M
变更后:
- 昵称长度限制为1024个字符,头像大小限制为10M
## cl.account_os_account.2 应用帐号isAccountRemovable命名变更
类Authenticator中的成员函数isAccountRemovable由于命名不统一问题,名称变更为checkAccountRemovable。
**变更影响**
类Authenticator中的成员函数isAccountRemovable,在4.0.3.2版本及后续版本中无法继续正常使用,由checkAccountRemovable代替。
**关键的接口/组件变更**
- 涉及接口
```ts
class Authenticator {
...
isAccountRemovable
...
}
```
- 变更前:
```ts
class Authenticator {
...
/**
* Checks whether the specified account can be removed.
* @param name Indicates the account name.
* @param callback Indicates the authenticator callback.
* @returns void.
* @since 9
*/
isAccountRemovable(name: string, callback: AuthCallback): void;
...
}
```
- 变更后:
```ts
class Authenticator {
...
/**
* Checks whether the specified account can be removed.
* @param name Indicates the account name.
* @param callback Indicates the authenticator callback.
* @returns void.
* @since 9
*/
checkAccountRemovable(name: string, callback: AuthCallback): void;
...
}
```
## cl.account_os_account.3 系统帐号checkConstraintEnabled命名变更
checkConstraintEnabled由于命名不统一问题,名称变更为checkOsAccountConstraintEnabled。
**变更影响**
checkConstraintEnabled接口,在4.0.3.2版本及后续版本中无法继续正常使用,由checkOsAccountConstraintEnabled代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
checkConstraintEnabled
...
}
```
- 变更前:
```ts
checkConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void;
checkConstraintEnabled(localId: number, constraint: string): Promise<boolean>;
```
- 变更后:
```ts
checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void;
checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean>;
```
## cl.account_os_account.4 系统帐号checkOsAccountConstraintEnabled权限场景变更
checkOsAccountConstraintEnabled接口的权限管控新增可选权限:ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS。
**变更影响**
在4.0.3.2版本及后续版本中,应用申请ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS权限亦可调用checkOsAccountConstraintEnabled,
切此前版本申请ohos.permission.MANAGE_LOCAL_ACCOUNTS权限的不影响使用
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
checkOsAccountConstraintEnabled
...
}
```
- 变更前:
```ts
...
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
...
checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void;
checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean>;
```
- 变更后:
```ts
...
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
...
checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void;
checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean>;
```
## cl.account_os_account.5 系统帐号queryOsAccountLocalIdFromProcessd命名变更
queryOsAccountLocalIdFromProcess由于命名不统一问题,名称变更为getOsAccountLocalId。
**变更影响**
queryOsAccountLocalIdFromProcess接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalId代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
queryOsAccountLocalIdFromProcess
...
}
```
- 变更前:
```ts
queryOsAccountLocalIdFromProcess(callback: AsyncCallback<number>): void;
queryOsAccountLocalIdFromProcess(): Promise<number>;
```
- 变更后:
```ts
getOsAccountLocalId(callback: AsyncCallback<number>): void;
getOsAccountLocalId(): Promise<number>;
```
## cl.account_os_account.6 系统帐号queryOsAccountLocalIdFromUid命名变更
queryOsAccountLocalIdFromUid由于命名不统一问题,名称变更为getOsAccountLocalIdForUid。
**变更影响**
queryOsAccountLocalIdFromUid接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForUid代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
queryOsAccountLocalIdFromUid
...
}
```
- 变更前:
```ts
queryOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback<number>): void;
queryOsAccountLocalIdFromUid(uid: number): Promise<number>;
```
- 变更后:
```ts
getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback<number>): void;
getOsAccountLocalIdForUid(uid: number): Promise<number>;
```
## cl.account_os_account.7 系统帐号queryOsAccountLocalIdFromDomain命名变更
queryOsAccountLocalIdFromDomain由于命名不统一问题,名称变更为getOsAccountLocalIdForDomain。
**变更影响**
queryOsAccountLocalIdFromDomain接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForDomain代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
queryOsAccountLocalIdFromDomain
...
}
```
- 变更前:
```ts
queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void;
queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise<number>;
```
- 变更后:
```ts
getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void;
getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise<number>;
```
## cl.account_os_account.8 系统帐号getActivatedOsAccountIds命名变更
getActivatedOsAccountIds由于命名不统一问题,名称变更为getActivatedOsAccountLocalIds。
**变更影响**
getActivatedOsAccountIds接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getActivatedOsAccountLocalIds代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
getActivatedOsAccountIds
...
}
```
- 变更前:
```ts
getActivatedOsAccountIds(callback: AsyncCallback<Array<number>>): void;
getActivatedOsAccountIds(): Promise<Array<number>>;
```
- 变更后:
```ts
getActivatedOsAccountLocalIds(callback: AsyncCallback<Array<number>>): void;
getActivatedOsAccountLocalIds(): Promise<Array<number>>;
```
## cl.account_os_account.9 系统帐号queryOsAccountLocalIdBySerialNumber命名变更
queryOsAccountLocalIdBySerialNumber由于命名不统一问题,名称变更为getOsAccountLocalIdForSerialNumber。
**变更影响**
queryOsAccountLocalIdBySerialNumber接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForSerialNumber代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
queryOsAccountLocalIdBySerialNumber
...
}
```
- 变更前:
```ts
queryOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback<number>): void;
queryOsAccountLocalIdBySerialNumber(serialNumber: number): Promise<number>;
```
- 变更后:
```ts
getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback<number>): void;
getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise<number>;
```
## cl.account_os_account.10 系统帐号querySerialNumberByOsAccountLocalId命名变更
querySerialNumberByOsAccountLocalId由于命名不统一问题,名称变更为getSerialNumberForOsAccountLocalId。
**变更影响**
querySerialNumberByOsAccountLocalId接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getSerialNumberForOsAccountLocalId代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
querySerialNumberByOsAccountLocalId
...
}
```
- 变更前:
```ts
querySerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void;
querySerialNumberByOsAccountLocalId(localId: number): Promise<number>;
```
- 变更后:
```ts
getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void;
getSerialNumberForOsAccountLocalId(localId: number): Promise<number>;
```
## cl.account_os_account.11 系统帐号getBundleIdFromUid命名变更
getBundleIdFromUid由于命名不统一问题,名称变更为getBundleIdForUid。
**变更影响**
getBundleIdFromUid接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getBundleIdForUid代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
getBundleIdFromUid
...
}
```
- 变更前:
```ts
getBundleIdFromUid(uid: number, callback: AsyncCallback<number>): void;
getBundleIdFromUid(uid: number): Promise<number>;
```
- 变更后:
```ts
getBundleIdForUid(uid: number, callback: AsyncCallback<number>): void;
getBundleIdForUid(uid: number): Promise<number>;
```
## cl.account_os_account.12 系统帐号queryOsAccountConstraintSourceTypes命名变更
queryOsAccountConstraintSourceTypes由于命名不统一问题,名称变更为getOsAccountConstraintSourceTypes。
**变更影响**
queryOsAccountConstraintSourceTypes接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountConstraintSourceTypes代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
queryOsAccountConstraintSourceTypes
...
}
```
- 变更前:
```ts
queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>): void;
queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>;
```
- 变更后:
```ts
getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>): void;
getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>;
```
\ No newline at end of file
# ANS通知子系统ChangeLog
## cl.notificationManager.1 接口名变更
基于此前接口名定义不够规范,与其他功能类型的接口命名不一致,对此接口名进行变更。
**变更影响**
底层仍支持原接口功能,不影响4.0.2.3版本调用该接口的应用。
**关键接口/组件变更**
| 包名 | 旧接口 | 新接口 |
| --------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| ohos.notificationManager.d.ts | **function** supportDoNotDisturbMode(callback: AsyncCallback<boolean>): **void**; | **function** isSupportDoNotDisturbMode(callback: AsyncCallback<boolean>): **void**; |
| ohos.notificationManager.d.ts | **function** supportDoNotDisturbMode(): Promise<boolean>; | **function** isSupportDoNotDisturbMode(): Promise<boolean>; |
**适配指导**
按新的接口isSupportDoNotDisturbMode调用。
......@@ -161,5 +161,4 @@ https://releases.llvm.org/15.0.0/docs/ReleaseNotes.html
**适配指导**
详细修改信息以及适配指导见官方文档
详细修改信息以及适配指导见官方文档
\ 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-observed-and-objectlink.md)
## cl.arkui.3 List组件和Scroll组件onScrollBegin事件变更
List组件和Scroll组件onScrollBegin事件更名为onScrollFrameBegin事件,onScrollBegin事件中dx和dy参数分别表示X轴和Y轴方向滚动偏移量,更变为onScrollFrameBegin事件后使用offset参数表示滚动偏移量。onScrollFrameBegin事件新增ScrollState参数,用于表示当前时手指拖动滑动状态还是惯性滑动状态。
**变更影响**
onScrollBegin事件不能再使用,需要使用onScrollFrameBegin事件。
**关键接口/组件变更**
| 旧事件定义 | 新事件定义 |
| ---------------------------------------- | ---------------------------------------- |
| onScrollBegin(event: (dx: number, dy: number) => { dxRemain: number, dyRemain: number }) | onScrollFrameBegin(event: (offset: number, state: ScrollState) => { offsetRemain: number }) |
onScrollFrameBegin事件说明参考API接口文档:
- [Scroll组件事件](../../../application-dev/reference/arkui-ts/ts-container-scroll.md#事件)
- [List组件事件](../../../application-dev/reference/arkui-ts/ts-container-list.md#事件)
**适配指导**
onScrollBegin改成使用onScrollFrameBegin事件,onScrollBegin事件的dx/dy参数改成onScrollFrameBegin事件的offset参数。原本需要更滚动组件的滚动轴来确定是使用dx还dy参数,使用onScrollFrameBegin事件后,只需要直接使用offset参数。
onScrollBegin事件典型使用示例:
```ts
@Entry
@Component
struct NestedScroll {
@State listPosition: number = 0; // 0代表滚动到List顶部,1代表中间值,2代表滚动到List底部。
private arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
private scrollerForScroll: Scroller = new Scroller()
private scrollerForList: Scroller = new Scroller()
build() {
Flex() {
Scroll(this.scrollerForScroll) {
Column() {
Text("Scroll Area")
.width("100%").height("40%").backgroundColor(0X330000FF)
.fontSize(16).textAlign(TextAlign.Center)
.onClick(() => {
this.scrollerForList.scrollToIndex(5)
})
List({ space: 20, scroller: this.scrollerForList }) {
ForEach(this.arr, (item) => {
ListItem() {
Text("ListItem" + item)
.width("100%").height("100%").borderRadius(15)
.fontSize(16).textAlign(TextAlign.Center).backgroundColor(Color.White)
}.width("100%").height(100)
}, item => item)
}
.width("100%")
.height("50%")
.edgeEffect(EdgeEffect.None)
.onReachStart(() => {
this.listPosition = 0
})
.onReachEnd(() => {
this.listPosition = 2
})
.onScrollBegin((dx: number, dy: number) => {
if ((this.listPosition == 0 && dy >= 0) || (this.listPosition == 2 && dy <= 0)) {
this.scrollerForScroll.scrollBy(0, -dy)
return { dxRemain: dx, dyRemain: 0 }
}
this.listPosition = 1
return { dxRemain: dx, dyRemain: dy };
})
Text("Scroll Area")
.width("100%").height("40%").backgroundColor(0X330000FF)
.fontSize(16).textAlign(TextAlign.Center)
}
}
.width("100%").height("100%")
}.width('100%').height('100%').backgroundColor(0xDCDCDC).padding(20)
}
}
```
改成onScrollFrameBegin事件参考代码如下:
```ts
@Entry
@Component
struct NestedScroll {
@State listPosition: number = 0; // 0代表滚动到List顶部,1代表中间值,2代表滚动到List底部。
private arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
private scrollerForScroll: Scroller = new Scroller()
private scrollerForList: Scroller = new Scroller()
build() {
Flex() {
Scroll(this.scrollerForScroll) {
Column() {
Text("Scroll Area")
.width("100%").height("40%").backgroundColor(0X330000FF)
.fontSize(16).textAlign(TextAlign.Center)
.onClick(() => {
this.scrollerForList.scrollToIndex(5)
})
List({ space: 20, scroller: this.scrollerForList }) {
ForEach(this.arr, (item) => {
ListItem() {
Text("ListItem" + item)
.width("100%").height("100%").borderRadius(15)
.fontSize(16).textAlign(TextAlign.Center).backgroundColor(Color.White)
}.width("100%").height(100)
}, item => item)
}
.width("100%")
.height("50%")
.edgeEffect(EdgeEffect.None)
.onReachStart(() => {
this.listPosition = 0
})
.onReachEnd(() => {
this.listPosition = 2
})
.onScrollFrameBegin((offset: number, state: ScrollState) => {
if ((this.listPosition == 0 && offset >= 0) || (this.listPosition == 2 && offset <= 0)) {
this.scrollerForScroll.scrollBy(0, -offset)
return { offsetRemain: 0 }
}
this.listPosition = 1
return { offsetRemain: offset };
})
Text("Scroll Area")
.width("100%").height("40%").backgroundColor(0X330000FF)
.fontSize(16).textAlign(TextAlign.Center)
}
}
.width("100%").height("100%")
}.width('100%').height('100%').backgroundColor(0xDCDCDC).padding(20)
}
}
```
## cl.arkui.4 getInspectorTree接口返回值从string修改为Object。
**变更影响**
4.0.3.2之前使用getInspectorTree接口的代码需要适配
**关键的接口/组件变更**
getInspectorTree接口返回值从string修改为Object
**适配指导**
将getInspectorTree返回值作为string使用的代码需要修改,比如以下示例代码:
```typescript
console.info(getInspectorTree())
```
需要修改成
```typescript
console.info(JSON.stringify(getInspectorTree()))
```
## cl.arkui.5 废弃GridItem的forceRebuild属性
**变更影响**
无,该属性无作用
**关键的接口/组件变更**
GridItem的forceRebuild属性废弃
**适配指导**
如有使用可以直接删除,不影响GridItem功能
## cl.arkui.6 API9 router接口整改。
ohos.router中的enableAlertBeforeBackPage、enableBackPageAlert、disableAlertBeforeBackPage接口名不利于开发者理解,更改为showAlertBeforeBackPage、hideAlertBeforeBackPage。
**变更影响**
router的enableAlertBeforeBackPage、enableBackPageAlert接口需替换为showAlertBeforeBackPage;
disableAlertBeforeBackPage接口需替换为hideAlertBeforeBackPage。
**关键的接口/组件变更**
涉及router.enableAlertBeforeBackPage, router.enableBackPageAlert, router.disableAlertBeforeBackPage。
* 变更前:
```ts
router.enableAlertBeforeBackPage();
router.enableBackPageAlert()
```
* 变更后:
```ts
router.showAlertBeforeBackPage()
```
* 变更前:
```ts
router.disableAlertBeforeBackPage()
```
* 变更后:
```ts
router.hideAlertBeforeBackPage()
```
**适配指导**
将enableAlertBeforeBackPage、enableBackPageAlert替换为showAlertBeforeBackPage;
将disableAlertBeforeBackPage替换为hideAlertBeforeBackPage。
## cl.arkui.7 List组件和Gird组件滚动条默认状态变更
## cl.arkui.1 List组件和Gird组件滚动条默认状态变更
List组件和Gird组件滚动条默认状态从BarState.Off变更为BarState.Auto。
......@@ -483,7 +45,7 @@ struct ListItemExample {
}
```
## cl.arkui.8 修复Stack布局问题
## cl.arkui.2 修复Stack布局问题
修复问题:[Stack](../../../application-dev/reference/arkui-ts/ts-container-stack.md)设置alignContent,在子组件超出父组件的场景中,子组件未按照alignContent布局
示例:
......@@ -513,4 +75,12 @@ struct StackExample {
**适配指导**
去掉之前给子组件设置的Offset或者translate,使用alignContent实际布局方式进行布局。
\ No newline at end of file
去掉之前给子组件设置的Offset或者translate,使用alignContent实际布局方式进行布局。
## cl.arkui.3 Button组件hover状态效果变更
Button组件的hover状态由100-105%放大效果变更为0-5%不透明度的叠加效果,hover状态切换到press状态的效果变更为5-10%不透明度的叠加效果。
**变更影响**
影响Button的hover状态的视觉效果以及hover状态切换到press状态的视觉效果。
\ No newline at end of file
......@@ -11,143 +11,4 @@
不涉及接口及组件变更
**适配指导**<br>
资源管理子系统提供Js接口访问资源文件。参考[访问资源文件](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md#getrawfilecontent9)
## cl.bundlemanager.2 包管理删除@ohos.bundle.bundleManager.d.ts中的getAbilityIcon接口,可以使用@ohos.resourceManager.d.ts中的getMediaContent替换。
包管理删除[@ohos.bundle.bundleManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleManager.d.ts)中的getAbilityIcon接口,可以使用[@ohos.resourceManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.resourceManager.d.ts)中的getMediaContent替换。
**变更影响**<br>
使用之前已发布的API 9各beta版本且使用到了getAbilityIcon接口的,需要改为使用getMediaContent接口。
**关键的接口/组件变更**<br>
删除@ohos.bundle.bundleManager.d.ts中的getAbilityIcon接口。
**适配指导**<br>
使用@ohos.bundle.bundleManager.d.ts下面的getAbilityIcon,需要修改为@ohos.resourceManager.d.ts中的getMediaContent。需要提前获取到图标的资源ID值,可参考该接口的[使用指导](../../../application-dev/reference/apis/js-apis-resource-manager.md#getmediacontent9)
## cl.bundlemanager.3 包管理新增202错误码
包管理系统新增202错误码,非系统应用调用api9及之后包管理提供的系统api,将返回错误202。
**变更影响**<br>
非系统应用调用api9及之后包管理提供的系统api,将返回错误202。
**关键的接口/组件变更**<br>
所有包管理提供的api9及之后的系统api,非系统应用调用将返回错误202。
**适配指导**<br>
不影响已开发的程序,无需适配。
## cl.bundlemanager.4 包管理底层能力变更,仅支持系统资源HAP自定义权限,其它HAP均不支持自定义权限。
仅支持系统资源HAP自定义权限,其它HAP均不支持自定义权限。包管理在解析HAP时,仅支持解析资源HAP(包名为:ohos.global.systemres)的配置文件中的definePermissions字段,该字段用来定义权限。其它HAP中配置的definePermissions字段将不会解析。
如果有应用需要自定义权限,可以在资源HAP的[配置文件](https://gitee.com/openharmony/utils_system_resources/blob/master/systemres/main/config.json)中definePermissions字段下面新增定义权限。格式可参考[定义权限](../../../application-dev/quick-start/module-structure.md#definepermissions对象内部结构)
**变更影响**<br>
升级新版本镜像后,应用自定义的权限将不会生效,使用方在申请该权限时,会授权失败。
**关键的接口/组件变更**<br>
包管理底层能力变更,仅支持系统资源HAP自定义权限,其它HAP均不支持自定义权限。
**适配指导**<br>
如果有应用需要自定义权限,可以在资源HAP的[配置文件](https://gitee.com/openharmony/utils_system_resources/blob/master/systemres/main/config.json)中definePermissions字段下面新增定义权限。格式可参考[定义权限](../../../application-dev/quick-start/module-structure.md#definepermissions对象内部结构)
## cl.bundlemanager.5 包管理二级模块文件名称变更,修改为文件内对应的接口名称
包管理二级模块文件名称变更,修改为文件内对应的接口名称,变更文件如下:
| 原文件名称 |变更后文件名称 |
|----|----|
| bundleManager/abilityInfo.d.ts | bundleManager/AbilityInfo.d.ts |
| bundleManager/applicationInfo.d.ts | bundleManager/ApplicationInfo.d.ts |
| bundleManager/bundleInfo.d.ts | bundleManager/BundleInfo.d.ts |
| bundleManager/dispatchInfo.d.ts | bundleManager/DispatchInfo.d.ts |
| bundleManager/elementName.d.ts | bundleManager/ElementName.d.ts |
| bundleManager/extensionAbilityInfo.d.ts | bundleManager/ExtensionAbilityInfo.d.ts |
| bundleManager/hapModuleInfo.d.ts | bundleManager/HapModuleInfo.d.ts |
| bundleManager/launcherAbilityInfo.d.ts | bundleManager/LauncherAbilityInfo.d.ts |
| bundleManager/metadata.d.ts | bundleManager/Metadata.d.ts |
| bundleManager/packInfo.d.ts | bundleManager/BundlePackInfo.d.ts |
| bundleManager/permissionDef.d.ts | bundleManager/PermissionDef.d.ts |
| bundleManager/remoteAbilityInfo.d.ts | bundleManager/RemoteAbilityInfo.d.ts |
| bundleManager/shortcutInfo.d.ts | bundleManager/ShortcutInfo.d.ts |
除了免安装相关的BundlePackInfo文件名称增加了Bundle,其余文件名称均是修改为大写开头。
**变更影响**<br>
仅修改二级模块文件名称,不会影响一级模块的使用。在使用之前已发布的API 9各beta版本时,如果在ts文件中直接导入了bundleManager下面二级模块接口的,IDE中编译报错的话,需要修改导入的文件名称。
**关键的接口/组件变更**<br>
变更bundleManager文件夹下面的d.ts名称,修改为文件中的接口名称。
**适配指导**<br>
使用新的sdk后,正常情况下应用无需适配该变更。如果在应用中直接导入了bundleManager文件夹下面的文件,则需要修改导入的文件名称。可以按照如下的修改方式:
**修改前:**
```ts
import {AbilityInfo} from 'bundleManger/abilityInfo';
import {ExtensionAbilityInfo} from 'bundleManger/extensionAbilityInfo';
import {BundlePackInfo} from 'bundleManger/packInfo';
```
**修改后:**
```ts
import {AbilityInfo} from 'bundleManger/AbilityInfo';
import {ExtensionAbilityInfo} from 'bundleManger/ExtensionAbilityInfo';
import {BundlePackInfo} from 'bundleManger/BundlePackInfo';
```
## cl.bundlemanager.6 包管理LaunchType枚举类型名称变更,由STANDARD修改为MULTITON,枚举值不变。
包管理[LaunchType](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleManager.d.ts)枚举类型变更,由STANDARD修改为MULTITON,枚举值不变,表示多实例类型。
**变更影响**<br>
使用之前已发布的API 9各beta版本且使用到了LaunchType.STANDARD的,需要改为使用LaunchType.MULTITON接口。
**关键的接口/组件变更**<br>
LaunchType枚举类型名称变更,由LaunchType.STANDARD修改为LaunchType.MULTITON。
**适配指导**<br>
由LaunchType.STANDARD修改为LaunchType.MULTITON。
## cl.bundlemanager.7 包管理AbilityInfo结构体中isVisible字段修改为exported,类型不变。
包管理[AbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/AbilityInfo.d.ts)结构体中isVisible字段修改为exported,类型不变,表示当前ability是否支持导出,被其他的ability使用。
**变更影响**<br>
使用之前已发布的API 9各beta版本且使用到了isVisible的,需要改为使用exported。
**关键的接口/组件变更**<br>
包管理[AbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/AbilityInfo.d.ts)结构体中isVisible字段修改为exported,类型不变。
**适配指导**<br>
由isVisible修改为exported。
## cl.bundlemanager.8 包管理ExtensionAbilityInfo结构体中isVisible字段修改为exported,类型不变。
包管理[ExtensionAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ExtensionAbilityInfo.d.ts)结构体中isVisible字段修改为exported,类型不变,表示当前ability是否支持导出,被其他的ability使用。
**变更影响**<br>
使用之前已发布的API 9各beta版本且使用到了isVisible的,需要改为使用exported。
**关键的接口/组件变更**<br>
包管理[ExtensionAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ExtensionAbilityInfo.d.ts)结构体中isVisible字段修改为exported,类型不变。
**适配指导**<br>
由isVisible修改为exported。
## cl.bundlemanager.9 包管理ModuleAbilityInfo结构体中visible字段修改为exported,类型不变。
包管理[ModuleAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundlePackInfo.d.ts)结构体中visible字段修改为exported,类型不变,表示当前ability是否支持导出,被其他的ability使用。
**变更影响**<br>
使用之前已发布的API 9各beta版本且使用到了visible的,需要改为使用exported。
**关键的接口/组件变更**<br>
包管理[ModuleAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundlePackInfo.d.ts)结构体中visible字段修改为exported,类型不变。
**适配指导**<br>
由visible修改为exported。
资源管理子系统提供Js接口访问资源文件。参考[访问资源文件](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md#getrawfilecontent9)
\ No newline at end of file
# 公共事件子系统ChangeLog
## cl.ces.1 ohos.commonEvent中Support事件枚举值修改。
**变更影响**
4.0.3.2之前使用ohos.commonEvent的下面的公共事件需要修改适配。
| 公共事件名 |
| ----------------------------------- |
| COMMON_EVENT_PACKAGE_CACHE_CLEARED |
| COMMON_EVENT_USB_STATE |
| COMMON_EVENT_USB_PORT_CHANGED |
| COMMON_EVENT_VOLUME_REMOVED |
| COMMON_EVENT_VOLUME_UNMOUNTED |
| COMMON_EVENT_VOLUME_MOUNTED |
| COMMON_EVENT_VOLUME_BAD_REMOVAL |
| COMMON_EVENT_VOLUME_EJECT |
| COMMON_EVENT_SLOT_CHANGE |
| COMMON_EVENT_SPN_INFO_CHANGED |
| COMMON_EVENT_QUICK_FIX_APPLY_RESULT |
**关键的接口/组件变更**
下面修改的ohos.commonEvent中的公共事件替换到ohos.commonEventManager中。
| 模块 | ohos.commonEvent | ohos.commonEventManager |
| ---------- | ----------------------------------- | ----------------------------------- |
| | COMMON_EVENT_PACKAGE_CACHE_CLEARED | COMMON_EVENT_PACKAGE_CACHE_CLEARED |
| | COMMON_EVENT_USB_STATE | COMMON_EVENT_USB_STATE |
| | COMMON_EVENT_USB_PORT_CHANGED | COMMON_EVENT_USB_PORT_CHANGED |
| | COMMON_EVENT_VOLUME_REMOVED | COMMON_EVENT_VOLUME_REMOVED |
| | COMMON_EVENT_VOLUME_UNMOUNTED | COMMON_EVENT_VOLUME_UNMOUNTED |
| **事件名** | COMMON_EVENT_VOLUME_MOUNTED | COMMON_EVENT_VOLUME_MOUNTED |
| | COMMON_EVENT_VOLUME_BAD_REMOVAL | COMMON_EVENT_VOLUME_BAD_REMOVAL |
| | COMMON_EVENT_VOLUME_EJECT | COMMON_EVENT_VOLUME_EJECT |
| | COMMON_EVENT_SLOT_CHANGE | COMMON_EVENT_SLOT_CHANGE |
| | COMMON_EVENT_SPN_INFO_CHANGED | COMMON_EVENT_SPN_INFO_CHANGED |
| | COMMON_EVENT_QUICK_FIX_APPLY_RESULT | COMMON_EVENT_QUICK_FIX_APPLY_RESULT |
**适配指导**
将调用ohos.commonEvent中的事件替换成调用@ohos.commonEventManager,比如以下示例代码:
```typescript
import commonEvent from '@ohos.commonEvent';
let event: string = commonEvent.Support.COMMON_EVENT_PACKAGE_CACHE_CLEARED;
```
需要修改成
```typescript
import commonEventManager from '@ohos.commonEventManager';
let event: string = commonEventManager.Support.COMMON_EVENT_PACKAGE_CACHE_CLEARED;
```
# 通用能力ChangeLog
## cl.common.1 SystemAPI使用规则变更
目前子系统提供的system-api在调用时未做系统应用校验,三方应用使用Full版本的SDK就可以使用这些system-api,存在安全隐患,因此在OpenHarmony 4.0.2.1版本开始增加应用身份校验。
**变更影响**
只有系统应用允许使用system-api,三方应用使用system-api将返回202错误,返回202错误的方式有两种:1.抛异常;2.异步回调
**适配指导**
非系统应用使用systemapi有两种方法:1.申请系统应用权限 2.更换接口使用
# 分布式数据管理子系统JS API变更Changelog
## cl.distributeddatamgr.1 接口变更
distributeddatamgr子系统relationalStore组件接口存在变更:
变更前:
应用调用getRdbStore接口后,通过返回对象rdbStore的openStatus属性(openStatus == ON_CREATE)判断数据库是否为新创建。
变更后:
应用调用getRdbStore接口后,通过返回对象rdbStore的version属性(version == 0)判断数据库是否为新创建。
开发者需要根据以下说明对应用进行适配。
**变更影响**
影响API10版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。
**关键的接口/组件变更**
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| ------------------------------ | --------------- | ---------------- | ------- |
| @ohos.data.relationalStore | RdbStore | openStatus: number; 改为 version: number; | 变更 |
**适配指导**
应用中设置和获取数据库版本可参考下列代码:
```ts
const STORE_CONFIG = {
name: "rdbstore.db",
securityLevel: data_rdb.SecurityLevel.S1
}
data_rdb.getRdbStore(this.context, STORE_CONFIG, function (err, rdbStore) {
// 变更前:
// if (rdbStore.openStatus == ON_CREATE) {
// rdbStore.executeSql("CREATE TABLE IF NOT EXISTS student (id INTEGER PRIMARY KEY AUTOINCREMENT, score REAL);", null) // create table xxx
// }
// 变更后:
if (rdbStore.version == 0) {
rdbStore.executeSql("CREATE TABLE IF NOT EXISTS student (id INTEGER PRIMARY KEY AUTOINCREMENT, score REAL);", null) // create table xxx
// 设置数据库版本,值为大于0的正整数
rdbStore.version == 3
}
// 获取数据库版本
console.info("Get RdbStore version is " + rdbStore.version)
})
```
\ No newline at end of file
# 文件管理子系统ChangeLog
## cl.filemanagement.1 environment模块变更
文件管理子系统d.ts归档整改,现统一整改到file一层目录下。environment模块支持错误码处理。
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现environment模块支持错误码处理,需注意错误码处理的使用。
**关键接口/组件变更**
原environment使用的是@ohos.environment,以以下方式import:
```js
import environment from '@ohos.environment';
```
现environment使用的是@ohos.file.environment,以以下方式import:
```js
import environment from '@ohos.file.environment';
```
## cl.filemanagement.2 securityLabel模块变更
文件管理子系统d.ts归档整改,现统一整改到file一层目录下。securityLabel模块支持错误码处理。
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现securityLabel模块支持错误码处理,需注意错误码处理的使用。
**关键接口/组件变更**
原securityLabel使用的是@ohos.securityLabel,以以下方式import:
```js
import securityLabel from '@ohos.securityLabel';
```
现securityLabel使用的是@ohos.file.securityLabel,以以下方式import:
```js
import securityLabel from '@ohos.file.securityLabel';
```
## cl.filemanagement.3 fs模块变更
fs模块下Stat接口ino属性类型变更。
**变更影响**
fs模块下Stat接口ino属性类型变更,由number变更为bigint,以适配文件系统下所有类型文件的inode范围。
**关键接口/组件变更**
原Stat接口ino属性类型为number,现变更为bigint。
## cl.filemanagement.4 fileAccess模块变更
文件管理子系统d.ts归档整改,现统一整改到file一层目录下。fileAccess模块支持错误码处理。
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现fileAccess模块支持错误码处理,需注意错误码处理的使用。
**关键接口/组件变更**
原fileAccess使用的是@ohos.data.fileAccess,以以下方式import:
```js
import fileAccess from '@ohos.data.fileAccess';
```
现fileAccess使用的是@ohos.file.fileAccess,以以下方式import:
```js
import fileAccess from '@ohos.file.fileAccess';
```
## cl.filemanagement.5 fileExtensionInfo模块变更
文件管理子系统d.ts归档整改,现统一整改到file一层目录下。fileExtensionInfo模块支持错误码处理。
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现fileExtensionInfo模块支持错误码处理,需注意错误码处理的使用。
**关键接口/组件变更**
原fileExtensionInfo使用的是@ohos.fileExtensionInfo,以以下方式import:
```js
import fileExtensionInfo from '@ohos.fileExtensionInfo';
```
现fileExtensionInfo使用的是@ohos.file.fileExtensionInfo,以以下方式import:
```js
import fileExtensionInfo from '@ohos.file.fileExtensionInfo';
```
## cl.filemanagement.6 storageStatistics模块变更
文件管理子系统d.ts归档整改,现统一整改到file一层目录下。fileExtensionInfo模块支持错误码处理。
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现storageStatistics模块支持错误码处理,需注意错误码处理的使用。
**关键接口/组件变更**
原storageStatistics使用的是@ohos.storageStatistics,以以下方式import:
```js
import storageStatistics from '@ohos.storageStatistics';
```
现storageStatistics使用的是@ohos.file.storageStatistics,以以下方式import:
```js
import storageStatistics from '@ohos.file.storageStatistics';
```
## cl.filemanagement.7 volumeManager模块变更
文件管理子系统d.ts归档整改,现统一整改到file一层目录下。fileExtensionInfo模块支持错误码处理。
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现volumeManager模块支持错误码处理,需注意错误码处理的使用。
**关键接口/组件变更**
原volumeManager使用的是@ohos.volumeManager,以以下方式import:
```js
import volumeManager from '@ohos.volumeManager';
```
现volumeManager使用的是@ohos.file.volumeManager,以以下方式import:
```js
import volumeManager from '@ohos.file.volumeManager';
```
## cl.filemanagement.8 Filter类型模块变更
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现Filter类型变更至@ohos.file.fs模块下。Filter类型具体属性不变。
**关键接口/组件变更**
原Filter类型在模块@ohos.fileio下,通过以下方式import:
```js
import Filter from '@ohos.fileio';
```
**适配指导**
现Filter类型在模块@ohos.file.fs,通过以下方式import:
```js
import Filter from '@ohos.file.fs';
```
# 位置服务子系统ChangeLog
## cl.location.1 删除API9接口geoLocationManager.requestEnableLocation
在位置开关关闭的场景下,应用可以调用geoLocationManager.requestEnableLocation接口,以请求用户开启位置开关;实际该接口使用较少,并且该接口用户体验不太好,并没有告诉用户该应用在什么场景下使用位置信息。
因此变更为由应用本身弹框请求用户跳转到settings开启位置开关,并且在弹框上写清楚会在什么场景下使用位置信息,这样用户体验更好。
**变更影响**
在API9上应用无法使用geoLocationManager.requestEnableLocation请求用户开启位置开关,需要应用自己实现弹框,请求用户开启位置开关。
**关键的接口/组件变更**
| 类名 | 接口类型 | 接口声明 | 变更类型 |
| -- | -- | -- | -- |
|geoLocationManager| method | function requestEnableLocation(callback: AsyncCallback&lt;boolean&gt;): void; | 该接口从API9中删除 |
|geoLocationManager| method | function requestEnableLocation(): Promise&lt;boolean&gt;; | 该接口从API9中删除 |
# 全球化子系统ChangeLog
## cl.global.1 国际化模块系统接口添加运行时鉴权
全球化子系统国际化组件在如下场景中提供的系统接口添加运行时鉴权。从API9开始作以下变更:
- 设置系统语言、系统国家或地区、系统区域
- 设置系统24小时制
- 添加、移除系统偏好语言
- 设置本地化数字
开发者需要根据以下说明对应用进行适配。
**变更影响**
上述场景涉及的国际化系统接口添加运行时鉴权,只有具有UPDATE_CONFIGURATION权限的系统应用可以正常调用。
**关键的接口/组件变更**
- 涉及接口
- setSystemLanguage(language: string): void;
- setSystemRegion(region: string): void;
- setSystemLocale(locale: string): void;
- set24HourClock(option: boolean): void;
- addPreferredLanguage(language: string, index?: number): void;
- removePreferredLanguage(index: number): void;
- setUsingLocalDigit(flag: boolean): void;
**适配指导**
确保应用为系统应用,非系统应用禁止调用上述接口。
当前权限不足或非系统应用调用该接口时会抛出异常,可以通过try-catch来捕获异常。
```js
import I18n from '@ohos.i18n'
try {
I18n.System.setSystemLanguage('zh');
} catch(error) {
console.error(`call System.setSystemLanguage failed, error code: ${error.code}, message: ${error.message}.`)
}
```
## cl.resourceManager.1 资源获取rawfile文件描述符接口含义变更
......@@ -67,9 +27,9 @@ length: 访问rawfile文件的大小。
**关键接口/组件变更**
| **涉及接口** |
| ---------------- |
| getRawFd(path: string, callback: AsyncCallback\<RawFileDescriptor>): void |
| **涉及接口** |
| ---------------- |
| getRawFd(path: string, callback: AsyncCallback\<RawFileDescriptor>): void |
| getRawFd(path: string): Promise\<RawFileDescriptor> |
| getRawFileDescriptor(path: string, callback: AsyncCallback\<RawFileDescriptor>): void|
| getRawFileDescriptor(path: string): Promise\<RawFileDescriptor>|
......
......@@ -30,71 +30,7 @@ attestKeyItem是基于设备证书链封装业务公钥对用户指定的密钥
已经具备system权限的应用则可以正常使用attestKeyItem接口,其余普通应用需申请ohos.permission.ACCESS_IDS权限即可,申请方法参考[ACL权限配置说明](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/accesstoken-overview.md#%E8%AE%BF%E9%97%AE%E6%8E%A7%E5%88%B6%E5%88%97%E8%A1%A8acl%E8%AF%B4%E6%98%8E)
## cl.huks.2 HUKS支持可选设置rsa_pss_salt_length类型
变更之前,应用在签名/验签时,HUKS默认使用RSA_PSS_SALT_LEN_MAX进行处理;
变更之后,应用在签名/验签需传入HuksRsaPssSaltLenType中定义的类型。若不传入,则默认使用RSA_PSS_SALT_LEN_MAX进行处理。
**变更影响**
影响已发布的JS接口,接口行为发生变更。
**关键的接口/组件变更**
发布的JS接口不变, 传入接口的参数集合发生变更。
**适配指导**
以RSA签名为例,示例代码如下:
```js
import huks from '@ohos.security.huks';
let keyAlias = 'rsa_Key';
let inData = new Uint8Array(
0x4B, 0x1E, 0x22, 0x64, 0xA9, 0x89, 0x60, 0x1D, 0xEC, 0x78, 0xC0, 0x5D, 0xBE, 0x46, 0xAD, 0xCF,
0x1C, 0x35, 0x16, 0x11, 0x34, 0x01, 0x4E, 0x9B, 0x7C, 0x00, 0x66, 0x0E, 0xCA, 0x09, 0xC0, 0xF3,
);
/* 签名参数 */
let signProperties = new Array();
signProperties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_RSA,
}
signProperties[1] = {
tag: huks.HuksTag.HUKS_TAG_PURPOSE,
value:
huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN
}
signProperties[2] = {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
}
signProperties[3] = {
tag: huks.HuksTag.HUKS_TAG_PADDING,
value: huks.HuksKeyPadding.HUKS_PADDING_PSS,
}
signProperties[4] = {
tag: huks.HuksTag.HUKS_TAG_DIGEST,
value: huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
}
signProperties[5] = {
tag: huks.HuksTag.HUKS_TAG_RSA_PSS_SALT_LEN_TYPE,
value: huks.HuksRsaPssSaltLenType.HUKS_RSA_PSS_SALT_LEN_MAX,
}
let signOptions = {
properties: signProperties,
inData: inData
}
huks.initSession(keyAlias, signOptions);
```
更多接口的示例代码可参考[HUKS-guidelines](../../../application-dev/security/huks-guidelines.md)[HUKS API](../../../application-dev/reference/apis/js-apis-huks.md)
## cl.huks.3 HUKS解决派生密钥/协商密钥的存储/导出问题
## cl.huks.2 HUKS解决派生密钥/协商密钥的存储/导出问题
变更之前,派生密钥/协商密钥既支持存储,又支持导出,存在安全风险;
......@@ -111,19 +47,3 @@ huks.initSession(keyAlias, signOptions);
**适配指导**
接口使用的示例代码可参考[HUKS-guidelines](../../../application-dev/security/huks-guidelines.md)[HUKS API](../../../application-dev/reference/apis/js-apis-huks.md)
## cl.huks.3 新增用于细粒度用户身份访问控制的Tag
新增用于细粒度用户身份访问控制的HuksTag: HUKS_TAG_KEY_AUTH_PURPOSE,业务可在原有用户身份访问控制能力上,选择某种特定算法用途下需要用户身份访问控制能力。
**变更影响**
新增的HuksTag,不影响已有的接口。
**关键的接口/组件变更**
只新增了HuksTag: HUKS_TAG_KEY_AUTH_PURPOSE, 用于支持细粒度用户身份访问控制。
**适配指导**
接口使用的示例代码可参考[密钥访问控制_细粒度用户身份认证访问控制](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/huks-guidelines.md#%E5%AF%86%E9%92%A5%E8%AE%BF%E9%97%AE%E6%8E%A7%E5%88%B6),接口定义参考[HuksTag](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-huks.md#hukstag)
\ No newline at end of file
# 输入法框架子系统-输入法框架服务ChangeLog
## @ohos.InputMethodSubtype 中输入法子类型中name、label、id属性值变更
从API9开始,变更如上三个属性值
开发者需要根据以下说明对应用进行适配。
**变更影响**
此三个属性的取值发生变化,需要开发者进行适配更新
| 名称 | 变更前 | 变更后 |
| -------- | -------- | -------- |
| label | (1)取值:输入法子类型的id。| (1)取值:输入法子类型的标签。|
| name | (1)说明:输入法子类型的名字;(2)取值:输入法子类型的标签。| (1)说明:输入法应用的包名;(2)取值:输入法应用的包名。|
| id | (1)取值:输入法应用的包名。| (1)取值:输入法子类型的id。|
**适配指导**
请按上述取值变更结果适配更新。
# 泛Sensor子系统Changelog
## cl.vibrator.isSupportEffect接口新增
新增isSupportEffect接口。
**变更影响**
基于OpenHarmony4.0.5.2及之后的SDK版本开发的应用,可使用isSupportEffect接口查询传入effectId是否支持。
**关键接口/组件变更**
@ohos.vibrator.d.ts中新增isSupportEffect接口。
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| -- | -- | -- | -- |
| @ohos.vibrator.d.ts | vibrator | isSupportEffect(effectId: string, callback: AsyncCallback&lt;boolean&gt;): void | 新增 |
| @ohos.vibrator.d.ts | vibrator | isSupportEffect(effectId: string): Promise&lt;boolean&gt; | 新增 |
**适配指导**<br>
通过调用isSupportEffect接口查询是否支持传入的参数effectId。
```ts
import vibrator from '@ohos.vibrator';
try {
// 查询是否支持'haptic.clock.timer'
vibrator.isSupportEffect('haptic.clock.timer', function (err, state) {
if (err) {
console.error('isSupportEffect failed, error:' + JSON.stringify(err));
return;
}
console.log('The effectId is ' + (state ? 'supported' : 'unsupported'));
if (state) {
try {
vibrator.startVibration({ // 使用startVibration需要添加ohos.permission.VIBRATE权限
type: 'preset',
effectId: 'haptic.clock.timer',
count: 1,
}, {
usage: 'unknown'
}, (error) => {
if(error) {
console.error('haptic.clock.timer vibrator error:' + JSON.stringify(error));
} else {
console.log('haptic.clock.timer vibrator success');
}
});
} catch (error) {
console.error('Exception in, error:' + JSON.stringify(error));
}
}
})
} catch (error) {
console.error('Exception in, error:' + JSON.stringify(error));
}
```
## cl.vibrator.stopVibration接口新增
新增stopVibration接口。
**变更影响**
基于OpenHarmony4.0.5.2及之后的SDK版本开发的应用,可使用stopVibration接口停止所有类型的振动。
**关键接口/组件变更**
@ohos.vibrator.d.ts中新增stopVibration接口。
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| ------------------- | -------- | -------------------------------------------------------- | -------- |
| @ohos.vibrator.d.ts | vibrator | stopVibration(callback: AsyncCallback&lt;void&gt;): void | 新增 |
| @ohos.vibrator.d.ts | vibrator | stopVibration(): Promise&lt;void&gt; | 新增 |
**适配指导**<br>
通过调用stopVibration接口停止所有类型的振动。
```ts
import vibrator from '@ohos.vibrator';
try {
// 停止所有模式的马达振动
vibrator.stopVibration(function (error) {
if (error) {
console.log('error.code' + error.code + 'error.message' + error.message);
return;
}
console.log('Callback returned to indicate successful.');
})
} catch (error) {
console.info('errCode: ' + error.code + ' ,msg: ' + error.message);
}
```
# 剪贴板子系统ChangeLog
OpenHarmony 4.0.3.2 版本相较于OpenHarmony 之前的版本,剪贴板子系统的API变更如下。
## cl.pasteboard.1 convertToTextV9接口变更
接口convertToTextV9由于命名规范和接口返回方式问题,名称变更为toPlainText(),返回方式改为同步方式。
**变更影响**
4.0.3.3版本之前使用接口convertToTextV9开发的应用,在4.0.3.3版本及后续版本中无法继续正常使用。
**关键的接口/组件变更**
- 涉及接口
function convertToTextV9
- 变更前:
```ts
convertToTextV9(callback: AsyncCallback<string>): void;
convertToTextV9(): Promise<string>;
```
- 变更后:
```ts
toPlainText(): string;
```
变更前:
**适配指导**
请使用toPlainText替换convertToTextV9,并注意接口返回方式。
## cl.pasteboard.2 ShareOption属性名称变更,删除了未支持的属性
ShareOption枚举命名从**大驼峰**改成了**全大写**
**变更影响**
4.0.3.3版本之前使用InApp/LocalDevice/CrossDevice类型开发的应用,在4.0.3.3版本及后续版本中无法继续正常使用。
**关键接口/组件变更**
ShareOption<sup>9+</sup>
变更前:
| 名称 | 值 | 说明 |
| ---- |---|-------------------|
| InApp | 0 | 表示仅允许同应用内粘贴。 |
| LocalDevice | 1 | 表示允许在此设备中任何应用内粘贴。 |
| CrossDevice | 2 | 表示允许跨设备在任何应用内粘贴。 |
变更后:
| 名称 | 值 | 说明 |
| ---- |---|-------------------|
| INAPP | 0 | 表示仅允许同应用内粘贴。 |
| LOCALDEVICE | 1 | 表示允许在此设备中任何应用内粘贴。 |
| CROSSDEVICE | 2 | 表示允许跨设备在任何应用内粘贴。 |
**适配指导**
按新的语义进行适配。
\ No newline at end of file
# 电源子系统ChangeLog
## cl.powermgr.1 CommonEventBatteryChangedCode接口变更
[ @ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) (电量信息)中的CommonEventBatteryChangedCode枚举类进行如下变更:
- 类名称变更为CommonEventBatteryChangedKey;
- 删除EXTRA_MAX_CURRENT、EXTRA_MAX_VOLTAGE和EXTRA_CHARGE_COUNTER;
- 枚举值类型从数值变更为字符串。
#### 变更影响
基于此前版本开发的应用,需适配接口的变更,否则会影响原有业务逻辑。
#### 关键的接口/组件变更
变更前:
| 名称 | 值 | 说明 |
| -------------------- | ---- | -------------------------------------------------- |
| EXTRA_SOC | 0 | 表示剩余电池电量百分比的查询键。 |
| EXTRA_VOLTAGE | 1 | 表示当前设备电池电压的查询键。 |
| EXTRA_TEMPERATURE | 2 | 表示当前设备电池温度的查询键。 |
| EXTRA_HEALTH_STATE | 3 | 表示当前设备电池健康状态的查询键。 |
| EXTRA_PLUGGED_TYPE | 4 | 表示当前设备连接的充电器类型的查询键。 |
| EXTRA_MAX_CURRENT | 5 | 表示当前设备电池最大电流的查询键。 |
| EXTRA_MAX_VOLTAGE | 6 | 表示当前设备电池最大电压的查询键。 |
| EXTRA_CHARGE_STATE | 7 | 表示当前设备电池充电状态的查询键。 |
| EXTRA_CHARGE_COUNTER | 8 | 表示当前设备电池充电次数的查询键。 |
| EXTRA_PRESENT | 9 | 表示当前设备是否支持电池或者电池是否在位的查询键。 |
| EXTRA_TECHNOLOGY | 10 | 表示当前设备电池技术型号的查询键。 |
| EXTRA_CAPACITY_LEVEL | 11 | 表示当前设备电池电量等级的查询键。 |
变更后:
| 名称 | 值 | 说明 |
| -------------------- | --------------- | -------------------------------------------------- |
| EXTRA_SOC | "soc" | 表示剩余电池电量百分比的查询键。 |
| EXTRA_CHARGE_STATE | "chargeState" | 表示当前设备电池充电状态的查询键。 |
| EXTRA_HEALTH_STATE | "healthState" | 表示当前设备电池健康状态的查询键。 |
| EXTRA_PLUGGED_TYPE | "pluggedType" | 表示当前设备连接的充电器类型的查询键。 |
| EXTRA_VOLTAGE | "voltage" | 表示当前设备电池电压的查询键。 |
| EXTRA_TECHNOLOGY | "technology" | 表示当前设备电池技术型号的查询键。 |
| EXTRA_TEMPERATURE | "temperature" | 表示当前设备电池温度的查询键。 |
| EXTRA_PRESENT | "present" | 表示当前设备是否支持电池或者电池是否在位的查询键。 |
| EXTRA_CAPACITY_LEVEL | "capacityLevel" | 表示当前设备电池电量等级的查询键。 |
#### 适配指导
请参考[@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) (电量信息)接口的API参考。
## cl.powermgr.2 estimatedRemainingChargeTime系统接口变更
[@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) (电量信息)中的estimatedRemainingChargeTime属性变更为系统接口。
#### 变更影响
基于此前版本开发的应用,需适配新的系统权限,否则会影响原有业务逻辑。
#### 适配指导
请参考[@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) (电量信息)接口的API参考。
## cl.powermgr.3 系统公共事件行为变更
电量信息通过[@ohos.commonEventManager (公共事件模块)](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md)提供了如下几种系统公共事件:
- COMMON_EVENT_BATTERY_LOW,表示电池电量低的的公共事件的动作,包含剩余电池电量百分比信息;
- COMMON_EVENT_BATTERY_OKAY,表示电池电量正常的公共事件的动作,包含剩余电池电量百分比信息;
- COMMON_EVENT_POWER_CONNECTED,表示设备连接到外部电源的公共事件的动作,包含设备连接的电源类型信息;
- COMMON_EVENT_POWER_DISCONNECTED,表示设备与外部电源断开的公共事件的动作,包含设备连接的电源类型信息;
- COMMON_EVENT_CHARGING,表示系统开始为电池充电的公共事件的动作,包含充电状态信息;
- COMMON_EVENT_DISCHARGING,表示系统停止为电池充电的公共事件的动作,包含充电状态信息。
这几种公共事件的数据的获取方式从CommonEventData.data变更为CommonEventData.code。
#### 变更影响
基于此前版本开发的应用,需适配新的数据获取方式,否则会影响原有业务逻辑。
#### 适配指导
请参考[ @ohos.commonEventManager (公共事件模块)](../../../application-dev/reference/apis/js-apis-commonEventManager.md)接口的API参考。
# 资源调度子系统ChangeLog
## cl.resourceschedule.workScheduler.1
WorkSchedulerExtensionAbility提供默认的WorkSchedulerExtensionContext。
**变更影响**
基于OpenHarmony4.0.5.1及之后的SDK版本开发的应用,可使用默认的context属性作为WorkSchedulerExtension的上下文环境。
**关键接口/组件变更**
@ohos.WorkSchedulerExtensionAbility.d.ts中新增context属性。新增文件application/WorkSchedulerExtensionContext.d.ts,继承自ExtensionContext。
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| -- | -- | -- | -- |
| @ohos.WorkSchedulerExtensionAbility.d.ts | WorkSchedulerExtensionAbility | context: WorkSchedulerExtensionContext; | 新增 |
| application/WorkSchedulerExtensionContext.d.ts | WorkSchedulerExtensionContext | - | 新增 |
**适配指导**<br>
通过WorkSchedulerExtensionAbility子类实例来获取WorkSchedulerExtensionContext。
```ts
import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility';
class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
onWorkStart(workInfo) {
let WorkSchedulerExtensionContext = this.context; // 获取WorkSchedulerExtensionContext
}
}
```
## cl.resourceschedule.reminderAgent.1
......@@ -42,12 +11,12 @@ class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
**关键接口/组件变更**
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| -- | -- | -- | -- |
| reminderAgentManager | ActionButtonType | ACTION_BUTTON_TYPE_CUSTOM = 2 | 新增 |
| reminderAgentManager | ActionButton | wantAgent?: WantAgent | 新增 |
| reminderAgentManager | WantAgent | uri?: string | 新增 |
| reminderAgentManager | ReminderRequest | actionButton?: [ActionButton?, ActionButton?, ActionButton?] | 变更 |
| reminderAgentManager | ActionButtonType | ACTION_BUTTON_TYPE_CUSTOM = 2 | 新增 |
| reminderAgentManager | ActionButton | wantAgent?: WantAgent | 新增 |
| reminderAgentManager | WantAgent | uri?: string | 新增 |
| reminderAgentManager | ReminderRequest | actionButton?: [ActionButton?, ActionButton?, ActionButton?] | 变更 |
**适配指导**<br>
......@@ -77,31 +46,3 @@ let targetReminderAgent: reminderAgentManager.ReminderRequestAlarm = {
]
}
```
## cl.resourceschedule.reminderAgent.2
提醒代理支持设置通知自动消失和自动消失时间。
**变更影响**
基于OpenHarmony4.0.7.1及之后的SDK版本开发的系统应用,可设置提醒自动消失。
**关键接口/组件变更**
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| -- | -- | -- | -- |
| reminderAgentManager | ReminderRequest | tapDismissed?: boolean | 新增 |
| reminderAgentManager | ReminderRequest | autoDeletedTime?: number | 新增 |
**适配指导**<br>
```ts
import reminderAgentManager from '@ohos.reminderAgentManager';
let targetReminderAgent: reminderAgentManager.ReminderRequestAlarm = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_ALARM, // 提醒类型为闹钟类型
...
tapDismissed: true,
autoDeletedTime: 300,
}
```
\ No newline at end of file
# 主题框架子系统-锁屏管理服务ChangeLog
## cl.screenlock.1 isLocked、unlock接口使用权限变更
从API9开始,变更为systemapi,停止对三方应用开放。
开发者需要根据以下说明对应用进行适配。
**变更影响**
基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。
- 涉及接口
```js
function isLocked(): boolean;
function unlock(callback: AsyncCallback<boolean>): void;
function unlock():Promise<boolean>;
```
- 变更前:
```js
* Checks whether the screen is currently locked.
*
* @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise.
* @syscap SystemCapability.MiscServices.ScreenLock
* @since 9
*/
function isLocked(): boolean;
/**
* Unlock the screen.
*
* @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
* @syscap SystemCapability.MiscServices.ScreenLock
* @systemapi Hide this for inner system use.
* @since 9
*/
function unlock(callback: AsyncCallback<boolean>): void;
/**
* Unlock the screen.
*
* @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
* @syscap SystemCapability.MiscServices.ScreenLock
* @systemapi Hide this for inner system use.
* @since 9
*/
function unlock():Promise<boolean>;
```
- 变更后:
```js
* Checks whether the screen is currently locked.
*
* @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @syscap SystemCapability.MiscServices.ScreenLock
* @systemapi Hide this for inner system use.
* @since 9
*/
function isLocked(): boolean;
/**
* Unlock the screen.
*
* @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
* @syscap SystemCapability.MiscServices.ScreenLock
* @since 9
*/
function unlock(callback: AsyncCallback<boolean>): void;
/**
* Unlock the screen.
*
* @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
* @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
* @syscap SystemCapability.MiscServices.ScreenLock
* @since 9
*/
function unlock():Promise<boolean>;
```
**适配指导**
该接口变更为系统应用后,三方应用已无法使用。
系统应用可正常使用。
示例代码如下:
```js
try {
let ret = screenLock.isLocked();
console.error(`Obtain whether the screen is locked successfully , ret is: ${ret}`);
} catch (error) {
console.error(`Failed to obtain whether the screen is locked, error is : ${error.code}, ${error.message}`);
}
```
```js
screenlock.unlock((err, data) => {
if (err) {
console.error(`Failed to unlock the screen, because: ${err.message}`);
return;
}
console.info(`unlock the screen successfully. result: ${data}`);
});
```
```js
screenlock.unlock().then((data) => {
console.info(`unlock the screen successfully. result: ${data}`);
}).catch((err) => {
console.error(`Failed to unlock the screen, because: ${err.message}`);
});
```
## cl.screenlock.2 isSecure接口废弃变更
从API9开始,废弃此接口。
开发者需要根据以下说明对应用进行适配。
**变更影响**
该接口删除无法再使用,请使用进行更新使用,否则会影响原有功能。
- 涉及接口
```js
function isSecure(): boolean;
```
- 变更前:
```js
function isSecure(): boolean;
```
- 变更后:删除接口,停止对外开放。
**适配指导**
该接口删除后无法再使用,请适配更新。
# security子系统ChangeLog
## cl.security.1 ParamsSpec属性名变更为algName。
结构体ParamsSpec的属性algoName由于API命名统一,名称更改为algName。
**变更影响**
影响已发布的JS接口,对ParamsSpec以及其子类IvParamsSpec,GcmParamsSpec与CcmParamsSpec,使用这些对象作为参数或返回值时,其属性名需要更改为algName。
应用需要进行适配,才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
修改前的接口原型:
```ts
interface ParamsSpec {
/**
* Indicates the algorithm name. Should be set before initialization of a cipher object.
* @type { string }
* @syscap SystemCapability.Security.CryptoFramework
* @since 9
*/
algoName : string;
}
```
修改后的接口原型:
```ts
interface ParamsSpec {
/**
* Indicates the algorithm name. Should be set before initialization of a cipher object.
* @type { string }
* @syscap SystemCapability.Security.CryptoFramework
* @since 9
*/
algName : string;
}
```
**适配指导**
对ParamsSpec以及其子类IvParamsSpec,GcmParamsSpec与CcmParamsSpec,使用这些对象作为参数或返回值时,其属性名需要从algoName更改为algName。
```ts
function genGcmParamsSpec() {
let arr = [0, 0, 0, 0 , 0, 0, 0, 0, 0, 0 , 0, 0]; // 12 bytes
let dataIv = new Uint8Array(arr);
let ivBlob = {data : dataIv};
arr = [0, 0, 0, 0 , 0, 0, 0, 0]; // 8 bytes
let dataAad = new Uint8Array(arr);
let aadBlob = {data : dataAad};
arr = [0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0]; // 16 bytes
let dataTag = new Uint8Array(arr);
let tagBlob = {data : dataTag};
let gcmParamsSpec = {iv : ivBlob, aad : aadBlob, authTag : tagBlob, algName : "GcmParamsSpec"};
return gcmParamsSpec;
}
```
详细查看API参考中ParamsSpec对应的接口适配指南:
[加解密算法库框架-ParamsSpec-API参考](../../../application-dev/reference/apis/js-apis-cryptoFramework.md#paramsspec)
## cl.security.2 ECC密码算法的参数名从ECC512变更为ECC521
**变更影响**
影响已发布的JS接口,接口行为发生变更。
应用需要进行适配,才可以在新版本SDK环境获取正确结果。
**关键的接口/组件变更**
发布的JS接口不变, 传入接口的参数发生变化,由ECC512变化为ECC521,具体可见[加解密算法库框架-ECC密码算法参数参考](../../../application-dev/security/cryptoFramework-overview.md#密钥生成规格),涉及的接口有:
cryptoFramework.createAsyKeyGenerator
cryptoFramework.createSign
cryptoFramework.createVerify
cryptoFramework.createKeyAgreement
**适配指导**
```js
import cryptoFramework from "@ohos.security.cryptoFramework"
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator("ECC521");
```
\ No newline at end of file
# 泛sensor子系统ChangeLog
## cl.ability.1 Sensor接口中venderName属性名称变更,更改为vendorName。
venderName为错别字,更正为vendorName。
**变更影响**
该venderName属性无法再使用,请使用新增属性vendorName替换。
**关键的接口/组件变更**
- 变更前:
```js
interface Sensor {
sensorName:string; /**< Sensor name */
venderName:string; /**< Sensor vendor version */
firmwareVersion:string; /**< Sensor firmware version */
hardwareVersion:string; /**< Sensor hardware version */
sensorId:number; /**< Sensor type ID, {@code SensorType} */
maxRange:number; /**< Maximum measurement range of the sensor */
minSamplePeriod:number; /**< Minimum sample period allowed, in ns */
maxSamplePeriod:number; /**< maximum sample period allowed, in ns */
precision:number; /**< Sensor accuracy */
power:number; /**< Sensor power */
}
```
- 变更后:
```js
interface Sensor {
sensorName:string; /**< Sensor name */
vendorName:string; /**< Sensor vendor version */
firmwareVersion:string; /**< Sensor firmware version */
hardwareVersion:string; /**< Sensor hardware version */
sensorId:number; /**< Sensor type ID, {@code SensorType} */
maxRange:number; /**< Maximum measurement range of the sensor */
minSamplePeriod:number; /**< Minimum sample period allowed, in ns */
maxSamplePeriod:number; /**< maximum sample period allowed, in ns */
precision:number; /**< Sensor accuracy */
power:number; /**< Sensor power */
}
```
**适配指导**
该venderName属性删除无法再使用,请使用新增属性vendorName替换。
\ No newline at end of file
# 软总线子系统ChangeLog
## cl.softbus.1 IPC接口中unregisterDeathRecipient接口返回值变更,更改为void。
unregisterDeathRecipient(recipient: DeathRecipient, flags: number)方法返回值为boolean,更正为void。
**变更影响**
该unregisterDeathRecipient接口如果需要继续使用,建议优先使用removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean方法。
**关键的接口/组件变更**
- 变更前:
```js
unregisterDeathRecipient(recipient: DeathRecipient, flags: number): boolean
```
- 变更后:
```js
unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void
```
**适配指导**
该unregisterDeathRecipient接口如果需要继续使用,建议优先使用removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean方法。
\ No newline at end of file
# 启动子系统JS API变更ChangeLog
## cl.startup.1 包名变更
**变更影响**
原有的@ohos.systemParameterV9包名将被删除无法再使用,需更换为新的@ohos.systemParameterEnhance包名。
**适配指导**
原有的@ohos.systemParameterV9需要变更为@ohos.systemParameterEnhance,包内接口都不变,示例:
```js
import @ohos.systemParameterEnhance
```
# 电话子系统ChangeLog
## cl.telephony.radio.1 isNrSupported接口变更
NR是专有名词,需要全部大写。
开发者需要根据以下说明对应用进行适配。
**变更影响**
基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。
**关键的接口/组件变更**
- 涉及接口
isNrSupported(): boolean;
isNrSupported(slotId: number): boolean;
- 变更前:
```js
function isNrSupported(): boolean;
function isNrSupported(slotId: number): boolean;
```
- 变更后:
```js
function isNRSupported(): boolean;
function isNRSupported(slotId: number): boolean;
```
**适配指导**
使用变更后的接口,示例代码如下:
```js
let result = radio.isNrSupported();
console.log("Result: "+ result);
```
```js
let slotId = 0;
let result = radio.isNRSupported(slotId);
console.log("Result: "+ result);
```
## cl.telephony.call.2 dial接口变更
从API9开始,废弃此接口,改为使用dialCall接口。
开发者需要根据以下说明对应用进行适配。
**变更影响**
该接口删除无法再使用,请使用新增的接口dialCall替换,否则会影响原有功能。
**关键的接口/组件变更**
- 涉及接口
dial(phoneNumber: string, callback: AsyncCallback<boolean>): void;
dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback<boolean>): void;
dial(phoneNumber: string, options?: DialOptions): Promise<boolean>;
- 变更前:
```js
function dial(phoneNumber: string, callback: AsyncCallback<boolean>): void;
function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback<boolean>): void;
function dial(phoneNumber: string, options?: DialOptions): Promise<boolean>;
```
- 变更后:
```js
function dialCall(phoneNumber: string, callback: AsyncCallback<void>): void;
function dialCall(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback<void>): void;
function dialCall(phoneNumber: string, options?: DialCallOptions): Promise<void>;
```
**适配指导**
该接口删除无法再使用,请使用新增的接口dialCall替换。
使用变更后的接口,示例代码如下:
```js
call.dialCall("138xxxxxxxx", (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
```js
call.dialCall("138xxxxxxxx", {
accountId: 0,
videoState: 0,
dialScene: 0,
dialType: 0,
}, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
```js
try {
call.dialCall('138xxxxxxxx');
console.log(`dialCall success, promise: data->${JSON.stringify(data)}`);
} catch (error) {
console.log(`dialCall fail, promise: err->${JSON.stringify(error)}`);
}
```
# 测试子系统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`
# USB服务子系统ChangeLog
## cl.usb_manager.1 系统接口变更
USB系统API运行时鉴权,异步接口以Promise reject形式抛出错误码。
基于此前版本开发的应用,需修改函数的返回值,否则会影响原有业务逻辑。
**关键接口/组件变更**
| 包名 | 旧接口 | 新接口 |
| --------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| ohos.usbV9.d.ts | function setCurrentFunctions(funcs: FunctionType): Promise<boolean>; | function setCurrentFunctions(funcs: FunctionType): Promise<void>; |
| ohos.usbV9.d.ts | function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise<boolean>; | function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise<void>; |
## cl.usb_manager.2 sdk接口删除
继OpenHarmony 4.0.5.5版本3.30之后,@ohos.usbV9.d.ts文件已删除。
后续需要import @ohos.usbManager才能使用USB服务的接口:
```ts
import usbManager from '@ohos.usbManager';
```
**适配指导**
请参考各接口的[API文档](../../../application-dev/reference/apis/js-apis-usbManager.md)
## cl.usb_manager.2 包名变更
基于此前版本开发的应用,需修改导入的包名,否则会影响原有业务逻辑。
**关键接口/组件变更**
| 旧包名 | 新包名 |
|------------------ | ------------------- |
| ohos.usbV9.d.ts | ohos.usbManager.d.ts |
**适配指导**
开发者导入时将@ohos.usbV9更换为@ohos.usbManager即可。
## cl.usb_manager.3 接口参数类型变更
基于此前版本开发的应用,需修改参数类型,否则会影响原有业务逻辑。
**关键接口/组件变更**
| 旧类名 | 新类名 |
|---------------| ------------- |
| interface USBConfig | interface USBConfiguration |
| 旧命名空间 | 新命名空间 |
|---------------| ------------- |
| @namespace usbV9 | @namespace usbManager |
| 包名 | 旧接口 | 新接口 |
| --------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| ohos.usbManager.d.ts | function setConfiguration(pipe: USBDevicePipe, config: USBConfig): number; | function setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): number; |
**适配指导**
调用setConfiguration接口时参数类型USBConfig修改为USBConfiguration即可。
## cl.usb_manager.4 sdk接口删除
基于此前版本开发的应用,需修改导入的包名,否则会影响原有业务逻辑。
**关键接口/组件变更**
@ohos.usbV9.d.ts文件已删除,由@ohos.usbManager.d.ts替代。
| 新包名 | 旧包名 | 已删除包名 |
| -------------------- | ------------- | --------------- |
| ohos.usbManager.d.ts | ohos.usb.d.ts | ohos.usbV9.d.ts |
后续需要import @ohos.usbManager才能使用USB服务的接口:
```ts
import usbManager from '@ohos.usbManager';
```
**适配指导**
请参考各接口的[API文档](../../../application-dev/reference/apis/js-apis-usbManager.md)
# 主题框架子系统-壁纸管理服务ChangeLog
## cl.wallpaper.1 getColorsSync、getMinHeightSync、getMinWidthSync、restore、setImage接口使用权限变更
从API9开始,变更为systemapi,停止对三方应用开放。
开发者需要根据以下说明对应用进行适配。
**变更影响**
基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。
- 涉及接口
```js
function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>;
function getMinHeightSync(): number;
function getMinWidthSync(): number;
function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
function restore(wallpaperType: WallpaperType): Promise<void>;
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>;
```
- 变更前:
```js
/**
* Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function.
* @param wallpaperType Indicates the wallpaper type.
* @returns { Array<RgbaColor> } the Array<RgbaColor> returned by the function.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>;
/**
* Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
* @returns { number } the number returned by the function.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function getMinHeightSync(): number;
/**
* Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
* @returns { number } the number returned by the function.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function getMinWidthSync(): number;
/**
* Removes a wallpaper of the specified type and restores the default one.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
/**
* Removes a wallpaper of the specified type and restores the default one.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function restore(wallpaperType: WallpaperType): Promise<void>;
/**
* Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file.
* @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
/**
* Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file.
* @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>;
```
- 变更后:
```js
/**
* Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function.
* @param wallpaperType Indicates the wallpaper type.
* @returns { Array<RgbaColor> } the Array<RgbaColor> returned by the function.
* @throws {BusinessError} 401 - parameter error.
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>;
/**
* Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
* @returns { number } the number returned by the function.
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function getMinHeightSync(): number;
/**
* Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
* @returns { number } the number returned by the function.
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function getMinWidthSync(): number;
/**
* Removes a wallpaper of the specified type and restores the default one.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
/**
* Removes a wallpaper of the specified type and restores the default one.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function restore(wallpaperType: WallpaperType): Promise<void>;
/**
* Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file.
* @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
/**
* Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file.
* @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>;
```
**适配指导**
该接口变更为系统应用后,三方应用已无法使用。
系统应用可正常使用。
示例代码如下:
```js
try {
let colors = wallpaper.getColorsSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM);
console.log(`success to getColorsSync: ${JSON.stringify(colors)}`);
} catch (error) {
console.error(`failed to getColorsSync because: ${JSON.stringify(error)}`);
}
```
```js
let minHeight = wallpaper.getMinHeightSync();
```
```js
let minWidth = wallpaper.getMinWidthSync();
```
```js
wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => {
if (error) {
console.error(`failed to restore because: ${JSON.stringify(error)}`);
return;
}
console.log(`success to restore.`);
});
```
```js
wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => {
console.log(`success to restore.`);
}).catch((error) => {
console.error(`failed to restore because: ${JSON.stringify(error)}`);
});
```
```js
// source类型为string
let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg";
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => {
if (error) {
console.error(`failed to setImage because: ${JSON.stringify(error)}`);
return;
}
console.log(`success to setImage.`);
});
```
```js
// source类型为string
let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg";
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => {
console.log(`success to setImage.`);
}).catch((error) => {
console.error(`failed to setImage because: ${JSON.stringify(error)}`);
});
```
## cl.wallpaper.2 getIdSync、getFileSync、isChangeAllowed、isUserChangeAllowed、on、off、RgbaColor接口废弃变更
从API9开始,废弃此接口。
开发者需要根据以下说明对应用进行适配。
**变更影响**
该接口删除无法再使用,请使用进行更新使用,否则会影响原有功能。
- 涉及接口
```js
function getIdSync(wallpaperType: WallpaperType): number;
function getFileSync(wallpaperType: WallpaperType): number;
function isChangeAllowed(): boolean;
function isUserChangeAllowed(): boolean;
function on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
function off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
interface RgbaColor {
red: number;
green: number;
blue: number;
alpha: number;
}
```
- 变更前:
```js
function getIdSync(wallpaperType: WallpaperType): number;
function getFileSync(wallpaperType: WallpaperType): number;
function isChangeAllowed(): boolean;
function isUserChangeAllowed(): boolean;
function on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
function off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
interface RgbaColor {
red: number;
green: number;
blue: number;
alpha: number;
}
```
- 变更后:删除接口,停止对外开放。
**适配指导**
该接口删除后无法再使用,请适配更新。
# web子系统ChangeLog
# web子系统ChangeLog
OpenHarmony 4.0.2.1 版本相较于OpenHarmony 之前的版本,web的API变更如下。
OpenHarmony 4.0.7.3 版本相较于OpenHarmony 之前的版本,web的API变更如下。
## cl.web.1 postMessageEvent参数类型变更
该接口postMessageEvent原先仅支持string类型,从4.0.2.1版本开始新增支持ArrayBuffer类型。
## cl.web.1 setResponseData接口参数新增
**变更影响**
该接口变更前向兼容,基于此前版本开发的应用可继续使用接口,原有功能不受影响。
**关键的接口/组件变更**
- 涉及接口
postMessageEvent(message: string): void
- 变更前:
```ts
postMessageEvent(message: string): void
```
- 变更后:
```ts
type WebMessage = ArrayBuffer | string
postMessageEvent(message: WebMessage): void
```
**适配指导**
该接口变更前向兼容,基于此前版本开发的应用可继续使用接口,原有功能不受影响。
## cl.web.2 onMessageEvent参数类型变更
该接口onMessageEvent原先仅支持string类型,从4.0.2.1版本开始新增支持ArrayBuffer类型。
setResponseData(data: string | number | Resource),新增入参类型`Resource`
**变更影响**
该接口变更前向兼容,基于此前版本开发的应用可继续使用接口,增加相应的逻辑处理,原有功能不受影响。
在应用hap不解压场景,应用hap中的文件路径已不存在。当需要读取hap包内资源时,通过使用入参`data:Resource`替代`data:number`,实现对本应用下的资源访问。
**关键的接口/组件变更**
- 涉及接口
onMessageEvent(callback: (result: string) => void): void
setResponseData
- 变更前:
```ts
onMessageEvent(callback: (result: string) => void): void
```
setResponseData(data: string | number)
```
- 变更后:
```ts
type WebMessage = ArrayBuffer | string
onMessageEvent(callback: (result: WebMessage) => void): void
```
setResponseData(data: string | number | Resource)
```
**适配指导**
该接口变更前向兼容,基于此前版本开发的应用可继续使用接口,增加相应的逻辑处理,原有功能不受影响。
## cl.web.3 删除webDebuggingAccess接口
该接口定义不合理,该属性对所有web实例生效的,属于全局配置。用本次新增的接口setWebDebuggingAccess替换。
**变更影响**
该接口删除无法再使用,请使用新增的接口setWebDebuggingAccess替换。
**关键的接口/组件变更**
| 类名 | 接口类型 | 接口声明 | 变更类型 |
| -- | -- | -- | -- |
|WebAttribute | method | webDebugggingAccess(webDebugggingAccess: boolean): WebAttribute| 删除 |
**适配指导**
该接口删除无法再使用,请使用新增的接口setWebDebuggingAccess替换。
## cl.web.4 新增setWebDebuggingAccess接口
WebviewController提供静态方法来设置调试模式开关,该设置对所有web实例生效。
**变更影响**
原有webDebugggingAccess属性定义不合理,因此新增该静态接口来设置调试模式开关。应用侧需要使用该接口来打开调试模式开关。
**关键的接口/组件变更**
| 类名 | 接口类型 | 接口声明 | 变更类型 |
| -- | -- | -- | -- |
|webview.WebviewController | method | static setWebDebugggingAccess(webDebugggingAccess: boolean): void| 新增 |
**适配指导**
以打开调试开关为例,示例代码如下:
应用hap解压时,打开并持有资源文件fd,最后通过`setResponseData(data:number)`将资源响应数据传递给内核。
```ts
```
// xxx.ets
import web_webview from '@ohos.web.webview';
import web_webview from '@ohos.web.webview'
import fileio from '@ohos.fileio';
@Entry
@Component
struct WebComponent {
controller: web_webview.WebviewController = new web_webview.WebviewController();
aboutToAppear():void {
try {
web_webview.WebviewController.setWebDebuggingAccess(true);
} catch(error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
}
controller: web_webview.WebviewController = new web_webview.WebviewController()
responseweb: WebResourceResponse = new WebResourceResponse()
heads: Header[] = new Array()
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
.onInterceptRequest((event) => {
console.log('url:' + event.request.getRequestUrl())
var head1:Header = {
headerKey:"Connection",
headerValue:"keep-alive"
}
var head2:Header = {
headerKey:"Cache-Control",
headerValue:"no-cache"
}
var length = this.heads.push(head1)
length = this.heads.push(head2)
this.responseweb.setResponseHeader(this.heads)
this.responseweb.setResponseEncoding('utf-8')
this.responseweb.setResponseMimeType('text/html')
this.responseweb.setResponseCode(200)
this.responseweb.setReasonMessage('OK')
//// fd方案 --start
// '/xxx/.../test.html'为文件的本地路径
// @ts-ignore
let fd = fileio.openSync('/xxx/.../test.html', 0o102, 0o666)
this.responseweb.setResponseData(fd)
//// fd方案 --end
return this.responseweb
})
}
}
}
```
## cl.web.5 HitTestTypeV9命名变更
枚举类HitTestTypeV9由于命名规范问题名称变更为WebHitTestType
**变更影响**
枚举类HitTestTypeV9以及使用HitTestTypeV9作为参数或返回值的接口在4.0.3.2版本及后续版本中无法继续正常使用
**关键的接口/组件变更**
- 涉及接口
enum HitTestTypeV9
- 变更前
```ts
enum HitTestTypeV9
```
- 变更后:
```ts
enum WebHitTestType
```
**适配指导**
请使用WebHitTestType替换HitTestTypeV9。
## cl.web.6 HeaderV9命名变更
结构体HeaderV9由于命名规范问题,名称变更为WebHeader。
**变更影响**
结构体HeaderV9,以及使用HeaderV9作为参数或返回值的接口,在4.0.3.2版本及后续版本中无法继续正常使用。
**关键的接口/组件变更**
- 涉及接口
interface HeaderV9
- 变更前:
```ts
interface HeaderV9
```
- 变更后:
```ts
interface WebHeader
```
**适配指导**
请使用WebHeader替换HeaderV9。
## cl.web.7 HitTestValue结构体成员类型变更
结构体HitTestValue中的成员变量HitTestTypeV9由于命名规范问题,名称变更为WebHitTestType。
**变更影响**
结构体HitTestValue,以及使用HitTestValue作为参数或返回值的接口,在4.0.3.2版本及后续版本中无法继续正常使用。
**关键的接口/组件变更**
- 涉及接口
interface HitTestValue
- 变更前:
```ts
interface HitTestValue {
/**
* Get the hit test type.
*
* @since 9
*/
type: HitTestTypeV9;
/**
* Get the hit test extra data.
*
* @since 9
*/
extra: string;
}
```
- 变更后:
```ts
interface HitTestValue {
/**
* Get the hit test type.
*
* @since 9
*/
type: WebHitTestType;
/**
* Get the hit test extra data.
*
* @since 9
*/
extra: string;
}
```
**适配指导**
请使用WebHitTestType替换HitTestTypeV9。
## cl.web.8 loadUrl参数类型变更
loadUrl接口中的参数headers,由于其类型的命名规范问题,类型变更为WebHeader。
**变更影响**
loadUrl接口若使用了headers参数,则在4.0.3.2版本及后续版本中无法继续正常使用。
**关键的接口/组件变更**
- 涉及接口
loadUrl(url: string | Resource, headers?: Array<HeaderV9>): void
- 变更前:
```ts
loadUrl(url: string | Resource, headers?: Array<HeaderV9>): void
```
- 变更后:
```ts
loadUrl(url: string | Resource, headers?: Array<WebHeader>): void
```
**适配指导**
在loadUrl中设置headers参数时,请使用WebHeader类型替换HeaderV9类型。
## cl.web.9 getHitTest返回值类型变更
getHitTest接口中的返回值,由于其类型的命名规范问题,变更为WebHitTest。
**变更影响**
getHitTest接口,在4.0.3.2版本及后续版本中无法继续正常使用。
**关键的接口/组件变更**
- 涉及接口
getHitTest(): HitTestTypeV9
- 变更前:
```ts
getHitTest(): HitTestTypeV9
```
应用hap不解压时,应用hap中的文件路径已不存在,通过`setResponseData(data:Resource)`将资源响应数据传递给内核。
- 变更后:
```ts
getHitTest(): WebHitTestType
```
**适配指导**
在使用getHitTest接口的返回值时,请使用WebHitTestType类型替换HitTestTypeV9类型。
## cl.web.10 WebMessagePort类迁移
WebMessagePort类迁移至@ohos.web.webview.d.ts,并新增错误码抛出。
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现该类下接口支持错误码处理,需注意错误码处理的使用。
**关键的接口/组件变更**
- 涉及接口
postMessageEvent(message: WebMessageEvent): void;
onMessageEvent(callback: (result: string) => void): void;
- 变更前:
```ts
postMessageEvent(message: WebMessageEvent): void;
onMessageEvent(callback: (result: string) => void): void;
```
- 变更后:
```ts
postMessageEvent(message: WebMessage): void;
onMessageEvent(callback: (result: WebMessage) => void): void;
```
**适配指导**
原WebMessagePort类不需要import,现WebMessagePort类使用的是@ohos.web.webview,以下方式import:
```ts
import web_webview from '@ohos.web.webview';
```
## cl.web.11 HitTestValue类迁移
HitTestValue类迁移至@ohos.web.webview.d.ts,HitTestValue类变更为接口,getType,getExtra变更为属性。
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。
**关键的接口/组件变更**
- 涉及接口
getType(): HitTestType;
getExtra(): string;
- 变更前:
```ts
getType(): HitTestType;
getExtra(): string;
```
- 变更后:
```ts
type: WebHitTestType;
extra: string;
```
**适配指导**
原HitTestValue类不需要import,现HitTestValue类使用的是@ohos.web.webview,以下方式import:
```ts
import web_webview from '@ohos.web.webview';
```
## cl.web.12 WebCookie类下api9接口迁移
WebCookie类下api9接口迁移,WebCookie类下api9接口迁移到web.webview.webview.WebCookieManager。
并新增接口错误码抛出。
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现该类下接口支持错误码处理,需注意错误码处理的使用。
该类方法变为静态方法。
**关键的接口/组件变更**
- 涉及接口
isCookieAllowed(): boolean;
isThirdPartyCookieAllowed(): boolean;
putAcceptCookieEnabled(accept: boolean): void;
putAcceptThirdPartyCookieEnabled(accept: boolean): void;
setCookie(url: string, value: string): boolean;
saveCookieSync(): boolean;
getCookie(url: string): string;
existCookie(): boolean;
deleteEntireCookie(): void;
deleteSessionCookie(): void;
- 变更前:
```ts
isCookieAllowed(): boolean;
isThirdPartyCookieAllowed(): boolean;
putAcceptCookieEnabled(accept: boolean): void;
putAcceptThirdPartyCookieEnabled(accept: boolean): void;
setCookie(url: string, value: string): boolean;
saveCookieSync(): boolean;
getCookie(url: string): string;
existCookie(): boolean;
deleteEntireCookie(): void;
deleteSessionCookie(): void;
```
- 变更后:
```ts
static isCookieAllowed(): boolean;
static isThirdPartyCookieAllowed(): boolean;
static putAcceptCookieEnabled(accept: boolean): void;
static putAcceptThirdPartyCookieEnabled(accept: boolean): void;
static setCookie(url: string, value: string): void;
static saveCookieAsync(): Promise<void>;
static saveCookieAsync(callback: AsyncCallback<void>): void;
static getCookie(url: string): string;
static existCookie(): boolean;
static deleteEntireCookie(): void;
static deleteSessionCookie(): void;
```
**适配指导**
原WebCookie类不需要import,现WebCookieManager使用的是@ohos.web.webview,以下方式import:
```ts
import web_webview from '@ohos.web.webview';
```
## cl.web.13 WebController类下api9接口迁移
WebController类下api9接口迁移至web.webview.webview.WebviewController,并新增接口错误码抛出。
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现该类下接口支持错误码处理,需注意错误码处理的使用。
getDefaultUserAgent接口更名为getUserAgent。
**关键的接口/组件变更**
- 涉及接口
zoomIn(): boolean;
zoomOut(): boolean;
createWebMessagePorts(): Array<WebMessagePort>;
postMessage(options: { message: WebMessageEvent, uri: string}): void;
getHitTestValue(): HitTestValue;
getWebId(): number;
getDefaultUserAgent(): string;
getTitle(): string;
getPageHeight(): number;
backOrForward(step: number): void;
searchAllAsync(searchString: string): void;
clearMatches(): void;
searchNext(forward: boolean): void;
clearSslCache(): void;
clearClientAuthenticationCache(): void;
getUrl(): string;
- 变更前:
```ts
zoomIn(): boolean;
zoomOut(): boolean;
createWebMessagePorts(): Array<WebMessagePort>;
postMessage(options: { message: WebMessageEvent, uri: string}): void;
getHitTestValue(): HitTestValue;
getWebId(): number;
getDefaultUserAgent(): string;
getTitle(): string;
getPageHeight(): number;
backOrForward(step: number): void;
searchAllAsync(searchString: string): void;
clearMatches(): void;
searchNext(forward: boolean): void;
clearSslCache(): void;
clearClientAuthenticationCache(): void;
getUrl(): string;
```
- 变更后:
```ts
zoomIn(): void;
zoomOut(): void;
createWebMessagePorts(): Array<WebMessagePort>;
postMessage(name: string, ports: Array<WebMessagePort>, uri: string): void;
getHitTestValue(): HitTestValue;
getWebId(): number;
getUserAgent(): string;
getTitle(): string;
getPageHeight(): number;
backOrForward(step: number): void;
searchAllAsync(searchString: string): void;
clearMatches(): void;
searchNext(forward: boolean): void;
clearSslCache(): void;
clearClientAuthenticationCache(): void;
getUrl(): string;
```
**适配指导**
原WebController类不需要import,现WebviewController类使用的是@ohos.web.webview,以下方式import:
```ts
import web_webview from '@ohos.web.webview';
```
## cl.web.14 WebAsyncController类迁移
WebAsyncController类下接口迁移至web.webview.webview.WebviewController,并新增接口错误码抛出。
**变更影响**
基于此前版本开发的应用,需注意错误码处理的使用。
**关键的接口/组件变更**
- 涉及接口
storeWebArchive(baseName: string, autoName: boolean): Promise<string>;
storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback<string>): void;
- 变更前:
```ts
storeWebArchive(baseName: string, autoName: boolean): Promise<string>;
storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback<string>): void;
```
- 变更后:
```ts
storeWebArchive(baseName: string, autoName: boolean): Promise<string>;
storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback<string>): void;
```
**适配指导**
使用示例:
```ts
// xxx.ets
import web_webview from '@ohos.web.webview'
```
// xxx.ets
import web_webview from '@ohos.web.webview'
@Entry
@Component
struct WebComponent {
controller: web_webview.WebviewController = new web_webview.WebviewController();
@Entry
@Component
struct WebComponent {
controller: web_webview.WebviewController = new web_webview.WebviewController()
responseweb: WebResourceResponse = new WebResourceResponse()
heads: Header[] = new Array()
build() {
Column() {
Button('saveWebArchive')
.onClick(() => {
try {
this.controller.storeWebArchive("/data/storage/el2/base/", true, (error, filename) => {
if (error) {
console.info(`save web archive error: ` + JSON.stringify(error))
return;
}
if (filename != null) {
console.info(`save web archive success: ${filename}`)
}
});
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
})
Web({ src: 'www.example.com', controller: this.controller })
}
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
.onInterceptRequest((event) => {
console.log('url:' + event.request.getRequestUrl())
var head1:Header = {
headerKey:"Connection",
headerValue:"keep-alive"
}
var head2:Header = {
headerKey:"Cache-Control",
headerValue:"no-cache"
}
var length = this.heads.push(head1)
length = this.heads.push(head2)
this.responseweb.setResponseHeader(this.heads)
this.responseweb.setResponseEncoding('utf-8')
this.responseweb.setResponseMimeType('text/html')
this.responseweb.setResponseCode(200)
this.responseweb.setReasonMessage('OK')
//// Resource方案 --start
// 指定hap包中rawfile目录下的目标文件
this.responseweb.setResponseData($rawfile('test.html'))
//// Resource方案 --end
return this.responseweb
})
}
}
```
## cl.web.15 createWebMessagePorts接口参数
由于WebMessagePort需要新增支持更多数据类型,因此在该接口增加一个可选参数来区分新老接口。
**变更影响**
无,可选参数,可前向兼容。
**关键的接口/组件变更**
- 涉及接口
createWebMessagePorts(): Array<WebMessagePort>;
- 变更前:
```ts
createWebMessagePorts(): Array<WebMessagePort>;
```
- 变更后:
```ts
createWebMessagePorts(isExtentionType?: boolean): Array<WebMessagePort>;
```
**适配指导**
已有应用无需适配。
\ No newline at end of file
}
```
\ No newline at end of file
# 基础通信子系统WiFi ChangeLog
## cl.location.1 位置服务权限变更
从API9开始,增加ohos.permission.APPROXIMATELY_LOCATION,表示模糊位置权限。
如果应用开发者使用的API版本大于等于9,则需要同时申请ohos.permission.LOCATION和ohos.permission.APPROXIMATELY_LOCATION,单独申请ohos.permission.LOCATION会失败。
**变更影响**
如果是存量应用(使用的API版本小于9),则无影响。如果使用的API版本大于等于9,位置服务权限申请方式有变更,详情如下:
应用在使用系统能力前,需要检查是否已经获取用户授权访问设备位置信息。如未获得授权,可以向用户申请需要的位置权限,申请方式请参考下文。
系统提供的定位权限有:
- ohos.permission.LOCATION
- ohos.permission.APPROXIMATELY_LOCATION
- ohos.permission.LOCATION_IN_BACKGROUND
访问设备的位置信息,必须申请权限,并且获得用户授权。
API9之前的版本,申请ohos.permission.LOCATION即可。
API9及之后的版本,需要申请ohos.permission.APPROXIMATELY_LOCATION或者同时申请ohos.permission.APPROXIMATELY_LOCATION和ohos.permission.LOCATION;无法单独申请ohos.permission.LOCATION。
| 使用的API版本 | 申请位置权限 | 申请结果 | 位置的精确度 |
| -------- | -------- | -------- | -------- |
| 小于9 | ohos.permission.LOCATION | 成功 | 获取到精准位置,精准度在米级别。 |
| 大于等于9 | ohos.permission.LOCATION | 失败 | 无法获取位置。 |
| 大于等于9 | ohos.permission.APPROXIMATELY_LOCATION | 成功 | 获取到模糊位置,精确度为5公里。 |
| 大于等于9 | ohos.permission.APPROXIMATELY_LOCATION和ohos.permission.LOCATION | 成功 | 获取到精准位置,精准度在米级别。 |
如果应用在后台运行时也需要访问设备位置,除需要将应用声明为允许后台运行外,还必须申请ohos.permission.LOCATION_IN_BACKGROUND权限,这样应用在切入后台之后,系统可以继续上报位置信息。
开发者可以在应用配置文件中声明所需要的权限,具体可参考[授权申请指导](../../../application-dev/security/accesstoken-guidelines.md)
**关键的接口/组件变更**
| 类名 | 接口类型 | 接口声明 | 变更类型 |
| -- | -- | -- | -- |
|wifiManager| method | function scan(): void; | 权限变更为ohos.permission.SET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getScanResults(): Promise&lt;Array&lt;WifiScanInfo&gt;&gt;; | 权限变更为ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION)) |
|wifiManager| method | function getScanResults(callback: AsyncCallback&lt;Array&lt;WifiScanInfo&gt;&gt;): void; | 权限变更为ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION)) |
|wifiManager| method | function getScanResultsSync(): Array&lt;WifiScanInfo&gt;; | 权限变更为ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION)) |
|wifiManager| method | function getCandidateConfigs(): Array&lt;WifiDeviceConfig&gt;; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getDeviceConfigs(): Array&lt;WifiDeviceConfig&gt;; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.GET_WIFI_CONFIG |
|wifiManager| method | function getStations(): Array&lt;StationInfo&gt;; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.MANAGE_WIFI_HOTSPOT |
|wifiManager| method | function getCurrentGroup(): Promise&lt;WifiP2pGroupInfo&gt;; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getCurrentGroup(callback: AsyncCallback&lt;WifiP2pGroupInfo&gt;): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getP2pPeerDevices(): Promise&lt;WifiP2pDevice[]&gt;; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getP2pPeerDevices(callback: AsyncCallback&lt;WifiP2pDevice[]&gt;): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function p2pConnect(config: WifiP2PConfig): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function startDiscoverDevices(): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getP2pGroups(): Promise&lt;Array&lt;WifiP2pGroupInfo&gt;&gt;; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getP2pGroups(callback: AsyncCallback&lt;Array&lt;WifiP2pGroupInfo&gt;&gt;): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function on(type: "p2pDeviceChange", callback: Callback&lt;WifiP2pDevice&gt;): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function off(type: "p2pDeviceChange", callback?: Callback&lt;WifiP2pDevice&gt;): void; | 权限变更为ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function on(type: "p2pPeerDeviceChange", callback: Callback&lt;WifiP2pDevice[]&gt;): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function off(type: "p2pPeerDeviceChange", callback?: Callback&lt;WifiP2pDevice[]&gt;): void; | 权限变更为ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册