mirror of
https://github.com/openharmony/bundlemanager_bundle_framework_lite.git
synced 2026-07-18 17:54:39 -04:00
add
Signed-off-by: shilei <shilei91@huawei.com> Change-Id: Ib884141808ad9ae93ce4c3660c7ad6de01ba65da
This commit is contained in:
@@ -61,7 +61,6 @@ lite_library("bundle") {
|
||||
"${aafwk_lite_path}/interfaces/kits/want_lite",
|
||||
"${aafwk_lite_path}/interfaces/kits/ability_lite/slite",
|
||||
"${aafwk_lite_path}/interfaces/inner_api/abilitymgr_lite",
|
||||
"//foundation/communication/ipc/interfaces/innerkits/c/ipc/include",
|
||||
"//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr",
|
||||
"//foundation/systemabilitymgr/samgr_lite/interfaces/kits/registry",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
|
||||
@@ -61,7 +61,6 @@ if (ohos_kernel_type == "liteos_m") {
|
||||
"//base/global/resource_management_lite/interfaces/inner_api/include",
|
||||
"//foundation/systemabilitymgr/samgr_lite/interfaces/kits/registry",
|
||||
"//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr",
|
||||
"//foundation/communication/ipc/interfaces/innerkits/c/ipc/include",
|
||||
"//third_party/jerryscript/jerry-core",
|
||||
"//third_party/jerryscript/jerry-core/api",
|
||||
"//third_party/jerryscript/jerry-core/ecma/base",
|
||||
|
||||
@@ -186,14 +186,14 @@ uint8_t GtBundleExtractor::ExtractInstallMsg(const char *path, char **bundleName
|
||||
if (!BundleUtil::CheckRealPath(path)) {
|
||||
return ERR_APPEXECFWK_INSTALL_FAILED_PARAM_ERROR;
|
||||
}
|
||||
#ifdef __LITEOS_M__
|
||||
int32_t totalFileSize = BundleUtil::GetFileSize(path);
|
||||
#else
|
||||
#ifdef _MINI_BMS_
|
||||
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;
|
||||
}
|
||||
#else
|
||||
int32_t totalFileSize = BundleUtil::GetFileSize(path);
|
||||
#endif
|
||||
char *emptyJsPathComp[] = {const_cast<char *>(TMP_RESOURCE_DIR), const_cast<char *>(ASSET_JS_PATH)};
|
||||
char *emptyJsPath = BundleUtil::Strscat(emptyJsPathComp, sizeof(emptyJsPathComp) / sizeof(char *));
|
||||
|
||||
@@ -46,7 +46,6 @@ 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)
|
||||
{
|
||||
@@ -107,7 +106,7 @@ uint8_t GtBundleInstaller::PreCheckBundle(const char *path, int32_t &fp, Signatu
|
||||
uint8_t GtBundleInstaller::VerifySignature(const char *path, SignatureInfo &signatureInfo, uint32_t &fileSize,
|
||||
uint8_t bundleStyle)
|
||||
{
|
||||
#ifndef __LITEOS_M__
|
||||
#ifdef _MINI_BMS_
|
||||
VerifyResult verifyResult;
|
||||
// verify signature
|
||||
(void) APPVERI_SetDebugMode(true);
|
||||
@@ -252,16 +251,21 @@ uint8_t GtBundleInstaller::ProcessBundleInstall(const char *path, const char *ra
|
||||
uint32_t iconId = (bundleRes.abilityRes != nullptr) ? bundleRes.abilityRes->iconId : 0;
|
||||
AdapterFree(bundleRes.abilityRes);
|
||||
// check signatureInfo
|
||||
#ifndef __LITEOS_M__
|
||||
#ifdef _MINI_BMS_
|
||||
errorCode = CheckProvisionInfoIsValid(signatureInfo, permissions, bundleInfo->bundleName);
|
||||
CHECK_PRO_RESULT(errorCode, fp, permissions, bundleInfo, signatureInfo);
|
||||
#endif
|
||||
installRecord.codePath = bundleInfo->codePath;
|
||||
installRecord.bundleName = bundleInfo->bundleName;
|
||||
#ifdef _MINI_BMS_
|
||||
installRecord.appId = signatureInfo.appId;
|
||||
bundleInfo->appId = Utils::Strdup(signatureInfo.appId);
|
||||
#else
|
||||
char innerAppId[] = "appId";
|
||||
installRecord.appId = innerAppId;
|
||||
installRecord.versionCode = bundleInfo->versionCode;
|
||||
bundleInfo->appId = Utils::Strdup(innerAppId);
|
||||
#endif
|
||||
installRecord.versionCode = bundleInfo->versionCode;
|
||||
// check version when in update status
|
||||
errorCode = CheckVersionAndSignature(installRecord.bundleName, installRecord.appId, bundleInfo);
|
||||
CHECK_PRO_RESULT(errorCode, fp, permissions, bundleInfo, signatureInfo);
|
||||
@@ -586,7 +590,7 @@ uint8_t GtBundleInstaller::Uninstall(const char *bundleName)
|
||||
if (sprintf_s(bundleJsonPath, PATH_LENGTH, "%s%s%s", JSON_PATH, bundleName, JSON_SUFFIX) < 0) {
|
||||
return ERR_APPEXECFWK_UNINSTALL_FAILED_INTERNAL_ERROR;
|
||||
}
|
||||
#ifndef __LITEOS_M__
|
||||
#ifdef _MINI_BMS_
|
||||
if (DeletePermissions(const_cast<char *>(bundleName)) < 0) {
|
||||
return ERR_APPEXECFWK_UNINSTALL_FAILED_DELETE_PERMISSIONS_ERROR;
|
||||
}
|
||||
@@ -743,7 +747,7 @@ uint8_t GtBundleInstaller::StorePermissions(const char *bundleName, PermissionTr
|
||||
bool isUpdate)
|
||||
{
|
||||
if (permNum == 0) {
|
||||
#ifndef __LITEOS_M__
|
||||
#ifdef _MINI_BMS_
|
||||
if (isUpdate) {
|
||||
int32_t ret = DeletePermissions(bundleName);
|
||||
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] delete permissions, result is %d", ret);
|
||||
@@ -759,7 +763,7 @@ uint8_t GtBundleInstaller::StorePermissions(const char *bundleName, PermissionTr
|
||||
if (!BundleUtil::IsDir(PERMISSIONS_PATH)) {
|
||||
BundleUtil::MkDirs(PERMISSIONS_PATH);
|
||||
}
|
||||
#ifndef __LITEOS_M__
|
||||
#ifdef _MINI_BMS_
|
||||
if (SaveOrUpdatePermissions(const_cast<char *>(bundleName), permissions, permNum,
|
||||
static_cast<IsUpdate>(isUpdate)) != 0) {
|
||||
return ERR_APPEXECFWK_INSTALL_FAILED_STORE_PERMISSIONS_ERROR;
|
||||
|
||||
@@ -126,11 +126,11 @@ bool GtManagerService::Install(const char *hapPath, const InstallParam *installP
|
||||
|
||||
SetCurrentBundle(bundleInstallMsg_->bundleName);
|
||||
(void) ReportInstallCallback(OPERATION_DOING, 0, BMS_INSTALLATION_START, installerCallback);
|
||||
#ifdef BC_TRANS_ENABLE
|
||||
#ifdef _MINI_BMS_
|
||||
DisableServiceWdg();
|
||||
#endif
|
||||
ret = installer_->Install(path, installerCallback);
|
||||
#ifdef BC_TRANS_ENABLE
|
||||
#ifdef _MINI_BMS_
|
||||
EnableServiceWdg();
|
||||
#endif
|
||||
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] Install ret is %d", ret);
|
||||
@@ -171,11 +171,11 @@ bool GtManagerService::Uninstall(const char *bundleName, const InstallParam *ins
|
||||
|
||||
(void) ReportUninstallCallback(OPERATION_DOING, BUNDLE_UNINSTALL_DOING, innerBundleName,
|
||||
BMS_UNINSTALLATION_START, installerCallback);
|
||||
#ifdef BC_TRANS_ENABLE
|
||||
#ifdef _MINI_BMS_
|
||||
DisableServiceWdg();
|
||||
#endif
|
||||
uint8_t ret = installer_->Uninstall(innerBundleName);
|
||||
#ifdef BC_TRANS_ENABLE
|
||||
#ifdef _MINI_BMS_
|
||||
EnableServiceWdg();
|
||||
#endif
|
||||
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] Uninstall ret is %d", ret);
|
||||
@@ -310,7 +310,7 @@ void GtManagerService::InstallPreBundle(List<ToBeInstalledApp *> systemPathList,
|
||||
}
|
||||
|
||||
// scan system apps and third system apps
|
||||
#ifdef BC_TRANS_ENABLE
|
||||
#ifdef _MINI_BMS_
|
||||
DisableServiceWdg();
|
||||
#endif
|
||||
ScanSystemApp(uninstallRecord, &systemPathList_);
|
||||
@@ -320,7 +320,7 @@ void GtManagerService::InstallPreBundle(List<ToBeInstalledApp *> systemPathList,
|
||||
|
||||
// scan third apps
|
||||
ScanThirdApp(INSTALL_PATH, &systemPathList_);
|
||||
#ifdef BC_TRANS_ENABLE
|
||||
#ifdef _MINI_BMS_
|
||||
EnableServiceWdg();
|
||||
#endif
|
||||
for (auto node = systemPathList.Begin(); node != systemPathList.End(); node = node->next_) {
|
||||
@@ -350,6 +350,9 @@ void GtManagerService::InstallAllSystemBundle(InstallerCallback installerCallbac
|
||||
PreAppList *currentNode = nullptr;
|
||||
PreAppList *nextNode = nullptr;
|
||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(currentNode, nextNode, &list->appDoubleList, PreAppList, appDoubleList) {
|
||||
if (currentNode == nullptr) {
|
||||
return;
|
||||
}
|
||||
if ((strcmp(((PreAppList *)currentNode)->filePath, ".") == 0) ||
|
||||
(strcmp(((PreAppList *)currentNode)->filePath, "..") == 0)) {
|
||||
continue;
|
||||
@@ -492,6 +495,9 @@ void GtManagerService::ScanThirdApp(const char *appDir, const List<ToBeInstalled
|
||||
return;
|
||||
}
|
||||
char *bundleName = reinterpret_cast<char *>(AdapterMalloc(MAX_BUNDLE_NAME_LEN + 1));
|
||||
if (bundleName == nullptr) {
|
||||
return;
|
||||
}
|
||||
int32_t entLen = 0;
|
||||
while ((ent = readdir(dir)) != nullptr) {
|
||||
++entLen;
|
||||
|
||||
@@ -34,7 +34,7 @@ const uint8_t SHIFT_NUM = 8;
|
||||
uint32_t GtExtractorUtil::ReadInt(int32_t fp)
|
||||
{
|
||||
unsigned char buf[INT_LENGTH] = {0};
|
||||
if (read(fp, buf, INT_LENGTH) != INT_LENGTH) {
|
||||
if (read(fp, buf, INT_LENGTH) != INT_LENGTH) {
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user