Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Tonvia
Docs
提交
340feb1c
D
Docs
项目概览
Tonvia
/
Docs
与 Fork 源项目一致
Fork自
OpenHarmony / Docs
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
340feb1c
编写于
3月 15, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 15, 2023
浏览文件
操作
浏览文件
下载
差异文件
!14659 元能力API9终审整改-changelog
Merge pull request !14659 from dy/API9_changelog
上级
982e6785
de2b267e
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
225 addition
and
68 deletion
+225
-68
zh-cn/application-dev/application-models/hop-multi-device-collaboration.md
...-dev/application-models/hop-multi-device-collaboration.md
+17
-17
zh-cn/application-dev/application-models/uiability-intra-device-interaction.md
.../application-models/uiability-intra-device-interaction.md
+12
-12
zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
...ation-dev/reference/apis/js-apis-app-ability-uiAbility.md
+29
-29
zh-cn/application-dev/task-management/continuous-task-dev-guide.md
...lication-dev/task-management/continuous-task-dev-guide.md
+10
-10
zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md
...tes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md
+157
-0
未找到文件。
zh-cn/application-dev/application-models/hop-multi-device-collaboration.md
浏览文件 @
340feb1c
...
...
@@ -319,8 +319,8 @@
| startAbilityByCall(want:
Want):
Promise
<
Caller
>
; | 启动指定UIAbility至前台或后台,同时获取其Caller通信接口,调用方可使用Caller与被启动的Ability进行通信。 |
| on(method:
string,
callback:
CalleeCallBack):
void | 通用组件Callee注册method对应的callback方法。 |
| off(method:
string):
void | 通用组件Callee解注册method的callback方法。 |
| call(method:
string,
data:
rpc.
Sequence
able):
Promise
<
void
>
| 向通用组件Callee发送约定序列化数据。 |
| callWithResult(method:
string,
data:
rpc.
Sequenceable):
Promise
<
rpc.MessageParcel
>
| 向通用组件Callee发送约定序列化数据,
并将Callee返回的约定序列化数据带回。 |
| call(method:
string,
data:
rpc.
Parcel
able):
Promise
<
void
>
| 向通用组件Callee发送约定序列化数据。 |
| callWithResult(method:
string,
data:
rpc.
Parcelable):
Promise
<
rpc.MessageSequence
>
| 向通用组件Callee发送约定序列化数据,
并将Callee返回的约定序列化数据带回。 |
| release():
void | 释放通用组件的Caller通信接口。 |
| on(type:
"release",
callback:
OnReleaseCallback):
void | 注册通用组件通信断开监听通知。 |
...
...
@@ -377,7 +377,7 @@
```ts
export default class My
Sequence
able {
export default class My
Parcel
able {
num: number = 0;
str: string = "";
...
...
@@ -386,15 +386,15 @@
this.str = string;
}
marshalling(message
Parcel
) {
message
Parcel
.writeInt(this.num);
message
Parcel
.writeString(this.str);
marshalling(message
Sequence
) {
message
Sequence
.writeInt(this.num);
message
Sequence
.writeString(this.str);
return true;
}
unmarshalling(message
Parcel
) {
this.num = message
Parcel
.readInt();
this.str = message
Parcel
.readString();
unmarshalling(message
Sequence
) {
this.num = message
Sequence
.readInt();
this.str = message
Sequence
.readString();
return true;
}
}
...
...
@@ -410,13 +410,13 @@
console
.
info
(
'
CalleeSortFunc called
'
);
// 获取Caller发送的序列化数据
let
receivedData
=
new
My
Sequence
able
(
0
,
''
);
data
.
read
Sequence
able
(
receivedData
);
let
receivedData
=
new
My
Parcel
able
(
0
,
''
);
data
.
read
Parcel
able
(
receivedData
);
console
.
info
(
`receiveData[
${
receivedData
.
num
}
,
${
receivedData
.
str
}
]`
);
// 作相应处理
// 返回序列化数据result给Caller
return
new
My
Sequence
able
(
receivedData
.
num
+
1
,
`send
${
receivedData
.
str
}
succeed`
);
return
new
My
Parcel
able
(
receivedData
.
num
+
1
,
`send
${
receivedData
.
str
}
succeed`
);
}
export
default
class
CalleeAbility
extends
Ability
{
...
...
@@ -476,13 +476,13 @@
getRemoteDeviceId方法参照[通过跨设备启动uiability和serviceextensionability组件实现多端协同无返回数据](#通过跨设备启动uiability和serviceextensionability组件实现多端协同无返回数据)。
5.
向被调用端UIAbility发送约定序列化数据。
1.
向被调用端发送
Sequence
able数据有两种方式,一种是不带返回值,一种是获取被调用端返回的数据,method以及序列化数据需要与被调用端协商一致。如下示例调用Call接口,向Callee被调用端发送数据。
1.
向被调用端发送
Parcel
able数据有两种方式,一种是不带返回值,一种是获取被调用端返回的数据,method以及序列化数据需要与被调用端协商一致。如下示例调用Call接口,向Callee被调用端发送数据。
```
ts
const
MSG_SEND_METHOD
:
string
=
'
CallSendMsg
'
;
async
onButtonCall
()
{
try
{
let
msg
=
new
My
Sequence
able
(
1
,
'
origin_Msg
'
);
let
msg
=
new
My
Parcel
able
(
1
,
'
origin_Msg
'
);
await
this
.
caller
.
call
(
MSG_SEND_METHOD
,
msg
);
}
catch
(
error
)
{
console
.
info
(
`caller call failed with
${
error
}
`
);
...
...
@@ -497,12 +497,12 @@
backMsg
:
string
=
''
;
async
onButtonCallWithResult
(
originMsg
,
backMsg
)
{
try
{
let
msg
=
new
My
Sequence
able
(
1
,
originMsg
);
let
msg
=
new
My
Parcel
able
(
1
,
originMsg
);
const
data
=
await
this
.
caller
.
callWithResult
(
MSG_SEND_METHOD
,
msg
);
console
.
info
(
'
caller callWithResult succeed
'
);
let
result
=
new
My
Sequence
able
(
0
,
''
);
data
.
read
Sequence
able
(
result
);
let
result
=
new
My
Parcel
able
(
0
,
''
);
data
.
read
Parcel
able
(
result
);
backMsg
(
result
.
str
);
console
.
info
(
`caller result is [
${
result
.
num
}
,
${
result
.
str
}
]`
);
}
catch
(
error
)
{
...
...
zh-cn/application-dev/application-models/uiability-intra-device-interaction.md
浏览文件 @
340feb1c
...
...
@@ -525,8 +525,8 @@ Call功能主要接口如下表所示。具体的API详见[接口文档](../refe
| startAbilityByCall(want:
Want):
Promise
<
Caller
>
| 启动指定UIAbility并获取其Caller通信接口,默认为后台启动,通过配置want可实现前台启动,详见
[
接口文档
](
../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstartabilitybycall
)
。AbilityContext与ServiceExtensionContext均支持该接口。 |
| on(method:
string,
callback:
CalleeCallBack):
void | 通用组件Callee注册method对应的callback方法。 |
| off(method:
string):
void | 通用组件Callee解注册method的callback方法。 |
| call(method:
string,
data:
rpc.
Sequence
able):
Promise
<
void
>
| 向通用组件Callee发送约定序列化数据。 |
| callWithResult(method:
string,
data:
rpc.
Sequenceable):
Promise
<
rpc.MessageParcel
>
| 向通用组件Callee发送约定序列化数据,
并将Callee返回的约定序列化数据带回。 |
| call(method:
string,
data:
rpc.
Parcel
able):
Promise
<
void
>
| 向通用组件Callee发送约定序列化数据。 |
| callWithResult(method:
string,
data:
rpc.
Parcelable):
Promise
<
rpc.MessageSequence
>
| 向通用组件Callee发送约定序列化数据,
并将Callee返回的约定序列化数据带回。 |
| release():
void | 释放通用组件的Caller通信接口。 |
| on(type:
"release",
callback:
OnReleaseCallback):
void | 注册通用组件通信断开监听通知。 |
...
...
@@ -574,7 +574,7 @@ Call功能主要接口如下表所示。具体的API详见[接口文档](../refe
```
ts
export
default
class
My
Sequence
able
{
export
default
class
My
Parcel
able
{
num
:
number
=
0
str
:
string
=
""
...
...
@@ -583,15 +583,15 @@ Call功能主要接口如下表所示。具体的API详见[接口文档](../refe
this
.
str
=
string
}
marshalling
(
message
Parcel
)
{
message
Parcel
.
writeInt
(
this
.
num
)
message
Parcel
.
writeString
(
this
.
str
)
marshalling
(
message
Sequence
)
{
message
Sequence
.
writeInt
(
this
.
num
)
message
Sequence
.
writeString
(
this
.
str
)
return
true
}
unmarshalling
(
message
Parcel
)
{
this
.
num
=
message
Parcel
.
readInt
()
this
.
str
=
message
Parcel
.
readString
()
unmarshalling
(
message
Sequence
)
{
this
.
num
=
message
Sequence
.
readInt
()
this
.
str
=
message
Sequence
.
readString
()
return
true
}
}
...
...
@@ -609,13 +609,13 @@ Call功能主要接口如下表所示。具体的API详见[接口文档](../refe
console
.
info
(
'
CalleeSortFunc called
'
);
// 获取Caller发送的序列化数据
let
receivedData
=
new
My
Sequence
able
(
0
,
''
);
data
.
read
Sequence
able
(
receivedData
);
let
receivedData
=
new
My
Parcel
able
(
0
,
''
);
data
.
read
Parcel
able
(
receivedData
);
console
.
info
(
`receiveData[
${
receivedData
.
num
}
,
${
receivedData
.
str
}
]`
);
// 作相应处理
// 返回序列化数据result给Caller
return
new
My
Sequence
able
(
receivedData
.
num
+
1
,
`send
${
receivedData
.
str
}
succeed`
);
return
new
My
Parcel
able
(
receivedData
.
num
+
1
,
`send
${
receivedData
.
str
}
succeed`
);
}
export
default
class
CalleeAbility
extends
Ability
{
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
浏览文件 @
340feb1c
...
...
@@ -319,7 +319,7 @@ call(method: string, data: rpc.Parcelable): Promise<void>;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| method | string | 是 | 约定的服务端注册事件字符串。 |
| data |
[
rpc.Parcelable
](
js-apis-rpc.md#parcelable9
)
| 是 | 由开发者实现的
Sequence
able可序列化数据。 |
| data |
[
rpc.Parcelable
](
js-apis-rpc.md#parcelable9
)
| 是 | 由开发者实现的
Parcel
able可序列化数据。 |
**返回值:**
...
...
@@ -338,7 +338,7 @@ call(method: string, data: rpc.Parcelable): Promise<void>;
**示例:**
```
ts
class
MyMessageAble
{
// 自定义的
Sequence
able数据结构
class
MyMessageAble
{
// 自定义的
Parcel
able数据结构
name
:
''
str
:
''
num
:
1
...
...
@@ -346,15 +346,15 @@ call(method: string, data: rpc.Parcelable): Promise<void>;
this
.
name
=
name
;
this
.
str
=
str
;
}
marshalling
(
message
Parcel
)
{
message
Parcel
.
writeInt
(
this
.
num
);
message
Parcel
.
writeString
(
this
.
str
);
marshalling
(
message
Sequence
)
{
message
Sequence
.
writeInt
(
this
.
num
);
message
Sequence
.
writeString
(
this
.
str
);
console
.
log
(
'
MyMessageAble marshalling num[${this.num}] str[${this.str}]
'
);
return
true
;
}
unmarshalling
(
message
Parcel
)
{
this
.
num
=
message
Parcel
.
readInt
();
this
.
str
=
message
Parcel
.
readString
();
unmarshalling
(
message
Sequence
)
{
this
.
num
=
message
Sequence
.
readInt
();
this
.
str
=
message
Sequence
.
readString
();
console
.
log
(
'
MyMessageAble unmarshalling num[${this.num}] str[${this.str}]
'
);
return
true
;
}
...
...
@@ -369,7 +369,7 @@ call(method: string, data: rpc.Parcelable): Promise<void>;
deviceId
:
''
}).
then
((
obj
)
=>
{
caller
=
obj
;
let
msg
=
new
MyMessageAble
(
'
msg
'
,
'
world
'
);
// 参考
Sequence
able数据定义
let
msg
=
new
MyMessageAble
(
'
msg
'
,
'
world
'
);
// 参考
Parcel
able数据定义
caller
.
call
(
method
,
msg
)
.
then
(()
=>
{
console
.
log
(
'
Caller call() called
'
);
...
...
@@ -387,7 +387,7 @@ call(method: string, data: rpc.Parcelable): Promise<void>;
## Caller.callWithResult
callWithResult(method: string, data: rpc.Parcelable): Promise
<
rpc.Message
Parcel
>
;
callWithResult(method: string, data: rpc.Parcelable): Promise
<
rpc.Message
Sequence
>
;
向通用组件服务端发送约定序列化数据, 并将服务端返回的约定序列化数据带回。
...
...
@@ -398,13 +398,13 @@ callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageParc
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| method | string | 是 | 约定的服务端注册事件字符串。 |
| data |
[
rpc.Parcelable
](
js-apis-rpc.md#parcelable9
)
| 是 | 由开发者实现的
Sequence
able可序列化数据。 |
| data |
[
rpc.Parcelable
](
js-apis-rpc.md#parcelable9
)
| 是 | 由开发者实现的
Parcel
able可序列化数据。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
[rpc.Message
Parcel](js-apis-rpc.md#sequenceabledeprecated
)
>
| Promise形式返回通用组件服务端应答数据。 |
| Promise
<
[rpc.Message
Sequence](js-apis-rpc.md#messagesequence9
)
>
| Promise形式返回通用组件服务端应答数据。 |
**错误码:**
...
...
@@ -425,15 +425,15 @@ callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageParc
this
.
name
=
name
;
this
.
str
=
str
;
}
marshalling
(
message
Parcel
)
{
message
Parcel
.
writeInt
(
this
.
num
);
message
Parcel
.
writeString
(
this
.
str
);
marshalling
(
message
Sequence
)
{
message
Sequence
.
writeInt
(
this
.
num
);
message
Sequence
.
writeString
(
this
.
str
);
console
.
log
(
'
MyMessageAble marshalling num[${this.num}] str[${this.str}]
'
);
return
true
;
}
unmarshalling
(
message
Parcel
)
{
this
.
num
=
message
Parcel
.
readInt
();
this
.
str
=
message
Parcel
.
readString
();
unmarshalling
(
message
Sequence
)
{
this
.
num
=
message
Sequence
.
readInt
();
this
.
str
=
message
Sequence
.
readString
();
console
.
log
(
'
MyMessageAble unmarshalling num[${this.num] str[${this.str}]
'
);
return
true
;
}
...
...
@@ -453,7 +453,7 @@ callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageParc
.
then
((
data
)
=>
{
console
.
log
(
'
Caller callWithResult() called
'
);
let
retmsg
=
new
MyMessageAble
(
0
,
''
);
data
.
read
Sequence
able
(
retmsg
);
data
.
read
Parcel
able
(
retmsg
);
})
.
catch
((
callErr
)
=>
{
console
.
log
(
'
Caller.callWithResult catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}
'
);
...
...
@@ -712,7 +712,7 @@ on(method: string, callback: CalleeCallback): void;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| method | string | 是 | 与客户端约定的通知消息字符串。 |
| callback |
[
CalleeCallback
](
#calleecallback
)
| 是 | 一个
[
rpc.Message
Parcel
](
js-apis-rpc.md#messageparceldeprecated
)
类型入参的js通知同步回调函数,
回调函数至少要返回一个空的[rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated
)数据对象,
其他视为函数执行错误。 |
| callback |
[
CalleeCallback
](
#calleecallback
)
| 是 | 一个
[
rpc.Message
Sequence
](
js-apis-rpc.md#messagesequence9
)
类型入参的js通知同步回调函数,
回调函数至少要返回一个空的[rpc.Parcelable](js-apis-rpc.md#parcelable9
)数据对象,
其他视为函数执行错误。 |
**错误码:**
...
...
@@ -733,15 +733,15 @@ on(method: string, callback: CalleeCallback): void;
this
.
name
=
name
;
this
.
str
=
str
;
}
marshalling
(
message
Parcel
)
{
message
Parcel
.
writeInt
(
this
.
num
);
message
Parcel
.
writeString
(
this
.
str
);
marshalling
(
message
Sequence
)
{
message
Sequence
.
writeInt
(
this
.
num
);
message
Sequence
.
writeString
(
this
.
str
);
console
.
log
(
'
MyMessageAble marshalling num[${this.num}] str[${this.str}]
'
);
return
true
;
}
unmarshalling
(
message
Parcel
)
{
this
.
num
=
message
Parcel
.
readInt
();
this
.
str
=
message
Parcel
.
readString
();
unmarshalling
(
message
Sequence
)
{
this
.
num
=
message
Sequence
.
readInt
();
this
.
str
=
message
Sequence
.
readString
();
console
.
log
(
'
MyMessageAble unmarshalling num[${this.num}] str[${this.str}]
'
);
return
true
;
}
...
...
@@ -750,7 +750,7 @@ on(method: string, callback: CalleeCallback): void;
function
funcCallBack
(
pdata
)
{
console
.
log
(
'
Callee funcCallBack is called ${pdata}
'
);
let
msg
=
new
MyMessageAble
(
'
test
'
,
''
);
pdata
.
read
Sequence
able
(
msg
);
pdata
.
read
Parcel
able
(
msg
);
return
new
MyMessageAble
(
'
test1
'
,
'
Callee test
'
);
}
export
default
class
MainUIAbility
extends
UIAbility
{
...
...
@@ -816,10 +816,10 @@ off(method: string): void;
## CalleeCallback
(indata: rpc.Message
Parcel
): rpc.Parcelable;
(indata: rpc.Message
Sequence
): rpc.Parcelable;
**系统能力**
:SystemCapability.Ability.AbilityRuntime.AbilityCore
| 名称 | 可读 | 可写 | 类型 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| (indata:
[
rpc.Message
Parcel
](
js-apis-rpc.md#sequenceabledeprecated
)
) | 是 | 否 |
[
rpc.Parcelable
](
js-apis-rpc.md#parcelable9
)
| 被调用方注册的消息侦听器函数接口的原型。 |
| (indata:
[
rpc.Message
Sequence
](
js-apis-rpc.md#messagesequence9
)
) | 是 | 否 |
[
rpc.Parcelable
](
js-apis-rpc.md#parcelable9
)
| 被调用方注册的消息侦听器函数接口的原型。 |
zh-cn/application-dev/task-management/continuous-task-dev-guide.md
浏览文件 @
340feb1c
...
...
@@ -210,7 +210,7 @@ function stopContinuousTask() {
}
}
class
My
Sequence
able
{
class
My
Parcel
able
{
num
:
number
=
0
;
str
:
String
=
""
;
...
...
@@ -219,23 +219,23 @@ class MySequenceable {
this
.
str
=
string
;
}
marshalling
(
message
Parcel
)
{
message
Parcel
.
writeInt
(
this
.
num
);
message
Parcel
.
writeString
(
this
.
str
);
marshalling
(
message
Sequence
)
{
message
Sequence
.
writeInt
(
this
.
num
);
message
Sequence
.
writeString
(
this
.
str
);
return
true
;
}
unmarshalling
(
message
Parcel
)
{
this
.
num
=
message
Parcel
.
readInt
();
this
.
str
=
message
Parcel
.
readString
();
unmarshalling
(
message
Sequence
)
{
this
.
num
=
message
Sequence
.
readInt
();
this
.
str
=
message
Sequence
.
readString
();
return
true
;
}
}
function
sendMsgCallback
(
data
)
{
console
.
info
(
'
BgTaskAbility funcCallBack is called
'
+
data
)
let
receivedData
=
new
My
Sequence
able
(
0
,
""
)
data
.
read
Sequence
able
(
receivedData
)
let
receivedData
=
new
My
Parcel
able
(
0
,
""
)
data
.
read
Parcel
able
(
receivedData
)
console
.
info
(
`receiveData[
${
receivedData
.
num
}
,
${
receivedData
.
str
}
]`
)
// 可以根据Caller端发送的序列化数据的str值,执行不同的方法。
if
(
receivedData
.
str
===
'
start_bgtask
'
)
{
...
...
@@ -243,7 +243,7 @@ function sendMsgCallback(data) {
}
else
if
(
receivedData
.
str
===
'
stop_bgtask
'
)
{
stopContinuousTask
();
}
return
new
My
Sequence
able
(
10
,
"
Callee test
"
);
return
new
My
Parcel
able
(
10
,
"
Callee test
"
);
}
export
default
class
BgTaskAbility
extends
UIAbility
{
...
...
zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md
浏览文件 @
340feb1c
...
...
@@ -107,3 +107,160 @@ let appContext = context.getApplicationContext();
appContext
.
getRunningProcessInformation
()
```
## cl.ability.4 WantConstant.Flags接口变更
WantConstant.Flags接口有多个无效Flag定义,删除掉无效的Flag。
**变更影响**
影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。
**关键的接口/组件变更**
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_FORWARD_RESULT | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CONTINUATION | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_NOT_OHOS_COMPONENT | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_FORM_ENABLED | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_AUTH_PREFIX_URI_PERMISSION | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITYSLICE_MULTI_DEVICE | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_START_FOREGROUND_ABILITY | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CONTINUATION_REVERSIBLE | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_INSTALL_WITH_BACKGROUND_MODE | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CLEAR_MISSION | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_NEW_MISSION | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_MISSION_TOP | 删除 |
## cl.ability.5 WantConstant.Action接口变更
WantConstant.Action接口有多个无效Action定义,删除掉无效的Action。
**变更影响**
影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。
**关键的接口/组件变更**
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_APP_ACCOUNT_AUTH | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_MARKET_DOWNLOAD | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_MARKET_CROWDTEST | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_SANDBOX | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_BUNDLE_NAME | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_MODULE_NAME | 删除 |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_ABILITY_NAME | 删除 |
## cl.ability.6 Caller相关接口变更
Caller相关接口使用RPC废弃的Sequenceable和MessageParcel对象,使用RPC在API9提供的Parcelable和MessageSequence对象替代。
**变更影响**
影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。
**关键的接口/组件变更**
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| api/@ohos.app.ability.UIAbility.d.ts | CalleeCallback | (indata: rpc.MessageParcel): rpc.Sequenceable; | 变更,修改为 (indata: rpc.MessageSequence): rpc.Parcelable; |
| api/@ohos.app.ability.UIAbility.d.ts | Caller | call(method: string, data: rpc.Sequenceable): Promise
<void>
; | 变更,修改为 call(method: string, data: rpc.Parcelable): Promise
<void>
; |
| api/@ohos.app.ability.UIAbility.d.ts | Caller | callWithResult(method: string, data: rpc.Sequenceable): Promise
<rpc.MessageParcel>
; | 变更,修改为 callWithResult(method: string, data: rpc.Parcelable): Promise
<rpc.MessageSequence>
; |
**适配指导**
应用中调用Caller相关接口可参考下列代码
变更前代码:
```
ts
class
MyMessageAble
{
name
:
""
str
:
""
num
:
1
constructor
(
name
,
str
)
{
this
.
name
=
name
;
this
.
str
=
str
;
}
marshalling
(
messageParcel
)
{
messageParcel
.
writeInt
(
this
.
num
);
messageParcel
.
writeString
(
this
.
str
);
console
.
log
(
'
MyMessageAble marshalling num[
'
+
this
.
num
+
'
] str[
'
+
this
.
str
+
'
]
'
);
return
true
;
}
unmarshalling
(
messageParcel
)
{
this
.
num
=
messageParcel
.
readInt
();
this
.
str
=
messageParcel
.
readString
();
console
.
log
(
'
MyMessageAble unmarshalling num[
'
+
this
.
num
+
'
] str[
'
+
this
.
str
+
'
]
'
);
return
true
;
}
};
let
method
=
'
call_Function
'
;
function
funcCallBack
(
pdata
)
{
console
.
log
(
'
Callee funcCallBack is called
'
+
pdata
);
let
msg
=
new
MyMessageAble
(
"
test
"
,
""
);
pdata
.
readSequenceable
(
msg
);
return
new
MyMessageAble
(
"
test1
"
,
"
Callee test
"
);
}
export
default
class
MainUIAbility
extends
UIAbility
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
Callee onCreate is called
'
);
try
{
this
.
callee
.
on
(
method
,
funcCallBack
);
}
catch
(
error
)
{
console
.
log
(
'
Callee.on catch error, error.code:
'
+
JSON
.
stringify
(
error
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
error
.
message
));
}
}
}
```
变更后代码:
```
ts
class
MyMessageAble
{
name
:
""
str
:
""
num
:
1
constructor
(
name
,
str
)
{
this
.
name
=
name
;
this
.
str
=
str
;
}
marshalling
(
messageSequence
)
{
messageSequence
.
writeInt
(
this
.
num
);
messageSequence
.
writeString
(
this
.
str
);
console
.
log
(
'
MyMessageAble marshalling num[
'
+
this
.
num
+
'
] str[
'
+
this
.
str
+
'
]
'
);
return
true
;
}
unmarshalling
(
messageSequence
)
{
this
.
num
=
messageSequence
.
readInt
();
this
.
str
=
messageSequence
.
readString
();
console
.
log
(
'
MyMessageAble unmarshalling num[
'
+
this
.
num
+
'
] str[
'
+
this
.
str
+
'
]
'
);
return
true
;
}
};
let
method
=
'
call_Function
'
;
function
funcCallBack
(
pdata
)
{
console
.
log
(
'
Callee funcCallBack is called
'
+
pdata
);
let
msg
=
new
MyMessageAble
(
"
test
"
,
""
);
pdata
.
readParcelable
(
msg
);
return
new
MyMessageAble
(
"
test1
"
,
"
Callee test
"
);
}
export
default
class
MainUIAbility
extends
UIAbility
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
Callee onCreate is called
'
);
try
{
this
.
callee
.
on
(
method
,
funcCallBack
);
}
catch
(
error
)
{
console
.
log
(
'
Callee.on catch error, error.code:
'
+
JSON
.
stringify
(
error
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
error
.
message
));
}
}
}
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录