!96 L0包管理添加安装卸载,应用数量维测

Merge pull request !96 from wangdengjia/1112beta2
This commit is contained in:
openharmony_ci
2021-11-15 03:56:53 +00:00
committed by Gitee
4 changed files with 12 additions and 1 deletions
@@ -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<uint32_t>(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) {
@@ -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);
@@ -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);
@@ -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<char *>(resPath), &relativeIconPath) != 0) {
HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] global get icon failed!");
return false;
}
// set relativeIconDir