1 修改gn 系统源码 code/rk3568/applications/standard/hap/BUILD.gn,(参照别的系统app的gn配置修改,如短信)
2 修改系统源码两个list配置清单 code/rk3568/vendor/hihope/rk3568/preinstall-config/install_list.json --- /install_list_capability.json
参考网址 https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-app-privilege-config-guide.md#/openharmony/docs/blob/master/zh-cn/application-dev/security/app-provision-structure.md
签名工具 https://gitee.com/openharmony/developtools_hapsigner 也可用编译器自带证书,然后提取编译器自带证书的.cer文件的第一个证书指纹
3 修改hap源码 config入口module的ServerAbility
4,打入hap包到系统源码 code/rk3568/applications/standard/hap/
以上涉及到系统源码的都是要编译在OpenHarmony镜像里,至于目录,每个人编译镜像的服务器目录不一样,如果不知道自己的目录,大可直接用find命令 搜 这个系统源码相关文件的位置
install_list.json代码追加示例:
{
"app_dir" : "/system/app/com.demo.demo",
"removable" : false
}
install_list_capability.json代码追加示例:
{
"bundleName": "com.demo.demo",
"singleton": true,
"keepAlive": true,
"associatedWakeUp": true,
"allowAppDesktopIconHide": true,
"allowAbilityExcludeFromMissions": true,
"app_signature" : ["C1A5CFEB63DDE3A6987BC97DDDC3B8F701A1E7E8FC3959A6FC9DD9A5CD2CB789"],//注意此指纹要和hap指纹一样
"allowCommonEvent": ["usual.event.BOOT_COMPLETED"]
}
config示例: (重点是:1,"mainAbility": "com.demo.demo.ServiceAbility", 2,"singleton": true, )
{
"app": {
"bundleName": "com.demo.demo",
"vendor": "example",
"singleton": true,
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
"default": {
"keepAlive": true
}
},
"module": {
"package": "com.demo.demo",
"name": ".MyApplication",
"mainAbility": "com.demo.demo.ServiceAbility",
"deviceType": [
"default",
"tablet"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "ets",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "singleton"
},
{
"name": ".ServiceAbility",
"srcLanguage": "ets",
"srcPath": "ServiceAbility",
"icon": "$media:icon",
"description": "$string:ServiceAbility_desc",
"type": "service",
"visible": true
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"reqPermissions": [
{
"name": "ohos.permission.XXX"
}
]
}
}