mirror of
https://github.com/openharmony/bundlemanager_bundle_framework_lite.git
synced 2026-07-19 12:13:04 -04:00
IssueNo:#I4G633
Description:bms adaptation Sig:appexecfwk Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: wangdengjia <wangdengjia@huawei.com> Change-Id: Iba45a569acdd956a015155941e19294d9cd09e71 Signed-off-by: wangdengjia <wangdengjia@huawei.com>
This commit is contained in:
@@ -26,28 +26,94 @@ lite_component("appexecfwk_kits_lite") {
|
||||
}
|
||||
|
||||
lite_library("bundle") {
|
||||
target_type = "shared_library"
|
||||
sources = [
|
||||
"src/ability_info.cpp",
|
||||
"src/ability_info_utils.cpp",
|
||||
"src/bundle_callback.cpp",
|
||||
"src/bundle_callback_utils.cpp",
|
||||
"src/bundle_info.cpp",
|
||||
"src/bundle_info_utils.cpp",
|
||||
"src/bundle_manager.cpp",
|
||||
"src/bundle_self_callback.cpp",
|
||||
"src/convert_utils.cpp",
|
||||
"src/element_name.cpp",
|
||||
"src/module_info.cpp",
|
||||
"src/module_info_utils.cpp",
|
||||
"src/token_generate.cpp",
|
||||
]
|
||||
if (ohos_kernel_type == "liteos_m") {
|
||||
target_type = "static_library"
|
||||
|
||||
deps = [
|
||||
"${aafwk_lite_path}/frameworks/want_lite:want",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//base/security/permission/services/permission_lite/pms_client:pms_client",
|
||||
]
|
||||
sources = [
|
||||
"src/ability_info.cpp",
|
||||
"src/ability_info_utils.cpp",
|
||||
"src/bundle_info.cpp",
|
||||
"src/bundle_info_utils.cpp",
|
||||
"src/element_name.cpp",
|
||||
"src/module_info.cpp",
|
||||
"src/module_info_utils.cpp",
|
||||
"src/slite/bundle_manager.cpp",
|
||||
"src/slite/bundle_manager_inner.cpp",
|
||||
"src/slite/bundlems_slite_client.cpp",
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
"${aafwk_lite_path}/frameworks/want_lite:want",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
"${appexecfwk_lite_path}/services/bundlemgr_lite/include",
|
||||
"${appexecfwk_lite_path}/interfaces/innerkits/bundlemgr_lite/slite",
|
||||
"${appexecfwk_lite_path}/interfaces/innerkits/bundlemgr_lite",
|
||||
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite/slite",
|
||||
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite",
|
||||
"${appexecfwk_lite_path}/utils/bundle_lite",
|
||||
"${appexecfwk_lite_path}/frameworks/bundle_lite/include",
|
||||
"//base/security/permission/interfaces/kits/permission_lite",
|
||||
"//base/security/permission/services/permission_lite/pms/include",
|
||||
"${aafwk_lite_path}/frameworks/want_lite/include",
|
||||
"${aafwk_lite_path}/interfaces/kits/want_lite",
|
||||
"${aafwk_lite_path}/interfaces/kits/ability_lite/slite",
|
||||
"${aafwk_lite_path}/interfaces/innerkits/abilitymgr_lite",
|
||||
"//foundation/communication/ipc_lite/interfaces/kits",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"//utils/native/lite/include",
|
||||
"//utils/native/lite/memory/include",
|
||||
"//third_party/cJSON",
|
||||
]
|
||||
} else {
|
||||
target_type = "shared_library"
|
||||
|
||||
sources = [
|
||||
"src/ability_info.cpp",
|
||||
"src/ability_info_utils.cpp",
|
||||
"src/bundle_callback.cpp",
|
||||
"src/bundle_callback_utils.cpp",
|
||||
"src/bundle_info.cpp",
|
||||
"src/bundle_info_utils.cpp",
|
||||
"src/bundle_manager.cpp",
|
||||
"src/bundle_self_callback.cpp",
|
||||
"src/convert_utils.cpp",
|
||||
"src/element_name.cpp",
|
||||
"src/module_info.cpp",
|
||||
"src/module_info_utils.cpp",
|
||||
"src/token_generate.cpp",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"${aafwk_lite_path}/frameworks/want_lite:want",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//base/security/permission/services/permission_lite/pms_client:pms_client",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
"include",
|
||||
"//base/security/permission/interfaces/kits/permission_lite",
|
||||
"//base/security/permission/services/permission_lite/pms/include",
|
||||
"${aafwk_lite_path}/frameworks/want_lite/include",
|
||||
"${aafwk_lite_path}/interfaces/kits/want_lite",
|
||||
"${aafwk_lite_path}/interfaces/innerkits/abilitymgr_lite",
|
||||
"${appexecfwk_lite_path}/interfaces/innerkits/bundlemgr_lite",
|
||||
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite",
|
||||
"${appexecfwk_lite_path}/utils/bundle_lite",
|
||||
"//foundation/communication/ipc_lite/interfaces/kits",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"//utils/native/lite/include",
|
||||
"//third_party/cJSON",
|
||||
]
|
||||
|
||||
defines = [ "OHOS_APPEXECFWK_BMS_BUNDLEMANAGER" ]
|
||||
}
|
||||
|
||||
cflags = [
|
||||
"-fPIC",
|
||||
@@ -55,26 +121,6 @@ lite_library("bundle") {
|
||||
"-Wno-format",
|
||||
]
|
||||
cflags_cc = cflags
|
||||
|
||||
include_dirs = [
|
||||
"include",
|
||||
"//base/security/permission/interfaces/kits/permission_lite",
|
||||
"//base/security/permission/services/permission_lite/pms/include",
|
||||
"${aafwk_lite_path}/frameworks/want_lite/include",
|
||||
"${aafwk_lite_path}/interfaces/kits/want_lite",
|
||||
"${aafwk_lite_path}/interfaces/innerkits/abilitymgr_lite",
|
||||
"${appexecfwk_lite_path}/interfaces/innerkits/bundlemgr_lite",
|
||||
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite",
|
||||
"${appexecfwk_lite_path}/utils/bundle_lite",
|
||||
"//foundation/communication/ipc_lite/interfaces/kits",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"//utils/native/lite/include",
|
||||
"//third_party/cJSON",
|
||||
]
|
||||
|
||||
defines = [ "OHOS_APPEXECFWK_BMS_BUNDLEMANAGER" ]
|
||||
}
|
||||
|
||||
ndk_lib("bundle_notes") {
|
||||
|
||||
@@ -83,8 +83,8 @@ bool BundleMsClient::Install(const char *hapPath, const InstallParam *installPar
|
||||
g_bmsbuff->bundleInstallerCallback = installerCallback;
|
||||
Request request = {
|
||||
.msgId = BMS_INSTALL_MSG,
|
||||
.data = nullptr,
|
||||
.len = 0,
|
||||
.data = nullptr,
|
||||
.msgValue = 0,
|
||||
};
|
||||
|
||||
@@ -118,8 +118,8 @@ bool BundleMsClient::Uninstall (const char *bundleName, const InstallParam *inst
|
||||
g_bmsbuff->bundleInstallerCallback = installerCallback;
|
||||
Request request = {
|
||||
.msgId = BMS_UNINSTALL_MSG,
|
||||
.data = nullptr,
|
||||
.len = 0,
|
||||
.data = nullptr,
|
||||
.msgValue = 0,
|
||||
};
|
||||
int32_t ret = SAMGR_SendRequest(service->GetIdentity(), &request, nullptr);
|
||||
@@ -141,8 +141,8 @@ bool BundleMsClient::RegisterInstallerCallback (InstallerCallback installerCallb
|
||||
g_bmsbuff->bundleInstallerCallback = installerCallback;
|
||||
Request request = {
|
||||
.msgId = BMS_REGISTER_CALLBACK_MSG,
|
||||
.data = nullptr,
|
||||
.len = 0,
|
||||
.data = nullptr,
|
||||
.msgValue = 0,
|
||||
};
|
||||
int32_t ret = SAMGR_SendRequest(service->GetIdentity(), &request, nullptr);
|
||||
|
||||
@@ -216,6 +216,7 @@ uint8_t GetBundleInfosByMetaData(const char *metaDataKey, BundleInfo **bundleInf
|
||||
*/
|
||||
uint8_t GetBundleNameForUid(int32_t uid, char **bundleName);
|
||||
|
||||
#ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER
|
||||
/**
|
||||
* @brief Check if the specify syscap name is supported by the system.
|
||||
*
|
||||
@@ -246,7 +247,7 @@ SystemCapability *GetSystemAvailableCapabilities();
|
||||
* @version 4
|
||||
*/
|
||||
void FreeSystemAvailableCapabilitiesInfo(SystemCapability *sysCap);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* @brief Get bundle size
|
||||
*
|
||||
|
||||
@@ -17,68 +17,132 @@ config("bundle_config") {
|
||||
cflags_cc = [ "-std=c++14" ]
|
||||
}
|
||||
|
||||
shared_library("bundlems") {
|
||||
configs -= [ "//build/lite/config:language_cpp" ]
|
||||
configs += [ ":bundle_config" ]
|
||||
if (ohos_kernel_type == "liteos_m") {
|
||||
static_library("bundlems") {
|
||||
sources = [
|
||||
"src/bundle_map.cpp",
|
||||
"src/bundle_mgr_service.cpp",
|
||||
"src/bundle_mgr_slite_feature.cpp",
|
||||
"src/bundle_util.cpp",
|
||||
"src/gt_bundle_extractor.cpp",
|
||||
"src/gt_bundle_installer.cpp",
|
||||
"src/gt_bundle_manager_service.cpp",
|
||||
"src/gt_bundle_parser.cpp",
|
||||
"src/gt_extractor_util.cpp",
|
||||
]
|
||||
deps = [
|
||||
"${appexecfwk_lite_path}/frameworks/bundle_lite:bundle",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static",
|
||||
"//foundation/ace/ace_engine_lite/frameworks:ace_lite",
|
||||
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
|
||||
]
|
||||
|
||||
cflags = [
|
||||
"-Wall",
|
||||
"-Wno-format",
|
||||
"-Wno-format-extra-args",
|
||||
]
|
||||
cflags_cc = cflags
|
||||
include_dirs = [
|
||||
"${appexecfwk_lite_path}/services/bundlemgr_lite/include",
|
||||
"${appexecfwk_lite_path}/interfaces/innerkits/bundlemgr_lite/slite",
|
||||
"${appexecfwk_lite_path}/interfaces/innerkits/bundlemgr_lite",
|
||||
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite/slite",
|
||||
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite",
|
||||
"${appexecfwk_lite_path}/utils/bundle_lite",
|
||||
"${appexecfwk_lite_path}/frameworks/bundle_lite/include",
|
||||
"//base/startup/syspara_lite/interfaces/kits/",
|
||||
"//third_party/jerryscript/jerry-core/api",
|
||||
"//third_party/jerryscript/jerry-core/include",
|
||||
"${aafwk_lite_path}/interfaces/kits/ability_lite/slite",
|
||||
"${aafwk_lite_path}/services/abilitymgr_lite/include",
|
||||
"${aafwk_lite_path}/interfaces/innerkits/abilitymgr_lite",
|
||||
"${aafwk_lite_path}/interfaces/kits/ability_lite",
|
||||
"${aafwk_lite_path}/interfaces/kits/want_lite",
|
||||
"${aafwk_lite_path}/frameworks/want_lite/include",
|
||||
"//base/global/resmgr_lite/interfaces/innerkits/include",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
|
||||
"//third_party/cJSON",
|
||||
"//third_party/zlib",
|
||||
"//third_party/zlib/contrib/minizip",
|
||||
"//base/security/permission/interfaces/kits/permission_lite",
|
||||
"//base/security/permission/services/permission_lite/pms/include",
|
||||
"//base/security/appverify/interfaces/innerkits/appverify_lite/include",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"//utils/native/lite/include",
|
||||
"//utils/native/lite/memory/include",
|
||||
"include",
|
||||
]
|
||||
}
|
||||
lite_component("appexecfwk_services_lite") {
|
||||
features = [ ":bundlems" ]
|
||||
}
|
||||
} else {
|
||||
shared_library("bundlems") {
|
||||
configs -= [ "//build/lite/config:language_cpp" ]
|
||||
configs += [ ":bundle_config" ]
|
||||
|
||||
sources = [
|
||||
"src/bundle_daemon_client.cpp",
|
||||
"src/bundle_extractor.cpp",
|
||||
"src/bundle_info_creator.cpp",
|
||||
"src/bundle_inner_feature.cpp",
|
||||
"src/bundle_installer.cpp",
|
||||
"src/bundle_manager_service.cpp",
|
||||
"src/bundle_map.cpp",
|
||||
"src/bundle_ms_feature.cpp",
|
||||
"src/bundle_ms_host.cpp",
|
||||
"src/bundle_parser.cpp",
|
||||
"src/bundle_res_transform.cpp",
|
||||
"src/bundle_util.cpp",
|
||||
"src/extractor_util.cpp",
|
||||
"src/hap_sign_verify.cpp",
|
||||
"src/zip_file.cpp",
|
||||
]
|
||||
include_dirs = [
|
||||
"//base/global/resmgr_lite/interfaces/innerkits/include",
|
||||
"${aafwk_lite_path}/services/abilitymgr_lite/include",
|
||||
"${aafwk_lite_path}/interfaces/innerkits/abilitymgr_lite",
|
||||
"${aafwk_lite_path}/interfaces/kits/ability_lite",
|
||||
"${aafwk_lite_path}/interfaces/kits/want_lite",
|
||||
"${aafwk_lite_path}/frameworks/want_lite/include",
|
||||
"${appexecfwk_lite_path}/interfaces/innerkits/bundlemgr_lite",
|
||||
"${appexecfwk_lite_path}/frameworks/bundle_lite/include",
|
||||
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite",
|
||||
"${appexecfwk_lite_path}/utils/bundle_lite",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
|
||||
"//third_party/cJSON",
|
||||
"//third_party/zlib",
|
||||
"//third_party/zlib/contrib/minizip",
|
||||
"//base/security/permission/interfaces/kits/permission_lite",
|
||||
"//base/security/permission/services/permission_lite/pms/include",
|
||||
"//base/security/appverify/interfaces/innerkits/appverify_lite/include",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"//utils/native/lite/include",
|
||||
"//utils/native/lite/memory",
|
||||
"include",
|
||||
]
|
||||
cflags = [
|
||||
"-Wall",
|
||||
"-Wno-format",
|
||||
"-Wno-format-extra-args",
|
||||
]
|
||||
cflags_cc = cflags
|
||||
|
||||
public_deps = [
|
||||
"${appexecfwk_lite_path}/frameworks/bundle_lite:bundle",
|
||||
"//base/global/resmgr_lite/frameworks/resmgr_lite:global_resmgr",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//base/security/appverify/interfaces/innerkits/appverify_lite:verify",
|
||||
"//build/lite/config/component/cJSON:cjson_shared",
|
||||
"//build/lite/config/component/zlib:zlib_shared",
|
||||
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
|
||||
]
|
||||
sources = [
|
||||
"src/bundle_daemon_client.cpp",
|
||||
"src/bundle_extractor.cpp",
|
||||
"src/bundle_info_creator.cpp",
|
||||
"src/bundle_inner_feature.cpp",
|
||||
"src/bundle_installer.cpp",
|
||||
"src/bundle_manager_service.cpp",
|
||||
"src/bundle_map.cpp",
|
||||
"src/bundle_ms_feature.cpp",
|
||||
"src/bundle_ms_host.cpp",
|
||||
"src/bundle_parser.cpp",
|
||||
"src/bundle_res_transform.cpp",
|
||||
"src/bundle_util.cpp",
|
||||
"src/extractor_util.cpp",
|
||||
"src/hap_sign_verify.cpp",
|
||||
"src/zip_file.cpp",
|
||||
]
|
||||
include_dirs = [
|
||||
"//base/global/resmgr_lite/interfaces/innerkits/include",
|
||||
"${aafwk_lite_path}/services/abilitymgr_lite/include",
|
||||
"${aafwk_lite_path}/interfaces/innerkits/abilitymgr_lite",
|
||||
"${aafwk_lite_path}/interfaces/kits/ability_lite",
|
||||
"${aafwk_lite_path}/interfaces/kits/want_lite",
|
||||
"${aafwk_lite_path}/frameworks/want_lite/include",
|
||||
"${appexecfwk_lite_path}/interfaces/innerkits/bundlemgr_lite",
|
||||
"${appexecfwk_lite_path}/frameworks/bundle_lite/include",
|
||||
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite",
|
||||
"${appexecfwk_lite_path}/utils/bundle_lite",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
|
||||
"//third_party/cJSON",
|
||||
"//third_party/zlib",
|
||||
"//third_party/zlib/contrib/minizip",
|
||||
"//base/security/permission/interfaces/kits/permission_lite",
|
||||
"//base/security/permission/services/permission_lite/pms/include",
|
||||
"//base/security/appverify/interfaces/innerkits/appverify_lite/include",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"//utils/native/lite/include",
|
||||
"//utils/native/lite/memory",
|
||||
"include",
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
"${appexecfwk_lite_path}/frameworks/bundle_lite:bundle",
|
||||
"//base/global/resmgr_lite/frameworks/resmgr_lite:global_resmgr",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//base/security/appverify/interfaces/innerkits/appverify_lite:verify",
|
||||
"//build/lite/config/component/cJSON:cjson_shared",
|
||||
"//build/lite/config/component/zlib:zlib_shared",
|
||||
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
|
||||
]
|
||||
}
|
||||
lite_component("appexecfwk_services_lite") {
|
||||
features = [
|
||||
":bundlems",
|
||||
"tools:bm",
|
||||
"bundle_daemon:bundle_daemon",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
generate_notice_file("appexecfwk_services_lite_notice_file") {
|
||||
@@ -89,11 +153,3 @@ generate_notice_file("appexecfwk_services_lite_notice_file") {
|
||||
"//third_party/bounds_checking_function",
|
||||
]
|
||||
}
|
||||
|
||||
lite_component("appexecfwk_services_lite") {
|
||||
features = [
|
||||
":bundlems",
|
||||
"tools:bm",
|
||||
"bundle_daemon:bundle_daemon",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -195,7 +195,11 @@ const char JSON_SUB_KEY_GID[] = "gid";
|
||||
#endif
|
||||
|
||||
struct ProfileVersion {
|
||||
#ifdef __LITEOS_M__
|
||||
int32_t versionCode;
|
||||
#else
|
||||
uint32_t versionCode;
|
||||
#endif
|
||||
char *versionName;
|
||||
};
|
||||
|
||||
|
||||
@@ -26,6 +26,11 @@
|
||||
#endif
|
||||
#include "cJSON.h"
|
||||
|
||||
#ifdef __LITEOS_M__
|
||||
#define S_IREAD S_IRUSR
|
||||
#define S_IWRITE S_IWUSR
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
class BundleUtil {
|
||||
public:
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OHOS {
|
||||
#undef LOG_DOMAIN
|
||||
#define LOG_DOMAIN 0xD001300
|
||||
|
||||
#ifdef APP_PLATFORM_WATCHGT
|
||||
#ifdef __LITEOS_M__
|
||||
#ifndef HILOG_DEBUG
|
||||
#define HILOG_DEBUG(mod, format, ...)
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "generate-bytecode.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -97,8 +97,10 @@ private:
|
||||
bool isSystemApp, bool isUpdated, const char *appId);
|
||||
void RemoveSystemAppPathList(List<ToBeInstalledApp *> *systemPathList);
|
||||
void ClearSystemBundleInstallMsg();
|
||||
#ifdef BC_TRANS_ENABLE
|
||||
void TransformJsToBcWhenRestart(const char *codePath, const char *bundleName);
|
||||
void TransformJsToBc(const char *codePath, const char *bundleJsonPath, cJSON *installRecordObj);
|
||||
#endif
|
||||
bool IsSystemBundleInstalledPath(const char *appPath, const List<ToBeInstalledApp *> *systemPathList);
|
||||
AppInfoList *APP_InitAllAppInfo(void);
|
||||
void APP_QueryAppInfo(const char *appDir, AppInfoList *list);
|
||||
@@ -121,6 +123,10 @@ void EnableServiceWdg(void);
|
||||
void DisableServiceWdg(void);
|
||||
void SetCurrentBundle(const char *name);
|
||||
const char *GetCurrentBundle();
|
||||
|
||||
#ifdef __LITEOS_M__
|
||||
void InstallCallbackFunc(const uint8_t resultCode, const void *resultMessage);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // OHOS_GT_BUNDLE_MANAGER_SERVICE_H
|
||||
@@ -38,8 +38,12 @@ static void Init()
|
||||
{
|
||||
SamgrLite *sm = SAMGR_GetInstance();
|
||||
CHECK_NULLPTR_RETURN(sm, "BundleManagerService", "get samgr error");
|
||||
#ifdef __LITEOS_M__
|
||||
sm->RegisterService(BundleMgrService::GetInstance());
|
||||
#else
|
||||
BOOL result = sm->RegisterService(BundleMgrService::GetInstance());
|
||||
PRINTI("BundleManagerService", "bms starts %{public}s", result ? "successfully" : "unsuccessfully");
|
||||
#endif
|
||||
}
|
||||
SYSEX_SERVICE_INIT(Init);
|
||||
|
||||
@@ -58,8 +62,8 @@ BOOL BundleMgrService::ServiceInitialize(Service *service, Identity identity)
|
||||
bundleManagerService->identity_ = identity;
|
||||
Request request = {
|
||||
.msgId = BMS_SCAN_PACKAGE_MSG,
|
||||
.data = nullptr,
|
||||
.len = 0,
|
||||
.data = nullptr,
|
||||
.msgValue = 0,
|
||||
};
|
||||
(void) SAMGR_SendRequest(bundleManagerService->GetIdentity(), &request, nullptr);
|
||||
|
||||
@@ -43,7 +43,11 @@ namespace OHOS {
|
||||
const char DIGITSTR[] = "0123456789";
|
||||
const uint8_t MAX_CHARACTER_VALUE = 26;
|
||||
const uint8_t NUM_OF_TYPE = 3;
|
||||
#ifdef __LITEOS_M__
|
||||
const int32_t MAX_JSON_SIZE = 1024 * 64;
|
||||
#else
|
||||
const uint32_t MAX_JSON_SIZE = 1024 * 64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* path should not include ".." or "./" or ".\0"
|
||||
@@ -573,7 +577,7 @@ void BundleUtil::CreateRandStr(char *str, uint32_t len)
|
||||
if (str == nullptr) {
|
||||
return;
|
||||
}
|
||||
#ifndef APP_PLATFORM_WATCHGT
|
||||
#ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER
|
||||
srand(time(NULL));
|
||||
#else
|
||||
srand(LOS_TickCountGet());
|
||||
|
||||
@@ -185,12 +185,14 @@ uint8_t GtBundleExtractor::ExtractInstallMsg(const char *path, char **bundleName
|
||||
if (!BundleUtil::CheckRealPath(path)) {
|
||||
return ERR_APPEXECFWK_INSTALL_FAILED_PARAM_ERROR;
|
||||
}
|
||||
|
||||
#ifndef __LITEOS_M__
|
||||
int32_t totalFileSize = APPVERI_GetUnsignedFileLength(path);
|
||||
if (totalFileSize == V_ERR) {
|
||||
return ERR_APPEXECFWK_INSTALL_FAILED_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
#else
|
||||
int32_t totalFileSize = 0;
|
||||
#endif
|
||||
char *emptyJsPathComp[] = {const_cast<char *>(TMP_RESOURCE_DIR), const_cast<char *>(ASSET_JS_PATH)};
|
||||
char *emptyJsPath = BundleUtil::Strscat(emptyJsPathComp, sizeof(emptyJsPathComp) / sizeof(char *));
|
||||
if (emptyJsPath == nullptr) {
|
||||
|
||||
@@ -105,6 +105,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__
|
||||
VerifyResult verifyResult;
|
||||
// verify signature
|
||||
(void) APPVERI_SetDebugMode(true);
|
||||
@@ -145,6 +146,7 @@ uint8_t GtBundleInstaller::VerifySignature(const char *path, SignatureInfo &sign
|
||||
}
|
||||
}
|
||||
APPVERI_FreeVerifyRst(&verifyResult);
|
||||
#endif
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@@ -464,6 +466,7 @@ uint8_t GtBundleInstaller::HandleFileAndBackUpRecord(const InstallRecord &record
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
#ifdef BC_TRANS_ENABLE
|
||||
uint8_t GtBundleInstaller::TransformJsToBc(const char *codePath, InstallRecord &record)
|
||||
{
|
||||
if (codePath == nullptr) {
|
||||
@@ -482,11 +485,10 @@ uint8_t GtBundleInstaller::TransformJsToBc(const char *codePath, InstallRecord &
|
||||
return ERR_APPEXECFWK_INSTALL_FAILED_TRANSFORM_BC_FILE_ERROR;
|
||||
}
|
||||
AdapterFree(jsPath);
|
||||
#ifdef BC_TRANS_ENABLE
|
||||
record.transformResult = 0;
|
||||
#endif
|
||||
return ERR_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t GtBundleInstaller::UpdateBundleInfo(uint8_t bundleStyle, uint32_t labelId, uint32_t iconId,
|
||||
BundleInfo *bundleInfo, bool isUpdate)
|
||||
@@ -576,11 +578,11 @@ 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__
|
||||
if (DeletePermissions(const_cast<char *>(bundleName)) < 0) {
|
||||
return ERR_APPEXECFWK_UNINSTALL_FAILED_DELETE_PERMISSIONS_ERROR;
|
||||
}
|
||||
|
||||
#endif
|
||||
bool res = CheckIsThirdSystemBundle(bundleName);
|
||||
if (!(BundleUtil::RemoveDir(bundleInfo->codePath) && BundleUtil::RemoveDir(bundleInfo->dataPath))) {
|
||||
GtManagerService::GetInstance().RemoveBundleInfo(bundleName);
|
||||
@@ -733,10 +735,12 @@ uint8_t GtBundleInstaller::StorePermissions(const char *bundleName, PermissionTr
|
||||
bool isUpdate)
|
||||
{
|
||||
if (permNum == 0) {
|
||||
#ifndef __LITEOS_M__
|
||||
if (isUpdate) {
|
||||
int32_t ret = DeletePermissions(bundleName);
|
||||
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] delete permissions, result is %d", ret);
|
||||
}
|
||||
#endif
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@@ -747,11 +751,12 @@ uint8_t GtBundleInstaller::StorePermissions(const char *bundleName, PermissionTr
|
||||
if (!BundleUtil::IsDir(PERMISSIONS_PATH)) {
|
||||
BundleUtil::MkDirs(PERMISSIONS_PATH);
|
||||
}
|
||||
|
||||
#ifndef __LITEOS_M__
|
||||
if (SaveOrUpdatePermissions(const_cast<char *>(bundleName), permissions, permNum,
|
||||
static_cast<IsUpdate>(isUpdate)) != 0) {
|
||||
return ERR_APPEXECFWK_INSTALL_FAILED_STORE_PERMISSIONS_ERROR;
|
||||
}
|
||||
#endif
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,9 +109,13 @@ bool GtManagerService::Install(const char *hapPath, const InstallParam *installP
|
||||
|
||||
SetCurrentBundle(bundleInstallMsg_->bundleName);
|
||||
(void) ReportInstallCallback(OPERATION_DOING, 0, BMS_INSTALLATION_START, installerCallback);
|
||||
#ifndef __LITEOS_M__
|
||||
DisableServiceWdg();
|
||||
ret = installer_->Install(path, installerCallback);
|
||||
EnableServiceWdg();
|
||||
#else
|
||||
ret = installer_->Install(path, installerCallback);
|
||||
#endif
|
||||
if (ret == 0) {
|
||||
(void) ReportInstallCallback(ret, BUNDLE_INSTALL_OK, BMS_INSTALLATION_COMPLETED, installerCallback);
|
||||
} else {
|
||||
@@ -342,12 +346,14 @@ void GtManagerService::ClearSystemBundleInstallMsg()
|
||||
|
||||
void GtManagerService::ScanPackages()
|
||||
{
|
||||
#ifdef BC_TRANS_ENABLE
|
||||
JerryBmsPsRamMemInit();
|
||||
bms_task_context_init();
|
||||
jsEngineVer_ = get_jerry_version_no();
|
||||
if (jsEngineVer_ == nullptr) {
|
||||
HILOG_WARN(HILOG_MODULE_AAFWK, "[BMS] get jsEngine version fail when restart!");
|
||||
}
|
||||
#endif
|
||||
|
||||
// get third system bundle uninstall record
|
||||
cJSON *uninstallRecord = BundleUtil::GetJsonStream(UNINSTALL_THIRD_SYSTEM_BUNDLE_JSON);
|
||||
@@ -363,6 +369,10 @@ void GtManagerService::ScanPackages()
|
||||
|
||||
// scan third apps
|
||||
ScanThirdApp(INSTALL_PATH, &systemPathList_);
|
||||
|
||||
#ifdef __LITEOS_M__
|
||||
RegisterInstallerCallback(InstallCallbackFunc);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GtManagerService::RemoveSystemAppPathList(List<ToBeInstalledApp *> *systemPathList)
|
||||
@@ -707,6 +717,7 @@ void GtManagerService::UpdateBundleInfoList()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BC_TRANS_ENABLE
|
||||
void GtManagerService::TransformJsToBcWhenRestart(const char *codePath, const char *bundleName)
|
||||
{
|
||||
if (codePath == nullptr) {
|
||||
@@ -812,6 +823,7 @@ void GtManagerService::TransformJsToBc(const char *codePath, const char *bundleJ
|
||||
}
|
||||
(void)BundleUtil::StoreJsonContentToFile(bundleJsonPath, installRecordObj);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool GtManagerService::CheckThirdSystemBundleHasUninstalled(const char *bundleName, const cJSON *object)
|
||||
{
|
||||
|
||||
@@ -312,7 +312,7 @@ bool GtBundleParser::CheckDeviceTypeIsValid(const cJSON *deviceTypeObject)
|
||||
return false;
|
||||
}
|
||||
|
||||
const char const *deviceType = GetDeviceType();
|
||||
const char *deviceType = GetDeviceType();
|
||||
if (deviceType == nullptr) {
|
||||
return false;
|
||||
}
|
||||
@@ -419,7 +419,11 @@ BundleInfo *GtBundleParser::CreateBundleInfo(const char *path, const BundleProfi
|
||||
return nullptr;
|
||||
}
|
||||
// set abilityInfo
|
||||
#ifdef __LITEOS_M__
|
||||
AbilityInfo abilityInfo = {.srcPath = jsPath, .bundleName = bundleInfo->bundleName};
|
||||
#else
|
||||
AbilityInfo abilityInfo = {.bundleName = bundleInfo->bundleName, .srcPath = jsPath};
|
||||
#endif
|
||||
if (!BundleInfoUtils::SetBundleInfoAbilityInfo(bundleInfo, abilityInfo)) {
|
||||
AdapterFree(abilityInfo.srcPath);
|
||||
BundleInfoUtils::FreeBundleInfo(bundleInfo);
|
||||
@@ -602,7 +606,11 @@ uint8_t GtBundleParser::SaveBundleInfo(const BundleProfile &bundleProfile, const
|
||||
*bundleInfo = nullptr;
|
||||
return ERR_APPEXECFWK_INSTALL_FAILED_INTERNAL_ERROR;
|
||||
}
|
||||
#ifdef __LITEOS_M__
|
||||
AbilityInfo abilityInfo = {.srcPath = jsPath, .bundleName = (*bundleInfo)->bundleName};
|
||||
#else
|
||||
AbilityInfo abilityInfo = {.bundleName = (*bundleInfo)->bundleName, .srcPath = jsPath};
|
||||
#endif
|
||||
// set abilityInfo
|
||||
if (!BundleInfoUtils::SetBundleInfoAbilityInfo(*bundleInfo, abilityInfo)) {
|
||||
AdapterFree(jsPath);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define EXTERNC
|
||||
#endif
|
||||
|
||||
#ifndef APP_PLATFORM_WATCHGT
|
||||
#ifndef __LITEOS_M__
|
||||
// memory operator define
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#define MutexAcquire(a, b) pthread_mutex_lock(a)
|
||||
#define MutexRelease(a) pthread_mutex_unlock(a)
|
||||
|
||||
#else // APP_PLATFORM_WATCHGT
|
||||
#else // __LITEOS_M__
|
||||
#include "stdint.h"
|
||||
#include "ohos_mem_pool.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user