changelogs-ability.md 9.7 KB
Newer Older
H
HuangXW 已提交
1 2
# 元能力子系统ChangeLog

H
HuangXW 已提交
3
## cl.ability.1 应用组件启动规则变更
H
HuangXW 已提交
4

H
HuangXW 已提交
5
元能力子系统应用组件启动规则在如下场景中存在变更:
H
HuangXW 已提交
6

H
HuangXW 已提交
7 8
 - 应用位于后台启动应用组件
 - 跨应用启动invisible应用组件
H
HuangXW 已提交
9 10 11 12 13 14 15 16
 - 跨应用启动FA模型的serviceAbility与dataAbility
 - 使用startAbilityByCall接口

开发者需要根据以下说明对应用进行适配。


**变更影响**

H
HuangXW 已提交
17 18 19 20
若未适配新规则,在上述场景下将无法启动应用组件
> **注意,启动应用组件是指一切启动或连接Ability的行为:**
<br> 1. 启动Ability,如使用startAbility、startServiceExtensionAbility、startAbilityByCall等接口。
<br> 2. 连接Ability,如使用connectAbility、connectServiceExtensionAbility、acquireDataAbilityHelper、createDataShareHelper等接口。
H
HuangXW 已提交
21 22 23

**关键的接口/组件变更**

H
HuangXW 已提交
24
 - 涉及的应用组件
H
HuangXW 已提交
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
   - Stage模型
     - Ability
     - ServiceExtension
     - DataShareExtension
   - FA模型
     - PageAbility
     - ServiceAbility
     - DataAbility 
 - 涉及接口
   - Stage模型
     - startAbility(want: Want, callback: AsyncCallback<void>): void;
     - startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
     - startAbility(want: Want, options?: StartOptions): Promise<void>;
     - startAbilityByCall(want: Want): Promise<Caller>;
     - startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void;
     - startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback<void>): void;
     - startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise<void>;
     - startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void;
     - startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void;
     - startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>;
     - startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback<AbilityResult>): void;
     - startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback<void>): void;
     - startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise<AbilityResult>;
     - startServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void;
     - startServiceExtensionAbility(want: Want): Promise<void>;
     - startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void;
     - startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>;
     - stopServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void;
     - stopServiceExtensionAbility(want: Want): Promise<void>;
     - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void;
     - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>;
     - connectAbility(want: Want, options: ConnectOptions): number;
     - connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;
     - createDataShareHelper(context: Context, uri: string, callback: AsyncCallback<DataShareHelper>): void
   - FA模型
     - startAbility(parameter: StartAbilityParameter, callback: AsyncCallback<number>): void;
     - startAbility(parameter: StartAbilityParameter): Promise<number>;
     - startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback<AbilityResult>): void;
     - startAbilityForResult(parameter: StartAbilityParameter): Promise<AbilityResult>;
     - acquireDataAbilityHelper(uri: string): DataAbilityHelper;
     - connectAbility(request: Want, options:ConnectOptions ): number;

**适配指导**

不同场景下的启动规则说明如下:
H
HuangXW 已提交
70 71 72
 - **应用后台启动应用组件**
   - OpenHarmony 3.2-beta3 版本规则:
      - 应用位于后台时,启动应用组件不受任何限制。
73
   - OpenHarmony 3.2-beta4 版本新规则:
H
HuangXW 已提交
74
     - 当应用位于后台时,启动应用组件需鉴权,需申请的权限如下:
H
HuangXW 已提交
75 76 77 78 79 80 81 82 83 84
      - ```json
        {
            "name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND",
            "grantMode": "system_grant",
            "availableLevel": "system_basic",  
            "provisionEnable": true,
            "distributedSceneEnable": false
        }
        ```
          > **注:**
H
HuangXW 已提交
85 86
          <br> 1. 即使启动同应用的组件,也受该规则限制。
          <br> 2. 对于API8以及之前的SDK,启动serviceAbility和dataAbility不受此规则限制。
H
HuangXW 已提交
87

H
HuangXW 已提交
88
 - **跨应用启动invisible应用组件**
89
   - OpenHarmony 3.2-beta3 版本规则:
H
HuangXW 已提交
90
     - 对于APL为normal的应用,无法跨应用启动invisible的应用组件
91
   - OpenHarmony 3.2-beta4 版本新规则:
H
HuangXW 已提交
92
     - 所有应用,若需要跨应用启动invisible的应用组件,需鉴权,需申请的权限如下:
H
HuangXW 已提交
93 94 95 96 97 98 99 100 101 102 103 104
     - ```json
        {
            "name": "ohos.permission.START_INVISIBLE_ABILITY",
            "grantMode": "system_grant",
            "availableLevel": "system_core",
            "provisionEnable": true,
            "distributedSceneEnable": false
        }
        ```

 - **跨应用启动FA模型的serviceAbility与dataAbility**

105
   - OpenHarmony 3.2-beta3 版本规则:
H
HuangXW 已提交
106
     - 可任意跨应用启动serviceAbility与dataAbility
107
   - OpenHarmony 3.2-beta4 版本新规则:
H
HuangXW 已提交
108 109 110 111
     - serviceAbility与dataAbility的提供方应用需配置关联启动,否则无法被跨应用拉起。(普通应用无法配置关联启动)


 - **startAbilityByCall接口**
112
   - OpenHarmony 3.2-beta3 版本规则:
H
HuangXW 已提交
113
     - 可任意进行Call调用
114
   - OpenHarmony 3.2-beta4 版本新规则:
H
HuangXW 已提交
115 116 117 118 119 120 121 122 123 124 125 126 127
     - 不支持同应用startAbilityByCall调用
      - 跨应用startAbilityByCall调用需鉴权,需申请的权限如下:

      - ```json
        {
            "name": "ohos.permission.ABILITY_BACKGROUND_COMMUNICATION",
            "grantMode": "system_grant",
            "availableLevel": "system_basic",
            "provisionEnable": true,
            "distributedSceneEnable": false
        }
        ```
        > **注:**
Q
ql 已提交
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
        <br> 使用startAbilityByCall接口同时也受上述后台启动、跨应用启动invisible规则的限制。

## cl.ability.2 跨设备应用组件启动规则变更(仅支持系统应用)

元能力子系统跨设备应用组件启动规则在如下场景中存在变更:

 - 应用位于后台启动应用组件
 - 跨应用启动invisible应用组件
 - 跨应用启动FA模型的serviceAbility

开发者需要根据以下说明对应用进行适配。


**变更影响**

若未适配新规则,在上述场景下将无法启动应用组件
> **注意,启动应用组件是指一切启动或连接Ability的行为:**
<br> 1. 启动Ability,如使用startAbility、startAbilityForResult、startAbilityByCall等接口。
<br> 2. 连接Ability,如使用connectAbility等接口。

**关键的接口/组件变更**

 - 涉及的应用组件
   - Stage模型
     - Ability
     - ServiceExtension
   - FA模型
     - PageAbility
     - ServiceAbility
 - 涉及接口
   - Stage模型
     - startAbility(want: Want, callback: AsyncCallback<void>): void;
     - startAbilityByCall(want: Want): Promise<Caller>;
     - startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void;
     - connectAbility(want: Want, options: ConnectOptions): number;
   - FA模型
     - startAbility(parameter: StartAbilityParameter, callback: AsyncCallback<number>): void;
     - startAbility(parameter: StartAbilityParameter): Promise<number>;
     - startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback<AbilityResult>): void;
     - startAbilityForResult(parameter: StartAbilityParameter): Promise<AbilityResult>;
     - connectAbility(request: Want, options:ConnectOptions ): number;

**适配指导**

不同场景下的启动规则说明如下:
 - **应用后台启动应用组件**
   - OpenHarmony 3.2-beta3 版本规则:
      - 应用位于后台时,启动应用组件不受任何限制。
176
   - OpenHarmony 3.2-beta4 版本新规则:
Q
ql 已提交
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
     - 当应用位于后台时,启动应用组件需鉴权,需申请的权限如下:
      - ```json
        {
            "name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND",
            "grantMode": "system_grant",
            "availableLevel": "system_basic",  
            "provisionEnable": true,
            "distributedSceneEnable": false
        }
        ```
          > **注:**
          <br> 1. 即使启动同应用的组件,也受该规则限制。
          <br> 2. 对于API8以及之前的SDK,启动serviceAbility不受此规则限制。

 - **跨应用启动invisible应用组件**
192
   - OpenHarmony 3.2-beta3 版本规则:
Q
ql 已提交
193
     - 无法跨应用启动invisible的应用组件
194
   - OpenHarmony 3.2-beta4 版本新规则:
Q
ql 已提交
195 196 197 198 199 200 201 202 203 204 205 206 207
     - 若需要跨应用启动invisible的应用组件,需鉴权,需申请的权限如下:
     - ```json
        {
            "name": "ohos.permission.START_INVISIBLE_ABILITY",
            "grantMode": "system_grant",
            "availableLevel": "system_core",
            "provisionEnable": true,
            "distributedSceneEnable": false
        }
        ```

 - **跨应用启动FA模型的serviceAbility**

208
   - OpenHarmony 3.2-beta3 版本规则:
Q
ql 已提交
209
     - 可任意跨应用启动serviceAbility
210
   - OpenHarmony 3.2-beta4 版本新规则:
Q
ql 已提交
211 212 213 214 215 216 217 218 219
     - serviceAbility的提供方应用需配置关联启动,否则无法被跨应用拉起。(普通应用无法配置关联启动)
     - 关联启动配置
     - ```json
        {
            "bundleName": "",
            "app_signature": ["xxxxxxxxxxxxxxxxxxx"],
            "associatedWakeUp": true
        }
        ```