1# 包管理子系统ChangeLog
2
3## cl.bundlemanager.1 包管理API异常处理方式变更,原有API8及之前的接口全部废弃,需要使用新的API9接口
4包管理接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。对原有接口进行整改,原有API8及之前的接口全部废弃,需要使用新的API9接口。
5
6**变更影响**
7
8基于OpenHarmony3.2.8.2及之后的SDK版本开发的应用,需适配API9的模块和接口,以及的API异常处理返回方式,否则会影响原有业务逻辑。
9
10**关键接口/组件变更**
11
12新增接口按照模块进行了划分,将原有的的d.ts分成多个d.ts,可以根据业务需要导入不同的d.ts。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。部分功能有变更或者新增的接口会单独列出。
13
14为适配统一的API异常处理方式,对包管理API8及之前的接口进行废弃(下表中**原接口**列内容),并新增对应API9接口(下表中**新接口**列内容)。
15
16| 原接口(废弃)       |       新接口(新增) |
17| ------              |           ------ |
18|   @ohos.bundle.d.ts   |   [@ohos.bundle.bundleManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleManager.d.ts)     |
19|   @ohos.bundle.d.ts   |   [@ohos.bundle.freeInstall.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.freeInstall.d.ts)     |
20|   @ohos.bundle.d.ts   |   [@ohos.bundle.installer.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.installer.d.ts)     |
21|   @ohos.bundle.innerBundleManager.d.ts   |   [@ohos.bundle.launcherBundleManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.launcherBundleManager.d.ts)      |
22|  @ohos.bundle.innerBundleManager.d.ts |  [@ohos.bundle.bundleMonitor.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleMonitor.d.ts) |
23|   @ohos.bundle.defaultAppManager.d.ts   |   [@ohos.bundle.defaultAppManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.defaultAppManager.d.ts)     |
24|   @ohos.distributedBundle.d.ts   |   [@ohos.bundle.distributedBundleManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.distributedBundleManager.d.ts)     |
25|  无  |  [@ohos.bundle.appControl.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.appControl.d.ts)  |
26|  @system.package.d.ts |  无 |
27
28**适配指导**<br>
291. 调用包管理查询相关接口。
30```
31import bundle form '@ohos.bundle.bundleManager'
32```
332. 调用包管理安装卸载相关接口
34```
35import installer form '@ohos.bundle.installer'
36```
373. 调用包管理免安装相关接口
38```
39import freeInstall form '@ohos.bundle.freeInstall'
40```
414. 调用包管理launcher相关接口
42```
43import launcherBundleManager form '@ohos.bundle.launcherBundleManager'
44import bundleMonitor form '@ohos.bundle.bundleMonitor'
45```
466. 调用包管理默认应用相关接口
47```
48import defaultAppManager form '@ohos.bundle.defaultAppManager'
49```
507. 调用包管理分布式相关接口
51```
52import distributedBundle form '@ohos.bundle.distributedBundle'
53```
54此外还需要适配异常处理,具体参考新接口的接口文档。
55
56## cl.bundlemanager.2 包管理API结构体变更,原有API8及之前的结构体全部废弃,需要使用新的API9结构体
57包管理接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。原有API8及之前的结构体全部废弃,需要使用新的API9结构体。
58
59**变更影响**
60
61基于OpenHarmony3.2.8.2及之后的SDK版本开发的应用,需适配变更结构体,否则会影响原有业务逻辑。原有二级模块的导出功能也会废弃,需要使用新接口的二级模块到处能力,需要导入新的一级d.ts模块。
62
63**关键接口/组件变更**
64
65新增结构体对原有的API8及之前的结构体进行梳理,将原有API8及之前的结构体全部废弃,新增新的API9结构体,变更前后的对比如下表所示,部分结构体进行了合并,例如moduleInfo.d.ts替换为hapModuleInfo.d.tscustomizeData.d.ts替换为metadata.d.ts。结构体功能上与原结构体保持一致。部分功能有变更或者新增的结构体属性会单独列出。
66| 原结构体(废弃)       |       新结构体(新增) |
67| ------              |         ------ |
68| bundle/abilityInfo.d.ts          | [bundleManager/abilityInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/AbilityInfo.d.ts) |
69| bundle/applicationInfo.d.ts      | [bundleManager/applicationInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ApplicationInfo.d.ts) |
70| bundle/bundleInfo.d.ts           | [bundleManager/bundleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundleInfo.d.ts) |
71| bundle/bundleInstaller.d.ts      | [@ohos.bundle.installer.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.installer.d.ts) |
72| bundle/bundleStatusCallback.d.ts | [@ohos.bundle.bundleMonitor.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleMonitor.d.ts) |
73| bundle/customizeData.d.ts        | [bundleManager/metadata.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/Metadata.d.ts) |
74| bundle/dispatchInfo.d.ts         | [bundleManager/dispatchInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/DispatchInfo.d.ts) |
75| bundle/elementName.d.ts          | [bundleManager/elementName.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ElementName.d.ts) |
76| bundle/extensionAbilityInfo.d.ts | [bundleManager/extensionAbilityInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ExtensionAbilityInfo.d.ts) |
77| bundle/hapModuleInfo.d.ts        | [bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts) |
78| bundle/launcherAbilityInfo.d.ts  | [bundleManager/launcherAbilityInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/LauncherAbilityInfo.d.ts) |
79| bundle/metadata.d.ts             | [bundleManager/metadata.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/Metadata.d.ts) |
80| bundle/moduleInfo.d.ts           | [bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts) |
81| bundle/PermissionDef.d.ts        | [bundleManager/permissionDef.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/PermissionDef.d.ts) |
82| bundle/remoteAbilityInfo.d.ts    | [bundleManager/remoteAbilityInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/RemoteAbilityInfo.d.ts) |
83| bundle/shortcutInfo.d.ts         | [bundleManager/shortcutInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ShortcutInfo.d.ts) |
84
85**适配指导**<br>
861. 使用原有结构体的代码需要修改为新结构体。
872. 原有二级模块的导出功能也会废弃,可以使用新接口的二级模块到处能力,需要导入新的一级d.ts模块。
88
89## cl.bundlemanager.3 包管理查询模块接口变更,@ohos.bundle.d.ts中接口全部废弃,新增@ohos.bundle.bundleManager.d.ts、@ohos.bundle.freeInstall.d.ts和@ohos.bundle.installer.d.ts模块,将原有接口新增或者变更至新d.ts90
91包管理模块查询接口变更,废弃了@ohos.bundle中API8及之前的全部接口,其中的API9接口变更至@ohos.bundle.bundleManager、@ohos.bundle.freeInstall和@ohos.bundle.installer中,@ohos.bundle.bundleManager中新增了之前废弃的大部分接口,修改为systemapi,并增加了异常处理能力。
92
93使用方式的变化:由原来的@ohos.bundle修改为@ohos.bundle.bundleManager、@ohos.bundle.freeInstall和@ohos.bundle.installer模块来使用相关的接口。
94
95@ohos.bundle.bundleManager和@ohos.bundle.installer模块系统能力为SystemCapability.BundleManager.BundleFramework.Core,@ohos.bundle.freeInstall模块系统能力为SystemCapability.BundleManager.BundleFramework.FreeInstall96
97**变更影响**<br>
98对原有使用API version 9之前的应用无影响,使用API version 9的应用需要适配新模块和新接口。在@ohos.bundle原有的API9接口,变更到新的@ohos.bundle.bundleManager.d.ts、@ohos.bundle.freeInstall和@ohos.bundle.installer文件中。
99
100**关键的接口/组件变更**<br>
101@ohos.bundle.d.ts中涉及到的废弃和变更接口如下表所示。未在表格中列出的表明除了增加异常处理和变更导入模块外,接口名称和入参均未发生变化,直接导入新的@ohos.bundle.bundleManager.d.ts、@ohos.bundle.freeInstall和@ohos.bundle.installer就可使用。在表格中列出的均表示在API9接口上发生变更,标记为无的表示在API9上已废弃。
102
103| 原接口(废弃) | 新接口(变更或新增)| systemapi|新文件名|
104| ---| ---| --- | --|
105| BundleFlag |  BundleFlag | 否 |  @ohos.bundle.bundleManager.d.ts |
106| 无 |  ApplicationFlag | 是 |  @ohos.bundle.bundleManager.d.ts |
107| 无 |  AbilityFlag | 是 |  @ohos.bundle.bundleManager.d.ts |
108| ExtensionFlag | ExtensionAbilityFlag | 是 | @ohos.bundle.bundleManager.d.ts |
109| ColorMode |  无 |  否 |  无 |
110| GrantStatus |  PermissionGrantState | 否  |  @ohos.bundle.bundleManager.d.ts |
111| AbilityType |  AbilityType | 否 |  @ohos.bundle.bundleManager.d.ts |
112| AbilitySubType |  无 |  否 |  无 |
113| DisplayOrientation | DisplayOrientation | 否 |  @ohos.bundle.bundleManager.d.ts |
114| LaunchMode |  LaunchType | 否 | @ohos.bundle.bundleManager.d.ts |
115| ExtensionAbilityType | ExtensionAbilityType  |  是 |  @ohos.bundle.bundleManager.d.ts |
116| BundleOptions | 无  | 否 | 无 |
117| InstallErrorCode | 无 |  否 | 无  |
118| UpgradeFlag | UpgradeFlag | 是 | @ohos.bundle.freeInstall.d.ts |
119| SupportWindowMode | SupportWindowMode  | 否 | @ohos.bundle.bundleManager.d.ts |
120| getBundleInfo | getBundleInfo | 是 | @ohos.bundle.bundleManager.d.ts |
121| getBundleInstaller | getBundleInstaller | 是 | @ohos.bundle.installer.d.ts |
122| getAbilityInfo | queryAbilityInfo | 是 | @ohos.bundle.bundleManager.d.ts |
123| getApplicationInfo | getApplicationInfo | 是 | @ohos.bundle.bundleManager.d.ts |
124| queryAbilityByWant | queryAbilityInfo | 是 | @ohos.bundle.bundleManager.d.ts |
125| getAllBundleInfo | getAllBundleInfo | 是 | @ohos.bundle.bundleManager.d.ts |
126| getAllApplicationInfo | getAllApplicationInfo | 是 | @ohos.bundle.bundleManager.d.ts |
127| getNameForUid | getBundleNameByUid | 是 | @ohos.bundle.bundleManager.d.ts |
128| getBundleArchiveInfo |getBundleArchiveInfo | 是 | @ohos.bundle.bundleManager.d.ts |
129| getLaunchWantForBundle | getLaunchWantForBundle | 是 | @ohos.bundle.bundleManager.d.ts |
130| cleanBundleCacheFiles | cleanBundleCacheFiles | 是 | @ohos.bundle.bundleManager.d.ts |
131| setApplicationEnabled | setApplicationEnabled | 是 | @ohos.bundle.bundleManager.d.ts |
132| setAbilityEnabled | setAbilityEnabled | 是 | @ohos.bundle.bundleManager.d.ts |
133| queryExtensionAbilityInfos | queryExtensionAbilityInfo | 是 | @ohos.bundle.bundleManager.d.ts |
134| getPermissionDef | getPermissionDef | 是 | @ohos.bundle.bundleManager.d.ts |
135| getAbilityLabel | getAbilityLabel | 是 | @ohos.bundle.bundleManager.d.ts |
136| getAbilityIcon | getAbilityIcon | 是 | @ohos.bundle.bundleManager.d.ts |
137| isAbilityEnabled | isAbilityEnabled | 是 | @ohos.bundle.bundleManager.d.ts |
138| isApplicationEnabled | isApplicationEnabled | 是 | @ohos.bundle.bundleManager.d.ts |
139| setModuleUpgradeFlag | setHapModuleUpgradeFlag | 是 | @ohos.bundle.freeInstall.d.ts |
140| isModuleRemovable | isHapModuleRemovable | 是 | @ohos.bundle.freeInstall.d.ts |
141| getBundlePackInfo | getBundlePackInfo | 是 | @ohos.bundle.freeInstall.d.ts |
142| getDispatcherVersion | getDispatchInfo | 是 | @ohos.bundle.freeInstall.d.ts |
143| getProfileByAbility |  getProfileByAbility | 否 | @ohos.bundle.bundleManager.d.ts |
144| getProfileByExtensionAbility | getProfileByExtensionAbility | 否 | @ohos.bundle.bundleManager.d.ts |
145| setDisposedStatus | setDisposedStatus | 是 | @ohos.bundle.appControl.d.ts |
146| getDisposedStatus | getDisposedStatus | 是 | @ohos.bundle.appControl.d.ts |
147| 无 | deleteDisposedStatus |  是 | @ohos.bundle.appControl.d.ts |
148| getBundleInfoSync | getBundleInfoSync | 是 | @ohos.bundle.bundleManager.d.ts |
149| getApplicationInfoSync | getApplicationInfoSync | 是 | @ohos.bundle.bundleManager.d.ts |
150|无| getBundleInfoForSelf | 否 | @ohos.bundle.bundleManager.d.ts |
151
152
153**适配指导**<br>
154将原接口替换为API9新增的接口,导入相关的模块。
155
156旧的导入模块:
157```
158import bundle form '@ohos.bundle'
159```
160新的导入模块:
161```
162import bundle form '@ohos.bundle.bundleManager'
163import freeInstall form '@ohos.bundle.freeInstall'
164import installer form '@ohos.bundle.installer'
165import appControl form '@ohos.bundle.appControl'
166```
167
168## cl.bundlemanager.4 BundleInfo结构体变更,包管理原有bundle/bundleInfo.d.ts字段全部废弃变更为bundleManager/bundleInfo.d.ts,涉及字段属性变化。
169
170包管理原有bundle/bundleInfo.d.ts字段全部废弃。由老的[bundle/bundleInfo.d.ts]((https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundle/bundleInfo.d.ts))变更为[bundleManager/bundleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundleInfo.d.ts),涉及字段属性变化。
171
172
173**变更影响**<br>
174对原有使用API version 9之前的应用无影响,使用API version 9的应用需要适配新模块和新接口。使用二级模块导出BundleInfo时,需要导入@ohos.bundle.bundleManager模块。
175
176**关键的接口/组件变更**<br>
177
178BundleInfo结构体发生变化的字段内容如下表所示。其余字段在bundle/bundleInfo.d.ts中废弃后,在新的[bundleManager/bundleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundleInfo.d.ts)中均有对应值。没有对应字段,则表明该字段已经在API9上废弃。
179
180| 已废弃 | API9新增或变更 | 类型 |
181| --- | --- | --- |
182| type  | 无  | string |
183| appId  | 无 | string |
184| 无  |signatureInfo | SignatureInfo |
185| uid  | 无  | number |  无|
186| abilityInfos  | 无 | Array\<AbilityInfo> |
187| reqPermissions  | 无 |  Array<string> |
188| compatibleVersion | 无 | number |
189| isCompressNativeLibs  | 无  | boolean |
190|  entryModuleName | 无 | string |
191|  cpuAbi  | 无 | string |
192|  isSilentInstallation  | 无  | string |
193| entryInstallationFree  | 无  | boolean |
194| reqPermissionStates  | permissionGrantStates  | Array\<bundleManager.PermissionGrantState> |
195|  extensionAbilityInfo  | 无 |Array\<ExtensionAbilityInfo>|
196| hapModuleInfos | hapModulesInfo | Array\<HapModuleInfo> |
197
198API9中新增SignatureInfo结构体,该结构体如下:
199
200| 属性名      | 类型   |
201| ----------- | ------ |
202| appId       | string |
203| fingerprint | string |
204
205
206**适配指导**<br>
207导入包管理查询的模块,使用API9 version的BundleInfo结构体,使用二级模块导出时也需要引入下面模块。
208```
209import bundle form '@ohos.bundle.bundleManager'
210```
211
212## cl.bundlemanager.5 ApplicationInfo结构体变更,包管理原有bundle/applicationInfo.d.ts字段全部废弃,变更为bundleManager/applicationInfo.d.ts,涉及字段属性变化。
213ApplicationInfo结构体变更,包管理原有bundle/applicationInfo.d.ts字段全部废弃,变更为bundleManager/applicationInfo.d.ts,涉及字段属性变化。
214
215**变更影响**<br>
216对原有使用API version 9之前的应用无影响,使用API version 9的应用需要适配新模块和新接口。使用二级模块导出ApplicationInfo时,需要导入@ohos.bundle.bundleManager模块。
217
218**关键的接口/组件变更**<br>
219ApplicationInfo结构体发生变化的字段内容如下表所示。其余字段在bundle/applicationInfo.d.ts中废弃后,在新的[bundleManager/applicationInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ApplicationInfo.d.ts)中均有对应值。没有对应字段,则表明该字段已经在API9上废弃。
220
221| 废弃 | API9新增或变更 | 类型 |
222| --- | --- | --- |
223| systemApp | 无 | boolean  |
224| labelId |  无 | string |
225| labelIndex | labelId | number |
226| iconId | 无 | string |
227| iconIndex | iconId | number |
228| supportedModes | 无 | number  |
229| moduleSourceDirs | 无 | Array\<string> |
230| moduleInfos | 无 | Array\<ModuleInfo> |
231| metaData | 无 | Map\<string,Array\<CustomizeData>> |
232| entityType | 无 | string |
233| fingerprint | 无 | string |
234
235
236**适配指导**<br>
237导入包管理查询的模块,使用API9 version的ApplicationInfo结构体。
238
239
240## cl.bundlemanager.6 HapModuleInfo结构体字段变更,包管理原有bundle/hapModuleInfo.d.tsmoduleInfo.d.ts字段全部废弃,变更为bundleManager/hapModuleInfo.d.ts,涉及字段属性变化。
241
242HapModuleInfo结构体字段变更,包管理原有bundle/hapModuleInfo.d.tsmoduleInfo.d.ts字段全部废弃,变更为[bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts),涉及字段属性变化。
243
244**变更影响**<br>
245对原有使用API version 9之前的应用无影响,使用API version 9的应用需要适配新模块和新接口。使用二级模块导出HapModuleInfo时,需要导入@ohos.bundle.bundleManager模块。
246
247**关键的接口/组件变更**<br>
248HapModuleInfo结构体发生变化的字段内容如下表所示。其余字段在bundle/hapModuleInfo.d.ts中废弃后,在新的bundleManager/hapModuleInfo.d.ts中均有对应值。
249| 废弃 | API9新增或变更 | 类型 |
250| --- | --- | --- |
251| abilityInfo |  abilitiesInfo | Array<AbilityInfo> |
252| 无 | moduleSourceDir | string |
253| backgroundImg | 无  | string |
254| supportedModes | 无  | string |
255| reqCapabilities | 无  | Array\<string> |
256| moduleName | 无 | string |
257| mainAbilityName | 无 | string |
258| extensionAbilityInfo | extensionAbilitiesInfo | Array\<ExtensionAbilityInfo> |
259
260**适配指导**<br>
261导入包管理查询的模块,使用API9 version的HapModuleInfo结构体。
262
263## cl.bundlemanager.7 ModuleInfo结构体废弃,使用bundleManager/hapModuleInfo.d.ts中的HapModuleInfo代替。
264
265包管理原有bundle/hapModuleInfo.d.tsmoduleInfo.d.ts字段全部废弃,变更为[bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts),涉及字段属性变化。
266ModuleInfo结构体废弃,使用[bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)中的HapModuleInfo代替。
267
268**变更影响**<br>
269对原有使用API version 9之前的应用无影响,使用API version 9的应用需要适配新模块和新接口。ModuleInfo被废弃,使用HapModuleInfo代替。
270
271**关键的接口/组件变更**<br>
272
273ModuleInfo结构体被废弃,使用HapModuleInfo代替。
274
275**适配指导**<br>
276使用API9 version的HapModuleInfo结构体。
277
278## cl.bundlemanager.8 AbilityInfo结构体字段变更,原bundle/abilityInfo.d.ts全部废弃,变更为bundleManager/abilityInfo.d.ts,涉及到字段属性变化
279
280AbilityInfo结构体字段变更,原bundle/abilityInfo.d.ts全部废弃,变更为bundleManager/abilityInfo.d.ts,涉及到字段属性变化
281
282**变更影响**<br>
283对原有使用API version 9之前的应用无影响,使用API version 9的应用需要适配新模块和新接口。
284
285**关键的接口/组件变更**<br>
286
287包管理AbilityInfo结构体字段变更如下表所示,未在表格中列出的表明废弃后均在新的AbilityInfo中存在,标记为无的表明该字段已在API9废弃,在新的AbilityInfo中不存在。
288
289|废弃 | API9新增或变更 | 类型|
290|----|  --| --|
291| launchMode | launchType | number |
292| supportWindowMode | supportWindowModes | Array\<number> |
293| targetAbility | 无 | string |
294| backgroundModes | 无 | number |
295| formEnabled | 无 |  boolean |
296| subType | 无 | AbilitySubType |
297|deviceCapabilities |无| Array\<string>|
298| metaData        | 无 | Array\<CustomizeData>|
299| maxWindowRatio  | 无 | number  |
300| minWindowRatio  | 无 | number |
301| maxWindowWidth  | 无 | number  |
302| minWindowWidth  | 无 | number  |
303| maxWindowHeight | 无 | number  |
304| minWindowHeight | 无 | number   |
305| 无| windowSize | WindowSize |
306
307其中API9新增结构体WindowSize属性如下:
308
309|     属性名      |  类型  |
310| :-------------: | :----: |
311| maxWindowRatio  | number |
312| minWindowRatio  | number |
313| maxWindowWidth  | number |
314| minWindowWidth  | number |
315| maxWindowHeight | number |
316| minWindowHeight | number |
317
318**适配指导**<br>
319使用API9 version的AbilityInfo结构体。
320
321## cl.bundlemanager.9 BundleFlag变更,变更为@ohos.bundle.bundleManager中的BundleFlag、ApplicationFlag和AbilityFlag,涉及到接口入参修改。
322
323BundleFlag变更,变更为@ohos.bundle.bundleManager中的BundleFlag、ApplicationFlag和AbilityFlag,根据新接口的入参,传入不同类型的flag。
324
325**变更影响**<br>
326
327BundleFlag变更,变更为@ohos.bundle.bundleManager中的BundleFlag、ApplicationFlag和AbilityFlag,根据新接口的入参描述,传入不同类型的flag。直接使用API Version 9之前的BundleFlag,可能查询失败。
328
329
330**关键的接口/组件变更**<br>
331原@ohos.bundle中的BundleFlag全部废弃,使用新的@ohos.bundle.bundleManager中的BundleFlag、ApplicationFlag和AbilityFlag代替。
332
333API9的BundleFlag 如下表所示:
334
335|  BundleFlag |值 |描述|
336|---|---| --|
337|GET_BUNDLE_INFO_DEFAULT|0x00000000|获取默认BundleInfo,获取到的BundleInfo不包含signatureInfo, hapModuleInfo, appInfo, reqPermissionDetails和permissionGrantStates|
338|GET_BUNDLE_INFO_WITH_APPLICATION| 0x00000001|额外获取appInfos|
339|GET_BUNDLE_INFO_WITH_HAP_MODULE|0x00000002|额外获取hapModulesInfo|
340|GET_BUNDLE_INFO_WITH_ABILITY|0x00000004|指定在获取hapModulesInfo的信息中是否包含abilitiesInfo,需要和GET_BUNDLE_INFO_WITH_HAP_MODULE一起使用,不能单独使用。|
341|GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY|0x00000008|指定在获取hapModulesInfo的信息中是否包含extensionAbilitiesInfo,需要和GET_BUNDLE_INFO_WITH_HAP_MODULE一起使用,不能单独使用。|
342|GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION|0x00000010|额外获取reqPermissionDetails和permissionGrantStates|
343|GET_BUNDLE_INFO_WITH_METADATA|0x00000020|控制返回的ApplicationInfo, AbilityInfo和ExtensionAbilityInfo中是否包含metadata信息,不能单独使用|
344|GET_BUNDLE_INFO_WITH_DISABLE|0x00000040|可获取被禁用application的BundleInfo和获取abilitiesInfo中disabled ability信息|
345|GET_BUNDLE_INFO_WITH_SIGNATURE_INFO|0x00000080|额外获取signatureInfo|
346
347API9的 ApplicationFlag 如下表所示
348349|  ApplicationFlag  |值 |描述|
350|---|---| --|
351|GET_APPLICATION_INFO_DEFAULT|0x00000000|获取默认ApplicationInfo,获取的ApplicationInfo不包含permissions和matedata|
352|GET_APPLICATION_INFO_WITH_PERMISSION|0x00000001|额外获取permissions|
353|GET_APPLICATION_INFO_WITH_METADATA|0x00000002|额外获取metadata|
354|GET_APPLICATION_INFO_WITH_DISABLE|0x00000004|获取disabled的application信息|
355
356
357API9的 AbilityFlag 如下表所示:
358|  AbilityFlag |值 |描述|
359|---|---|---|
360|GET_ABILITY_INFO_DEFAULT|  0x00000000|用于获取默认的AbilityInfo信息,不包含permission、metadata和 disabled 的 AbilityInfo|
361|GET_ABILITY_INFO_WITH_PERMISSION | 0x00000001|用于获取带有permission信息的AbilityInfo|
362|GET_ABILITY_INFO_WITH_APPLICATION | 0x00000002|用于获取带有ApplicationInfo结构体信息的AbilityInfo|
363| GET_ABILITY_INFO_WITH_METADATA | 0x00000004|用于获取带有metadata信息的AbilityInfo|
364|GET_ABILITY_INFO_WITH_DISABLE | 0x00000008|用于获取所有的AbilityInfo,包含被禁用的Ability|
365|GET_ABILITY_INFO_ONLY_SYSTEM_APP | 0x00000010| 用于系统应用获取AbilityInfo|
366
367**适配指导**<br>
368根据调用的@ohos.bundle.bundleManager.d.ts中的接口,使用不同的flag类型。
369
370## cl.bundlemanager.10 默认应用模块ApplicationType枚举值变更
371@ohos.bundle.defaultApp模块,相关接口功能未发生变化,使用方式未发生变化。只有ApplicationType的枚举值有变化。
372
373**变更影响**<br>
374相关接口版本为API version 9,对API9之前的应用无影响。API9应用需要适配新枚举值。
375
376**关键的接口/组件变更**<br>
377ApplicationType的枚举值变化如下:
378|  ApplicationType   |      API9新增或变更       | API8及以前 |
379| :-----: | :-------------: | :--------: |
380| BROWSER |  "Web Browser"  | "BROWSER"  |
381|  IMAGE  | "Image Gallery" |  "IMAGE"   |
382|  AUDIO  | "Audio Player"  |  "AUDIO"   |
383|  VIDEO  | "Video Player"  |  "VIDEO"   |
384|   PDF   |  "PDF Viewer"   |   "PDF"    |
385|  WORD   |  "Word Viewer"  |   "WORD"   |
386|  EXCEL  | "Excel Viewer"  |  "EXCEL"   |
387|   PPT   |  "PPT Viewer"   |   "PPT"    |
388
389**适配指导**<br>
390导入默认应用的模块,调用相关的接口。
391```
392import defaultApp form '@ohos.bundle.defaultAppManager'
393```
394
395## cl.bundlemanager.11 分布式包管理模块变更,原@ohos.distributedBundle.d.ts接口全部废弃,变更为@ohos.bundle.distributedBundle.d.ts,涉及接口变更。
396API异常错误整改,分布式包管理模块变更,原@ohos.distributedBundle.d.ts接口全部废弃,变更为[@ohos.bundle.distributedBundleManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.distributedBundleManager.d.ts)。涉及接口getRemoteAbilityInfos,变更为getRemoteAbilityInfo。相关结构体RemoteAbilityInfo的二级模块导出功能也需要导入新模块才可以继续使用。
397
398**变更影响**<br>
399对API version 9之前的应用无影响。分布式模块和getRemoteAbilityInfos名称变更,会导致原有API version 9应用使用新的sdk编译失败。
400
401**关键的接口/组件变更**<br>
402@ohos.distributedBundle.d.ts中接口全部废弃,新增@ohos.bundle.distributedBundle.d.ts,其中部分接口保持与原接口功能一致。新接口全部支持异常处理。接口变更如下:
403| 废弃 | API9新增或变更 | systemapi |
404|----| ----| -- |
405| getRemoteAbilityInfos | getRemoteAbilityInfo | 是|
406
407**适配指导**<br>
408需要导入新的分布式模块:
409```
410import distributedBundle form '@ohos.bundle.distributedBundle'
411```
412
413## cl.bundlemanager.12 免安装模块和接口变更,从@ohos.bundle.d.ts移到@ohos.bundle.freeInstall.d.ts,涉及模块和接口变更
414API支持异常处理整改,免安装模块变更,从@ohos.bundle.d.ts移到@ohos.bundle.freeInstall.d.ts,涉及模块和接口变更,系统能力为SystemCapability.BundleManager.BundleFramework.FreeInstall4151. 原导入的@ohos.bundle模块需要变更为@ohos.bundle.freeInstall4162. setModuleUpgradeFlag变更为setHapModuleUpgradeFlag。
4173. isModuleRemovable变更为isHapModuleRemovable。
4184. getDispatcher变更为getDispatchInfo
419
420**变更影响**<br>
421对API version 9之前的应用无影响,使用API9接口的应用会编译失败。
422
423**关键的接口/组件变更**<br>
424免安装相关接口变更如下表所示。未在表中列出的表示接口名称和使用方法未发生变更,仅修改了模块名称。
425|废弃  | API9新增或变更 | systemapi |
426|----|----|----|
427|setModuleUpgradeFlag|setHapModuleUpgradeFlag| 是 |
428|isModuleRemovable|isHapModuleRemovable| 是 |
429|getDispatcher|getDispatchInfo| 是 |
430
431**适配指导**<br>
432使用免安装相关接口,需要导入新的模块,按照接口前后对应关系进行修改。
433```
434import freeInstall from '@ohos.bundle.freeInstall'
435```
436
437## cl.bundlemanager.13 免安装相关结构体DisPatchInfo、AbilityFormInfo、ModuleDistroInfo和ModuleConfigInfo发生字段变更
438免安装相关结构体DisPatchInfo、AbilityFormInfo、ModuleDistroInfo和ModuleConfigInfo发生字段变更:
4391. DispatchInfo中字段dispatchAPI名称修改为[dispatchAPIVersion](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/DispatchInfo.d.ts),属性不变,为string。表示免安装接口的版本信息,含义不变。
4402. AbilityFormInfo结构体字段属性变更,原有字段supportDimensions属性由Array\<number>修改为Array\<string>;
4413. AbilityFormInfo结构体字段属性变更,原有字段defaultDimension属性由number修改为string。
4424. ModuleDistroInfo结构体废弃mainAbility字段,移至ModuleConfigInfo结构体中。
4435. ModuleConfigInfo结构体新增mainAbility字段。
444
445**变更影响**<br>
446对API version 9之前的应用无影响。结构体名称字段属性变更,会导致原有API9应用使用新的sdk编译失败。
447
448**关键的接口/组件变更**<br>
4491. DispatchInfo
450
451| 废弃 | API9新增或变更 | 属性|
452|---|----|---|
453| dispatchAPI | dispatchAPIVersion | string |
454
4552. AbilityFormInfo
456
457| 字段 | API9属性 | 原属性 |
458|---|----|---|
459| supportDimensions | Array\<string> | Array\<number> |
460| defaultDimension | string| number |
461
4623. ModuleDistroInfo
463
464| 字段 | API9新增或变更 | 属性 |
465|---|----|---|
466| mainAbility | 无| string |
467
4684. MooduleConfigInfo
469
470| 字段 | API9新增或变更 | 属性 |
471|---|----|---|
472| 无 | mainAbility| string |
473
474
475**适配指导**<br>
476使用免安装相关接口,需要导入新的模块,按照结构体前后对应关系进行修改。
477```
478import freeInstall from '@ohos.bundle.freeInstall'
479```
480
481## cl.bundlemanager.14 结构体GrantStatus变更为PermissionGrantState
482结构体GrantStatus变更为PermissionGrantState,枚举类型和值不变。
483
484**变更影响**<br>
485对API version 9之前的应用无影响。结构体名称字变更,会导致原有API9应用使用新的sdk编译失败。
486
487**关键的接口/组件变更**<br>
488表示授权状态的GrantStatus结构体变更为@ohos.bundle.bundleManager.d.ts中的PermissionGrantState。
489| 枚举名 | 枚举值 |
490| ---| ---|
491|  PERMISSION_DENIED | -1 |
492| PERMISSION_GRANTED | 0 |
493
494**适配指导**<br>
495需要导入新的模块,修改结构体名称为PermissionGrantState。
496```
497import bundle form '@ohos.bundle.bundleManager'
498```
499## cl.bundlemanager.15 包管理ShortcutInfo结构体字段变更
500包管理ShortcutInfo结构体字段变更,原有bundle/shortcutInfo.d.ts字段全部废弃,变更为[bundleManager/shortcutInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ShortcutInfo.d.ts)。ShortcutInfo和ShortWant结构体全部为systemapi。
501
502**变更影响**<br>
503对API version 9之前的应用无影响。结构体名称字段属性变更,会导致原有API9应用使用新的sdk编译失败。
504
505**关键的接口/组件变更**<br>
506涉及到ShortcutInfo和ShortcutWant结构体。如果需要使用二级模块导出功能,需要导入新模块@ohos.bundle.launcherBundleManager507ShortcutInfo结构体变化如下表,未在表格中列出的表明字段在API9上还存在。
508| 废弃 | API9新增或变更 | 属性  |
509| ---| ---| ---|
510| disableMessage | 无 | string |
511| isStatic | 无 | boolean |
512| isHomeShortcut | 无 | boolean |
513| isEnabled | 无 | boolean |
514| disableMessage | 无 | boolean |
515
516ShortcutWant结构体如下表,未在表格中列出的表明字段在API9上还存在。
517| 废弃 | API9新增或变更 | 属性  |
518| ---| ---| ---|
519| targetClass | targetAbility | string |
520
521**适配指导**<br>
522使用免安装相关接口,需要导入新的模块,按照结构体前后对应关系进行修改。
523```
524import launcherBundleManager form '@ohos.bundle.launcherBundleManager'
525```
526
527## cl.bundlemanager.16 包管理getBundleInstaller接口变更,从@ohos.bundle.d.ts移至@ohos.bundle.installer.d.ts
528包管理getBundleInstaller接口变更,从@ohos.bundle.d.ts移至[@ohos.bundle.installer.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.installer.d.ts)
529.,系统能力为SystemCapability.BundleManager.BundleFramework.Core530
531**变更影响**<br>
532对API version 9之前的应用无影响。使用API9的应用需要适配新模块和新接口。
533
534**关键的接口/组件变更**<br>
5351. getBundleInstaller,导入模块由@ohos.bundle变更为@ohos.bundle.installer536
537**适配指导**<br>
538导入新的包管理安装模块,调用getBundleInstaller
539```
540import installer form '@ohos.bundle.installer'
541```
542
543## cl.bundlemanager.17 包管理安装接口变更,从bundle/bundleInstaller.d.ts移至@ohos.bundle.installer.d.ts
544包管理安装接口变更,从bundle/bundleInstaller.d.ts移至[@ohos.bundle.installer.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.installer.d.ts),系统能力为SystemCapability.BundleManager.BundleFramework.Core545
546**变更影响**<br>
547对API version 9之前的应用无影响。使用API9的应用需要适配新模块和新接口。
548
549**关键的接口/组件变更**<br>
5501. install/uninstall/recover接口增加了异常处理能力,接口名称和入参均未发生变化,仅修改了模块名称。
5512. HashParam结构体新增字段
552
553| API9新增 | 属性 |
554|---|---|
555| moduleName | string |
556| hashValue  | string |
557
5583. InstallParam结构体变更如下:
559
560| API9新增 | 属性 |
561|---|--|
562| userId | number |
563| installFlag | number |
564| isKeepData | boolean |
565| hashParams | Array\<HashParam> |
566| crowdtestDeadline | number |
567
5684. InstallStatus,结构体已废弃。
569
570**适配指导**<br>
571导入新的包管理安装模块,调用getBundleInstaller
572```
573import installer form '@ohos.bundle.installer'
574```
575
576## cl.bundlemanager.18 包管理安装功能变更
577包管理安装规格变更,增加了对应用deviceType配置和设备类型的匹配校验,如果两者匹配失败,则安装失败。
578
579**变更影响**<br>
580影响在此前版本已开发的应用,应用需要适配才能在新版本镜像安装成功。
581
582**关键的接口/组件变更**<br>
583不涉及
584
585**适配指导**<br>
586提供指导,在应用配置文件config.json或者module.json的deviceType配置对应的设备类型。
587```
588{
589    "module": {
590        "name": "entry",
591        "type": "entry",
592        // ...
593        "deviceTypes":[
594            // 该示例配置了default和tablet,则支持在default和tablet上进行安装。
595            "default",
596            "tablet"
597        ],
598        // ...
599    }
600```
601## cl.bundlemanager.19 包管理innerBundleManger模块接口变更,@ohos.bundle.innerBundleManger.d.ts接口全部废弃,移至@ohos.bundle.launcherBundleManager.d.ts602innerBundleManager相关接口功能未发生变化,使用方式有变化。需要导入[@ohos.bundle.launcherBundleManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.launcherBundleManager.d.ts)模块来使用innerBundleManager相关的接口,系统能力为SystemCapability.BundleManager.BundleFramework.Core603
604**变更影响**<br>
605相关接口版本为API version 9,对api9之前的应用无影响。使用了innerBundleManager接口能力的应用需要适配新的模块和接口。
606
607**关键的接口/组件变更**<br>
608以下接口功能和入参未发生变化,增加了API异常处理。使用二级模块导出ShortcutInfo和ShortcutWant时,需要导入新模块@ohos.bundle.launcherBundleManageron/off接口从@ohos.bundle.innerBundleManger.d.ts中废弃,移至@ohos.bundle.bundleMonitor.d.ts中。
6091. getLauncherAbilityInfos<br>
6102. getAllLauncherAbilityInfos<br>
6113. getShortcutInfos
612
613**适配指导**<br>
614需要导入新模块@ohos.bundle.launcherBundleManage
615```
616import launcherBundleManager form '@ohos.bundle.launcherBundleManage'
617```
618
619## cl.bundlemanager.20 innerBundleManagr模块变更,on, off接口从@ohos.bundle.innerBundleManager模块移到@ohos.bundle.bundleMonitor.d.ts模块
620innerBundleManager相关接口功能未发生变化,使用方式有变化。需要导入[@ohos.bundle.bundleMonitor.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleMonitor.d.ts)模块来使用innerBundleManager相关的接口,均为systemapi。系统能力为SystemCapability.BundleManager.BundleFramework.Core621
622**变更影响**<br>
623相关接口版本为API version 9,对API9之前的应用无影响。使用了innerBundleManager接口能力的应用需要适配新的模块和接口。
624
625**关键的接口/组件变更**<br>
626on/off变更至@ohos.bundle.bundleMonitor.d.ts,使用接口入参与老接口不同。API9函数原型为:
627```
628function on(type: BundleChangedEvent, callback: Callback<BundleChangedInfo>): void;
629function off(type: BundleChangedEvent, callback?: Callback<BundleChangedInfo>): void;
630```
631其中BundleChangedEvent为:
632```
633type BundleChangedEvent = 'add' | 'update' | 'remove';
634```
635回调函数BundleChangedInfo为:
636```
637  interface BundleChangedInfo {
638    readonly bundleName: string;
639    readonly userId: number;
640  }
641```
642由调用方获取到BundleChangedInfo后,继续执行相关操作(即老接口中BundleStatusCallback中的add、update和remove等函数)。
643
644**适配指导**<br>
645导入bundleMonitor的模块,调用相关接口。
646```
647import bundleMonitor form '@ohos.bundle.bundleMonitor'
648```
649
650## cl.bundlemanager.21 包管理bundleStatusCallback.d.ts接口全部废弃,移至@ohos.bundle.bundleMonitor.d.ts中。
651包管理bundleStatusCallback.d.ts接口全部废弃,移至[@ohos.bundle.bundleMonitor.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleMonitor.d.ts)中。原有BundleStatusCallback中的add、update和remove全部废弃,变更为BundleChangedEvent,为systemapi。系统能力为SystemCapability.BundleManager.BundleFramework.Core652
653**变更影响**<br>
654相关接口版本为API version 9,对API9之前的应用无影响。使用了BundleStatusCallback接口能力的应用需要适配新的模块和接口。
655
656**关键的接口/组件变更**<br>.
657以下接口全部废弃,在@ohos.bundle.bundleMonitor.d.ts中新增BundleChangedEvent。
6581. add
6592. update
6603. remove
661
662**适配指导**<br>
663导入bundleMonitor的模块,调用相关接口。与之前的BundleStatusCallback方式不同,BundleStatusCallback是将add、update和remove方法传入on/off接口,API9的BundleMonitor接口是通过on/off接口将BundleChangedInfo通过回调函数返回出来给调用方使用。
664```
665import bundleMonitor form '@ohos.bundle.bundleMonitor'
666```
667
668## cl.bundlemanager.22 包管理Zlib模块接口变更,@ohos.zlib.d.ts中接口涉及废弃和变更。
669包管理Zlib模块接口变更,[@ohos.zlib.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.zlib.d.ts)中接口涉及废弃和变更。系统能力为SystemCapability.BundleManager.Zlib670
671**变更影响**<br>
672相关接口版本为API version 9,对API9之前的应用无影响。使用了API9的应用需要适配新的模块和接口。
673
674**关键的接口/组件变更**<br>
675@ohos.zlib.d.ts中涉及到变更的接口如下表所示,新增API9接口使用方法与之前相同,支持API异常处理。
676| 废弃 | API9新增或变更 | systemapi|
677|---|----|---|
678| zipFile | compressFile | 是 |
679| unzipFile | decompressFile | 是 |
680| ErrorCode | 无 | 是 |
681
682**适配指导**<br>
683导入模块未发生变化,直接使用新接口,适配异常处理。
684```
685import zlib form '@ohos.zlib'
686```
687