天天看點

【OpenHarmony應用開發】定制化Launcher

在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
           
hdc shell
rm -rf /data/misc_de/0/mdds/0/default/bundle_manager_service
rm -rf  /data/accounts
reboot

           
rm -rf  /data/
reboot