diff --git a/services/bundlemgr_lite/include/bundle_util.h b/services/bundlemgr_lite/include/bundle_util.h index 76c45fc05051fb7727f93b384b14854530c13ddf..1b316f8f4cf82b6f3c476e7cef701fc7600f32a9 100755 --- a/services/bundlemgr_lite/include/bundle_util.h +++ b/services/bundlemgr_lite/include/bundle_util.h @@ -78,4 +78,8 @@ private: #endif }; // namespace OHOS } + +extern "C" { +void RefreshAllServiceTimeStamp(void); +} #endif // OHOS_BUNDLE_UTIL_H diff --git a/services/bundlemgr_lite/include/gt_bundle_manager_service.h b/services/bundlemgr_lite/include/gt_bundle_manager_service.h index 37b83e377d87b2e44a2189b2b7836c471681e37f..b01db917f8e5f359642520409066cbb40c892c93 100644 --- a/services/bundlemgr_lite/include/gt_bundle_manager_service.h +++ b/services/bundlemgr_lite/include/gt_bundle_manager_service.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(); } diff --git a/services/bundlemgr_lite/include/gt_extractor_util.h b/services/bundlemgr_lite/include/gt_extractor_util.h index 1b1f6c70929734cce383073615a5277ad0c44d27..cd80804915599e9f940f91c1c70a0e962bb1f335 100644 --- a/services/bundlemgr_lite/include/gt_extractor_util.h +++ b/services/bundlemgr_lite/include/gt_extractor_util.h @@ -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 diff --git a/services/bundlemgr_lite/src/bundle_util.cpp b/services/bundlemgr_lite/src/bundle_util.cpp index ae73c7fabebb0a7ae611c5188f407d3fc65011dd..6737d8eb635450cba4eb455b6d32a972be7f9443 100644 --- a/services/bundlemgr_lite/src/bundle_util.cpp +++ b/services/bundlemgr_lite/src/bundle_util.cpp @@ -951,6 +951,9 @@ char *BundleUtil::GetRootDir(const char *dir, int32_t index) bool BundleUtil::CheckDirIsEmpty(const char *dirPath, List* list) { +#ifndef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER + RefreshAllServiceTimeStamp(); +#endif DIR *dir = nullptr; if ((dir = opendir(dirPath)) == nullptr) { return false; diff --git a/services/bundlemgr_lite/src/gt_bundle_installer.cpp b/services/bundlemgr_lite/src/gt_bundle_installer.cpp index 80758aa8c87cfffa028520ee4fb6e4720348fae4..b0ad7e276cd46952d869226b1f934be5f28df778 100644 --- a/services/bundlemgr_lite/src/gt_bundle_installer.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_installer.cpp @@ -68,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); @@ -244,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); @@ -275,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); @@ -287,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 @@ -297,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); diff --git a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp index bc76f451c4e1e8db13dc94bf49c675ae8f336ac8..fd9f5da80f8a974a713526742c7dbdd016111bcc 100644 --- a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp @@ -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 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 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 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; } } diff --git a/services/bundlemgr_lite/src/gt_extractor_util.cpp b/services/bundlemgr_lite/src/gt_extractor_util.cpp index 13b167a68671e8f3846192e8719d48f15f4cbc38..cd4d622fecc1ae12f39338225636eef12fba299c 100644 --- a/services/bundlemgr_lite/src/gt_extractor_util.cpp +++ b/services/bundlemgr_lite/src/gt_extractor_util.cpp @@ -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;