From 33da2d7dedfdfa68af48d36f1173889012698e5b Mon Sep 17 00:00:00 2001 From: wangdengjia Date: Fri, 12 Nov 2021 10:54:43 +0800 Subject: [PATCH] IssueNo:#I4HYR7 Description:add bms log Sig:appexecfwk Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: wangdengjia Change-Id: Ia4a3bd5e8f84f64c9130f413ac81cb7e29ec9084 Signed-off-by: wangdengjia --- services/bundlemgr_lite/src/gt_bundle_extractor.cpp | 4 ++++ services/bundlemgr_lite/src/gt_bundle_installer.cpp | 1 + services/bundlemgr_lite/src/gt_bundle_manager_service.cpp | 5 ++++- services/bundlemgr_lite/src/gt_bundle_parser.cpp | 3 +++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/services/bundlemgr_lite/src/gt_bundle_extractor.cpp b/services/bundlemgr_lite/src/gt_bundle_extractor.cpp index 1750d77..25b11d1 100755 --- a/services/bundlemgr_lite/src/gt_bundle_extractor.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_extractor.cpp @@ -142,6 +142,7 @@ bool GtBundleExtractor::ExtractResourceFile(const char *path, int32_t fp, uint32 uint8_t errorCode = ExtractFileDataPos(fp, index); if (errorCode != ERR_OK) { + HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] extract file data pos failed!"); return false; } @@ -188,6 +189,7 @@ uint8_t GtBundleExtractor::ExtractInstallMsg(const char *path, char **bundleName int32_t totalFileSize = APPVERI_GetUnsignedFileLength(path); if (totalFileSize == V_ERR) { + HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] get unsigned file length failed!"); return ERR_APPEXECFWK_INSTALL_FAILED_INTERNAL_ERROR; } @@ -209,6 +211,7 @@ uint8_t GtBundleExtractor::ExtractInstallMsg(const char *path, char **bundleName } // extractor config.json、 resources dir and resources.index in TMP_RESOURCE_DIR if (!ExtractResourceFile(TMP_RESOURCE_DIR, fp, static_cast(totalFileSize))) { + HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] extract resource file failed!"); close(fp); return ERR_APPEXECFWK_INSTALL_FAILED_PARSE_PROFILE_ERROR; } @@ -217,6 +220,7 @@ uint8_t GtBundleExtractor::ExtractInstallMsg(const char *path, char **bundleName BundleRes bundleRes = { 0 }; BundleInfo *bundleInfo = GtBundleParser::ParseHapProfile(TMP_RESOURCE_DIR, &bundleRes); if (bundleInfo == nullptr) { + HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] parse hap profile get bundle info failed!"); return ERR_APPEXECFWK_INSTALL_FAILED_PARSE_PROFILE_ERROR; } if (bundleRes.abilityRes != nullptr) { diff --git a/services/bundlemgr_lite/src/gt_bundle_installer.cpp b/services/bundlemgr_lite/src/gt_bundle_installer.cpp index 05e5de3..c5ab267 100755 --- a/services/bundlemgr_lite/src/gt_bundle_installer.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_installer.cpp @@ -92,6 +92,7 @@ uint8_t GtBundleInstaller::PreCheckBundle(const char *path, int32_t &fp, Signatu // check number of current installed third bundles whether is to MAX_THIRD_BUNDLE_NUMBER if (bundleStyle == THIRD_APP_FLAG) { uint32_t numOfBundles = GtManagerService::GetInstance().GetNumOfThirdBundles(); + HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] bundle num is %d", numOfBundles); if (GtManagerService::GetInstance().QueryBundleInfo(bundleName) == nullptr && numOfBundles >= MAX_THIRD_BUNDLE_NUMBER) { UI_Free(bundleName); diff --git a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp index a62f305..5947505 100755 --- a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp @@ -98,7 +98,8 @@ bool GtManagerService::Install(const char *hapPath, const InstallParam *installP &(bundleInstallMsg_->bigIconPath)); if (ret != 0) { - char *name = strchr(path, '/'); + HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] Install extract install msg failed, ret is %d", ret); + char *name = strrchr(path, '/'); bundleInstallMsg_->bundleName = Utils::Strdup(name + 1); (void) ReportInstallCallback(ret, BUNDLE_INSTALL_FAIL, BMS_INSTALLATION_COMPLETED, installerCallback); ClearSystemBundleInstallMsg(); @@ -112,6 +113,7 @@ bool GtManagerService::Install(const char *hapPath, const InstallParam *installP DisableServiceWdg(); ret = installer_->Install(path, installerCallback); EnableServiceWdg(); + HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] Install ret is %d", ret); if (ret == 0) { (void) ReportInstallCallback(ret, BUNDLE_INSTALL_OK, BMS_INSTALLATION_COMPLETED, installerCallback); } else { @@ -150,6 +152,7 @@ bool GtManagerService::Uninstall(const char *bundleName, const InstallParam *ins (void) ReportUninstallCallback(OPERATION_DOING, BUNDLE_UNINSTALL_DOING, innerBundleName, BMS_UNINSTALLATION_START, installerCallback); uint8_t ret = installer_->Uninstall(innerBundleName); + HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] Uninstall ret is %d", ret); if (ret == 0) { (void) ReportUninstallCallback(ret, BUNDLE_UNINSTALL_OK, innerBundleName, BMS_INSTALLATION_COMPLETED, installerCallback); diff --git a/services/bundlemgr_lite/src/gt_bundle_parser.cpp b/services/bundlemgr_lite/src/gt_bundle_parser.cpp index 8411181..3df4aa0 100755 --- a/services/bundlemgr_lite/src/gt_bundle_parser.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_parser.cpp @@ -402,6 +402,7 @@ BundleInfo *GtBundleParser::CreateBundleInfo(const char *path, const BundleProfi uint8_t errorCode = ConvertResInfoToBundleInfo(path, bundleRes.abilityRes->labelId, bundleRes.abilityRes->iconId, bundleInfo); if (errorCode != ERR_OK) { + HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] convert res to bundle info failed!"); BundleInfoUtils::FreeBundleInfo(bundleInfo); return nullptr; } @@ -450,6 +451,7 @@ uint8_t GtBundleParser::ConvertResInfoToBundleInfo(const char *path, uint32_t la if (labelId != 0) { char *label = nullptr; if (GLOBAL_GetValueById(labelId, resPath, &label) != 0) { + HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] global get label failed!"); Free(label); AdapterFree(resPath); return ERR_APPEXECFWK_INSTALL_FAILED_PARSE_LABEL_RES_ERROR; @@ -479,6 +481,7 @@ bool GtBundleParser::ConvertIconResToBundleInfo(const char *resPath, uint32_t ic char *relativeIconPath = nullptr; if (GLOBAL_GetValueById(iconId, const_cast(resPath), &relativeIconPath) != 0) { + HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] global get icon failed!"); return false; } // set relativeIconDir