1e41f4b71Sopenharmony_ci# module的切换 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci从FA模型切换到Stage模型时,开发者需要将config.json文件module标签下的配置迁移到module.json5配置文件module标签下,具体差异见下列表格。 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci**表1** FA模型module标签与Stage模型module标签差异对比 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci| FA标签 | 标签说明 | 对应的Stage标签 | 差异说明 | 9e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 10e41f4b71Sopenharmony_ci| mainAbility | 服务中心图标露出的ability,常驻进程拉起时会启动mainAbility。 | mainElement | 标签名称变更,Stage模型不在使用“.”符号。 | 11e41f4b71Sopenharmony_ci| package | 标识HAP的包结构名称,在应用内保证唯一性。 | / | Stage模型使用name来保证应用唯一性。**FA模型升级到Stage模型时,Stage模型的name需要和FA模型的package保持一致,否则会导致升级失败。** | 12e41f4b71Sopenharmony_ci| name | 标识HAP的类名。 | / | FA模型中实际未使能,Stage模型没有与之对应的标签。 | 13e41f4b71Sopenharmony_ci| supportedModes | 标识应用支持的运行模式,当前只定义了驾驶模式(drive)。 | / | Stage模型已废弃。 | 14e41f4b71Sopenharmony_ci| distro对象中的moduleName | 标识当前HAP的名称。<br/>**distro对象**中的moduleName。 | name | 标签变更。 | 15e41f4b71Sopenharmony_ci| distro对象中的moduleType | 标识当前HAP的类型,包括两种类型:entry和feature。另外,如果表示HAR包类型,请设置为har。 | type | 标签变更。 | 16e41f4b71Sopenharmony_ci| distro对象中的installationFree | 标识当前HAP是否支持免安装特性。 | installationFree | 标签变更。 | 17e41f4b71Sopenharmony_ci| distro对象中的deliveryWithInstall | 标识当前HAP是否支持随应用安装。 | deliveryWithInstall | 标签变更。 | 18e41f4b71Sopenharmony_ci| metaData | 标识HAP的元信息。 | metadata | 具体差异见表2。 | 19e41f4b71Sopenharmony_ci| abilities | 标识当前模块内的所有Ability。 | abilities | 具体差异见表5。 | 20e41f4b71Sopenharmony_ci| js | 标识基于ArkUI框架开发的JS模块集合,其中的每个元素代表一个JS模块的信息。 | pages | Stage模型在module标签下保留该对象中的pages,window配置与pages的下一级。 | 21e41f4b71Sopenharmony_ci| shortcuts | 标识应用的快捷方式信息。 | shortcut_config.json文件 | 在开发视图的resources/base/profile下面定义配置文件shortcut_config.json。 | 22e41f4b71Sopenharmony_ci| reqPermissions | 标识应用运行时向系统申请的权限。 | requestPermissions | 标签名称变更。 | 23e41f4b71Sopenharmony_ci| colorMode | 标识应用自身的颜色模式。 | / | Stage模型不支持。 | 24e41f4b71Sopenharmony_ci| distroFilter | 标识应用的分发规则。 | distributionFilter_config.json文件 | Stage模型在开发视图的resources/base/profile下面定义配置文件distributionFilter_config.json。 | 25e41f4b71Sopenharmony_ci| reqCapabilities | 标识运行应用程序所需的设备能力。 | / | Stage模型不支持。 | 26e41f4b71Sopenharmony_ci| commonEvents | 公共事件。 | common_event_config.json文件 | Stage模型在开发视图的resources/base/profile下面定义配置文件common_event_config.json。 | 27e41f4b71Sopenharmony_ci| entryTheme | 此标签标识系统内部主题的关键字。 | / | Stage模型不支持。 | 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci**表2** FA模型metaData和Stage中metadata对比 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ci| FA标签 | 标签说明 | 对应的Stage模型标签 | 差异对比 | 33e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 34e41f4b71Sopenharmony_ci| parameters | 标识调用Ability时所有调用参数的元信息。 | / | Stage模型不支持。 | 35e41f4b71Sopenharmony_ci| results | 标识Ability返回值的元信息。 | / | Stage模型不支持。 | 36e41f4b71Sopenharmony_ci| customizeData | 该标签标识父级组件的自定义元信息,Parameters和results在application不可配。 | metadata | 具体差异见表3。 | 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci**表3** FA模型metaData的customizeData和Stage中metadata对比 39e41f4b71Sopenharmony_ci 40e41f4b71Sopenharmony_ci| FA标签 | 标签说明 | 对应的Stage模型标签 | 差异对比 | 41e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 42e41f4b71Sopenharmony_ci| name | 标识数据项的键名称。字符串最大长度为255字节。 | name | 无。 | 43e41f4b71Sopenharmony_ci| value | 标识数据项的值。字符串最大长度为255字节。 | value | 无。 | 44e41f4b71Sopenharmony_ci| extra | 标识当前custom数据的格式,取值为表示extra的资源值。 | resource | 标签变更。具体实例见表4。 | 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ci**表4** FA模型metaData和Stage中metadata示例 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ci| FA模型示例 | Stage模型示例 | 50e41f4b71Sopenharmony_ci| -------- | -------- | 51e41f4b71Sopenharmony_ci| “meteData”: {<br/> "customizeDate": [{<br/> "name": "label",<br/> "value": "string",<br/> "extra": "$string:label",<br/> }]<br/>} | “meteData”: [{<br/> "name": "label",<br/> "value": "string",<br/> "resource": "$string:label",<br/>}] | 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci 54e41f4b71Sopenharmony_ci**表5** FA模型和Stage中abilities差异对比 55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ci| FA模型的abilities对象标签 | 描述 | Stage模型中abilities对象标签 | 差异对比 | 57e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 58e41f4b71Sopenharmony_ci| process | 运行应用程序或Ability的进程名称。 | / | Stage模型不支持abilities中配置,在module标签下配置process。 | 59e41f4b71Sopenharmony_ci| uri | 标识Ability的统一资源标识符。 | / | Stage模型不支持。 | 60e41f4b71Sopenharmony_ci| deviceCapability | 标识Ability运行时要求设备具有的能力,采用字符串数组的格式表示。 | / | Stage模型不支持。 | 61e41f4b71Sopenharmony_ci| metaData | 该标签标识ability的元信息。 | metadata | 具体差异见表2。 | 62e41f4b71Sopenharmony_ci| type | 标识Ability的类型。 | / | Stage模型不支持。 | 63e41f4b71Sopenharmony_ci| grantPermission | 指定是否可以向Ability内任何数据授予权限。 | / | abilities内不支持。 | 64e41f4b71Sopenharmony_ci| readPermission | 标识读取Ability的数据所需的权限。该标签仅适用于data类型的Ability。 | / | abilities内不支持,在extensionAbilities标签中支持。 | 65e41f4b71Sopenharmony_ci| writePermission | 标识向Ability写数据所需的权限。 | / | abilities内不支持,在extensionAbilities标签中支持。 | 66e41f4b71Sopenharmony_ci| configChanges | 标识Ability关注的系统配置集合。 | / | Stage模型不支持。 | 67e41f4b71Sopenharmony_ci| mission | 标识Ability指定的任务栈。 | / | Stage模型不支持。 | 68e41f4b71Sopenharmony_ci| targetAbility | 标识当前Ability重用的目标Ability。 | / | Stage模型不支持。 | 69e41f4b71Sopenharmony_ci| multiUserShared | 标识Ability是否支持多用户状态进行共享,该标签仅适用于data类型的Ability。 | / | Stage模型不支持。 | 70e41f4b71Sopenharmony_ci| supportPipMode | 标识Ability是否支持用户进入PIP模式(用于在页面最上层悬浮小窗口,俗称"画中画",常见于视频播放等场景)。 | / | Stage模型不支持。 | 71e41f4b71Sopenharmony_ci| formsEnabled | 标识Ability是否支持卡片(forms)功能。 | / | Stage模型不支持。 | 72e41f4b71Sopenharmony_ci| forms | 标识服务卡片的属性。该标签仅当formsEnabled为"true"时,才能生效。 | form_config.json文件 | Stage模型在开发视图的resources/base/profile下面定义配置文件form_config.json。 | 73e41f4b71Sopenharmony_ci| srcLanguage | Ability开发语言的类型。 | / | Stage模型不支持。 | 74e41f4b71Sopenharmony_ci| srcPath | 该标签标识Ability对应的JS组件代码路径。 | srcEntry | 该标签标识ability所对应的js代码路径。 | 75e41f4b71Sopenharmony_ci| uriPermission | 标识该Ability有权访问的应用程序数据。 | / | Stage模型不支持。 | 76