在open harmony 中,如何定制化Launcher.hap;

以下以 open harmony 3.2-Bate1系统,rk3568 为例

1、在 https://gitee.com/openharmony/developtools_hapsigner 仓库的dist 中获取了 p12 文件,

2、根据p12生成配置签名cer 文件


## .csr
keytool -certreq -alias "OpenHarmony Application Release" -keystore E:\signcenter_tool\key\OpenHarmony.p12 -storetype pkcs12 -file E:\signcenter_tool\key\OpenHarmony.csr

## .cer
## 需要进入Openharmony SDK路径/toolchain/lib目录下执行
keytool -gencert -alias "OpenHarmony Application CA" -infile E:\signcenter_tool\key\OpenHarmony.csr -outfile E:\signcenter_tool\key\OpenHarmony.cer -keystore OpenHarmony.p12 -sigalg SHA384withECDSA -storepass 123456 -ext KeyUsage:"critical=digitalSignature" -validity 3650 -rfc


3、在 https://gitee.com/openharmony/applications_launcher.git 下载对应 系统分支(3.2bate)的代码,进行修改,定制化从此开始 ps:可以下载relase 的分支代码。但是需要注意 p7b 文件可能会更换;

4、配置签名,代码分支下的p7b文件,生成的cer 文件,和 1中 p12 文件到签名配置,配置到代码中

       "material": {
          "storePassword": "**********************************",
          "certpath": "D:/OpenHarmony/Sign/dist/OpenHarmony.cer",
          "keyAlias": "OpenHarmony Application Release",
          "keyPassword": "*******************************",
          "profile": "D:/OpenHarmony/applications_launcher/signature/launcher3.2.p7b",
          "signAlg": "SHA256withECDSA",
          "storeFile": "D:/OpenHarmony/Sign/dist/OpenHarmony.p12"
        }
        

5、编译生成hap 包,hdc send 文件到指令路径下,system/app/com.ohos.launcher 下

hdc file send .\phone-launcher-default-signed.hap system/app/com.ohos.launcher/Launcher.hap

此处如果传递文件有问题 Error opening file: read-only file system,改下

hdc shell
mount -o remount,rw /

再进行传递,是否需要修改 Launcher.hap 的文件权限,看需要

chmod 777 Launcher.hap

6、删除配置之前安装数据,重启

hdc shell
rm -rf /data/misc_de/0/mdds/0/default/bundle_manager_service
rm -rf  /data/accounts
reboot

建议直接删除 data 所有数据,然后重启

rm -rf  /data/
reboot

完成