fix problem

Signed-off-by: shilei <shilei91@huawei.com>
Change-Id: Ie8187f2078ac49bdc4b13c80469637232112721a
This commit is contained in:
shilei
2023-03-17 09:31:31 +00:00
parent 2aae36c5ff
commit 9ed80bcc71
7 changed files with 27 additions and 1 deletions
@@ -78,4 +78,8 @@ private:
#endif
}; // namespace OHOS
}
extern "C" {
void RefreshAllServiceTimeStamp(void);
}
#endif // OHOS_BUNDLE_UTIL_H
@@ -117,6 +117,7 @@ private:
extern "C" {
void EnableServiceWdg(void);
void DisableServiceWdg(void);
void RefreshAllServiceTimeStamp(void);
void SetCurrentBundle(const char *name);
const char *GetCurrentBundle();
}
@@ -36,4 +36,8 @@ private:
static bool HasCopiedData(const char *filePath, int32_t fp, uint64_t size);
};
} // namespace OHOS
extern "C" {
void RefreshAllServiceTimeStamp(void);
}
#endif // OHOS_GT_BUNDLE_EXTRACTOR_UTIL_H
@@ -951,6 +951,9 @@ char *BundleUtil::GetRootDir(const char *dir, int32_t index)
bool BundleUtil::CheckDirIsEmpty(const char *dirPath, List<char *>* list)
{
#ifndef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER
RefreshAllServiceTimeStamp();
#endif
DIR *dir = nullptr;
if ((dir = opendir(dirPath)) == nullptr) {
return false;
@@ -46,6 +46,7 @@ const uint8_t BMS_FOURTH_FINISHED_PROCESS = 70;
const uint8_t BMS_FIFTH_FINISHED_PROCESS = 80;
const uint8_t BMS_SIXTH_FINISHED_PROCESS = 90;
const uint8_t RADN_NUM = 16;
uint8_t GtBundleInstaller::PreCheckBundle(const char *path, int32_t &fp, SignatureInfo &signatureInfo,
uint32_t &fileSize, uint8_t bundleStyle)
{
@@ -67,6 +68,7 @@ uint8_t GtBundleInstaller::PreCheckBundle(const char *path, int32_t &fp, Signatu
return errorCode;
}
RefreshAllServiceTimeStamp();
errorCode = VerifySignature(path, signatureInfo, fileSize, bundleStyle);
if (errorCode != ERR_OK) {
UI_Free(bundleName);
@@ -243,6 +245,7 @@ uint8_t GtBundleInstaller::ProcessBundleInstall(const char *path, const char *ra
(void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING,
0, BMS_SECOND_FINISHED_PROCESS, installerCallback);
// parse HarmoyProfile.json, get permissions and bundleInfo
RefreshAllServiceTimeStamp();
errorCode = GtBundleParser::ParseHapProfile(fp, fileSize, permissions, bundleRes, &bundleInfo);
CHECK_PRO_RESULT(errorCode, fp, permissions, bundleInfo, signatureInfo);
SetCurrentBundle(bundleInfo->bundleName);
@@ -274,6 +277,7 @@ uint8_t GtBundleInstaller::ProcessBundleInstall(const char *path, const char *ra
char *tmpCodePath = BundleUtil::Strscat(tmpCodePathComp, sizeof(tmpCodePathComp) / sizeof(char *));
errorCode = (tmpCodePath == nullptr) ? ERR_APPEXECFWK_INSTALL_FAILED_INTERNAL_ERROR : ERR_OK;
CHECK_PRO_RESULT(errorCode, fp, permissions, bundleInfo, signatureInfo);
RefreshAllServiceTimeStamp();
errorCode = GtBundleExtractor::ExtractHap(tmpCodePath, installRecord.bundleName, fp, fileSize, bundleStyle);
close(fp);
CHECK_PRO_PART_ROLLBACK(errorCode, tmpCodePath, permissions, bundleInfo, signatureInfo);
@@ -286,6 +290,7 @@ uint8_t GtBundleInstaller::ProcessBundleInstall(const char *path, const char *ra
CHECK_PRO_PART_ROLLBACK(errorCode, tmpCodePath, permissions, bundleInfo, signatureInfo);
installRecord.jsEngineVersion = jsEngineVersion;
// try to transform js file to bc file
RefreshAllServiceTimeStamp();
errorCode = TransformJsToBc(tmpCodePath, installRecord);
CHECK_PRO_PART_ROLLBACK(errorCode, tmpCodePath, permissions, bundleInfo, signatureInfo);
#endif
@@ -296,7 +301,7 @@ uint8_t GtBundleInstaller::ProcessBundleInstall(const char *path, const char *ra
errorCode = HandleFileAndBackUpRecord(installRecord, tmpCodePath, randStr, bundleInfo->dataPath, isUpdate);
AdapterFree(tmpCodePath);
CHECK_PRO_ROLLBACK(errorCode, permissions, bundleInfo, signatureInfo, randStr);
RefreshAllServiceTimeStamp();
// move rawfile to data path when rawfile is exists
errorCode = MoveRawFileToDataPath(bundleInfo);
CHECK_PRO_ROLLBACK(errorCode, permissions, bundleInfo, signatureInfo, randStr);
@@ -128,10 +128,12 @@ bool GtManagerService::Install(const char *hapPath, const InstallParam *installP
(void) ReportInstallCallback(OPERATION_DOING, 0, BMS_INSTALLATION_START, installerCallback);
#ifdef _MINI_BMS_PERMISSION_
DisableServiceWdg();
RefreshAllServiceTimeStamp();
#endif
ret = installer_->Install(path, installerCallback);
#ifdef _MINI_BMS_PERMISSION_
EnableServiceWdg();
RefreshAllServiceTimeStamp();
#endif
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] Install ret is %d", ret);
if (ret == 0) {
@@ -173,10 +175,12 @@ bool GtManagerService::Uninstall(const char *bundleName, const InstallParam *ins
BMS_UNINSTALLATION_START, installerCallback);
#ifdef _MINI_BMS_PERMISSION_
DisableServiceWdg();
RefreshAllServiceTimeStamp();
#endif
uint8_t ret = installer_->Uninstall(innerBundleName);
#ifdef _MINI_BMS_PERMISSION_
EnableServiceWdg();
RefreshAllServiceTimeStamp();
#endif
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] Uninstall ret is %d", ret);
if (ret == 0) {
@@ -315,6 +319,7 @@ void GtManagerService::InstallPreBundle(List<ToBeInstalledApp *> systemPathList,
// scan system apps and third system apps
#ifdef _MINI_BMS_PERMISSION_
DisableServiceWdg();
RefreshAllServiceTimeStamp();
#endif
ScanSystemApp(uninstallRecord, &systemPathList_);
if (uninstallRecord != nullptr) {
@@ -325,6 +330,7 @@ void GtManagerService::InstallPreBundle(List<ToBeInstalledApp *> systemPathList,
ScanThirdApp(INSTALL_PATH, &systemPathList_);
#ifdef _MINI_BMS_PERMISSION_
EnableServiceWdg();
RefreshAllServiceTimeStamp();
#endif
for (auto node = systemPathList.Begin(); node != systemPathList.End(); node = node->next_) {
ToBeInstalledApp *toBeInstalledApp = node->value_;
@@ -338,6 +344,7 @@ void GtManagerService::InstallPreBundle(List<ToBeInstalledApp *> systemPathList,
toBeInstalledApp->isSystemApp);
}
(void) Install(toBeInstalledApp->path, nullptr, installerCallback);
RefreshAllServiceTimeStamp();
}
RemoveSystemAppPathList(&systemPathList);
}
@@ -638,6 +645,7 @@ void GtManagerService::ReloadEntireBundleInfo(const char *appPath, const char *b
APP_ERRCODE_EXTRA(EXCE_ACE_APP_SCAN, EXCE_ACE_APP_SCAN_PARSE_JSON_FALIED);
AdapterFree(appId);
AdapterFree(codePath);
BundleUtil::RemoveDir(appPath);
return;
}
}
@@ -117,6 +117,7 @@ uint8_t GtExtractorUtil::ExtractFileHeaderInfo(int32_t fp, char **bundleName)
uint8_t GtExtractorUtil::ExtractFileToPath(const char *appInstallPath, int32_t fp, uint64_t &fileSize, char **fileName,
char **relativeFilePath)
{
RefreshAllServiceTimeStamp();
uint8_t errorCode = ExtractFileAttr(fp, fileName, relativeFilePath, fileSize);
if (errorCode != ERR_OK) {
return errorCode;