mirror of
https://gitee.com/openharmony/bundlemanager_bundle_framework
synced 2024-11-23 07:09:53 +00:00
Merge remote-tracking branch 'upstream/master' into second
Signed-off-by: sunjiakun <sunjiakun5@huawei.com>
This commit is contained in:
commit
4285446842
@ -71,6 +71,7 @@ declare_args() {
|
||||
bms_device_info_manager_part_enabled = true
|
||||
app_domain_verify_enabled = true
|
||||
device_usage_statistics_enabled = true
|
||||
pend_sign_screenlock_mgr_enable = false
|
||||
|
||||
if (defined(global_parts_info) &&
|
||||
!defined(global_parts_info.resourceschedule_device_usage_statistics)) {
|
||||
@ -187,6 +188,11 @@ declare_args() {
|
||||
!defined(global_parts_info.bundlemanager_app_domain_verify)) {
|
||||
app_domain_verify_enabled = false
|
||||
}
|
||||
|
||||
if (defined(global_parts_info) &&
|
||||
defined(global_parts_info.theme_screenlock_mgr)) {
|
||||
pend_sign_screenlock_mgr_enable = true
|
||||
}
|
||||
}
|
||||
|
||||
print("bundle_framework_power_mgr_enable = " +
|
||||
|
@ -67,6 +67,7 @@
|
||||
"safwk",
|
||||
"resource_management",
|
||||
"samgr",
|
||||
"screenlock_mgr",
|
||||
"selinux_adapter",
|
||||
"syscap_codec",
|
||||
"storage_service",
|
||||
|
@ -234,6 +234,7 @@ enum {
|
||||
ERR_APPEXECFWK_INSTALLD_GENERATE_KEY_FAILED = 8519930,
|
||||
ERR_APPEXECFWK_INSTALLD_DELETE_KEY_FAILED = 8519931,
|
||||
ERR_APPEXECFWK_INSTALLD_SIGN_AOT_FAILED = 8519932,
|
||||
ERR_APPEXECFWK_INSTALLD_SIGN_AOT_DISABLE = 8519933,
|
||||
|
||||
ERR_APPEXECFWK_RECOVER_GET_BUNDLEPATH_ERROR = APPEXECFWK_BUNDLEMGR_ERR_OFFSET + 0x0201, // 8520193
|
||||
ERR_APPEXECFWK_RECOVER_INVALID_BUNDLE_NAME = 8520194,
|
||||
|
@ -4931,7 +4931,7 @@ ErrCode BundleMgrProxy::QueryCloneAbilityInfo(const ElementName &element,
|
||||
}
|
||||
if (!data.WriteParcelable(&element)) {
|
||||
LOG_E(BMS_TAG_QUERY_ABILITY, "write element fail");
|
||||
return false;
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
if (!data.WriteInt32(flags)) {
|
||||
LOG_E(BMS_TAG_QUERY_ABILITY, "write flags failed");
|
||||
@ -4957,7 +4957,7 @@ ErrCode BundleMgrProxy::GetCloneBundleInfo(const std::string &bundleName, int32_
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
APP_LOGE("fail to GetCloneBundleInfo due to write InterfaceToken fail");
|
||||
return false;
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
if (!data.WriteString(bundleName)) {
|
||||
APP_LOGE("failed to GetCloneBundleInfo due to write bundleName fail");
|
||||
|
@ -101,7 +101,6 @@ CArrMetadata ConvertArrMetadata(std::vector<AppExecFwk::Metadata> cdata)
|
||||
}
|
||||
} else {
|
||||
LOGE("ConvertArrMetadata malloc failed");
|
||||
data.head = nullptr;
|
||||
return data;
|
||||
}
|
||||
return data;
|
||||
@ -122,7 +121,6 @@ CArrMoMeta ConvertArrMoMeta(std::map<std::string, std::vector<AppExecFwk::Metada
|
||||
}
|
||||
} else {
|
||||
LOGE("ConvertArrMoMeta malloc failed");
|
||||
arrMdata.head = nullptr;
|
||||
return arrMdata;
|
||||
}
|
||||
arrMdata.head = retValue;
|
||||
@ -290,7 +288,6 @@ CArrRetAbilityInfo ConvertArrAbilityInfo(std::vector<AppExecFwk::AbilityInfo> ab
|
||||
abInfo.head = retValue;
|
||||
} else {
|
||||
LOGE("ConvertArrAbilityInfo malloc failed");
|
||||
abInfo.head = nullptr;
|
||||
return abInfo;
|
||||
}
|
||||
}
|
||||
@ -371,7 +368,7 @@ RetHapModuleInfo ConvertHapModuleInfo(AppExecFwk::HapModuleInfo hapModuleInfo)
|
||||
if (!hapModuleInfo.fileContextMenu.empty()) {
|
||||
hapInfo.fileContextMenuConfig = MallocCString(hapModuleInfo.fileContextMenu);
|
||||
} else {
|
||||
hapInfo.fileContextMenuConfig = nullptr;
|
||||
hapInfo.fileContextMenuConfig = MallocCString("");
|
||||
}
|
||||
return hapInfo;
|
||||
}
|
||||
|
@ -4549,6 +4549,7 @@ napi_value GetBundleInfoForSelfSync(napi_env env, napi_callback_info info)
|
||||
{
|
||||
APP_LOGD("GetBundleInfoForSelfSync called");
|
||||
NapiArg args(env, info);
|
||||
napi_add_env_cleanup_hook(env, HandleCleanEnv, env);
|
||||
if (!args.Init(ARGS_SIZE_ONE, ARGS_SIZE_ONE)) {
|
||||
APP_LOGE("param count invalid");
|
||||
BusinessError::ThrowTooFewParametersError(env, ERROR_PARAM_CHECK_ERROR);
|
||||
@ -5115,7 +5116,7 @@ static ErrCode InnerGetAppCloneBundleInfo(const std::string &bundleName, int32_t
|
||||
APP_LOGE("can not get iBundleMgr");
|
||||
return ERROR_BUNDLE_SERVICE_EXCEPTION;
|
||||
}
|
||||
ErrCode ret = iBundleMgr->GetCloneBundleInfo(bundleName, bundleFlags, appIndex, bundleInfo);
|
||||
ErrCode ret = iBundleMgr->GetCloneBundleInfo(bundleName, bundleFlags, appIndex, bundleInfo, userId);
|
||||
APP_LOGD("GetCloneBundleInfo result is %{public}d", ret);
|
||||
return CommonFunc::ConvertErrCode(ret);
|
||||
}
|
||||
@ -5150,7 +5151,8 @@ void GetAppCloneBundleInfoComplete(napi_env env, napi_status status, void *data)
|
||||
if (asyncCallbackInfo->err == NO_ERROR) {
|
||||
NAPI_CALL_RETURN_VOID(env, napi_get_null(env, &result[ARGS_POS_ZERO]));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_object(env, &result[ARGS_POS_ONE]));
|
||||
CommonFunc::ConvertBundleInfo(env, asyncCallbackInfo->bundleInfo, result[ARGS_POS_ONE], true);
|
||||
CommonFunc::ConvertBundleInfo(env, asyncCallbackInfo->bundleInfo, result[ARGS_POS_ONE],
|
||||
asyncCallbackInfo->bundleFlags);
|
||||
} else {
|
||||
result[ARGS_POS_ZERO] = BusinessError::CreateCommonError(env, asyncCallbackInfo->err,
|
||||
GET_APP_CLONE_BUNDLE_INFO, Constants::PERMISSION_GET_BUNDLE_INFO);
|
||||
@ -5209,27 +5211,29 @@ static ErrCode InnerGetAllAppCloneBundleInfo(const std::string &bundleName, int3
|
||||
}
|
||||
BundleInfo bundleInfoMain;
|
||||
ErrCode ret = iBundleMgr->GetCloneBundleInfo(bundleName, bundleFlags, 0, bundleInfoMain, userId);
|
||||
APP_LOGD("InnerGetAllAppCloneBundleInfo: GetMainBundleInfo ret=%{public}d", ret);
|
||||
if (ret != NO_ERROR) {
|
||||
APP_LOGD("GetMainBundleInfo appIndex = 0, ret=%{public}d", ret);
|
||||
if (ret == ERR_OK) {
|
||||
bundleInfos.emplace_back(bundleInfoMain);
|
||||
}
|
||||
if (ret != ERR_OK && ret != ERR_BUNDLE_MANAGER_APPLICATION_DISABLED) {
|
||||
return CommonFunc::ConvertErrCode(ret);
|
||||
}
|
||||
bundleInfos.emplace_back(bundleInfoMain);
|
||||
// handle clone apps
|
||||
std::vector<int32_t> appIndexes;
|
||||
ret = iBundleMgr->GetCloneAppIndexes(bundleName, appIndexes, userId);
|
||||
if (ret != NO_ERROR) {
|
||||
if (ret != ERR_OK) {
|
||||
return CommonFunc::ConvertErrCode(ret);
|
||||
}
|
||||
if (appIndexes.empty()) {
|
||||
return SUCCESS;
|
||||
}
|
||||
for (int32_t appIndex : appIndexes) {
|
||||
BundleInfo bundleInfo;
|
||||
ret = iBundleMgr->GetCloneBundleInfo(bundleName, bundleFlags, appIndex, bundleInfo, userId);
|
||||
if (ret == NO_ERROR) {
|
||||
if (ret == ERR_OK) {
|
||||
bundleInfos.emplace_back(bundleInfo);
|
||||
}
|
||||
}
|
||||
if (bundleInfos.empty()) {
|
||||
return ERROR_BUNDLE_IS_DISABLED;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@ -5251,7 +5255,7 @@ void GetAllAppCloneBundleInfoExec(napi_env env, void *data)
|
||||
}
|
||||
|
||||
static void CloneAppBundleInfos(
|
||||
napi_env env, napi_value result, const std::vector<BundleInfo> &bundleInfos)
|
||||
napi_env env, napi_value result, const std::vector<BundleInfo> &bundleInfos, int32_t flags)
|
||||
{
|
||||
if (bundleInfos.size() == 0) {
|
||||
APP_LOGD("bundleInfos is null");
|
||||
@ -5259,10 +5263,9 @@ static void CloneAppBundleInfos(
|
||||
}
|
||||
size_t index = 0;
|
||||
for (const auto &item : bundleInfos) {
|
||||
APP_LOGD("name: %{public}s ", item.name.c_str());
|
||||
napi_value objBundleInfo;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_object(env, &objBundleInfo));
|
||||
CommonFunc::ConvertBundleInfo(env, item, objBundleInfo, true);
|
||||
CommonFunc::ConvertBundleInfo(env, item, objBundleInfo, flags);
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, result, index++, objBundleInfo));
|
||||
}
|
||||
}
|
||||
@ -5279,7 +5282,7 @@ void GetAllAppCloneBundleInfoComplete(napi_env env, napi_status status, void *da
|
||||
if (asyncCallbackInfo->err == NO_ERROR) {
|
||||
NAPI_CALL_RETURN_VOID(env, napi_get_null(env, &result[ARGS_POS_ZERO]));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_array(env, &result[ARGS_POS_ONE]));
|
||||
CloneAppBundleInfos(env, result[ARGS_POS_ONE], asyncCallbackInfo->bundleInfos);
|
||||
CloneAppBundleInfos(env, result[ARGS_POS_ONE], asyncCallbackInfo->bundleInfos, asyncCallbackInfo->bundleFlags);
|
||||
} else {
|
||||
result[ARGS_POS_ZERO] = BusinessError::CreateCommonError(env, asyncCallbackInfo->err,
|
||||
GET_ALL_APP_CLONE_BUNDLE_INFO, Constants::PERMISSION_GET_BUNDLE_INFO);
|
||||
|
@ -88,6 +88,7 @@ constexpr int32_t SECOND_PARAM = 1;
|
||||
|
||||
constexpr int32_t SPECIFIED_DISTRIBUTION_TYPE_MAX_SIZE = 128;
|
||||
constexpr int32_t ADDITIONAL_INFO_MAX_SIZE = 3000;
|
||||
constexpr int32_t ILLEGAL_APP_INDEX = -1;
|
||||
} // namespace
|
||||
napi_ref thread_local g_classBundleInstaller;
|
||||
bool g_isSystemApp = false;
|
||||
@ -663,7 +664,7 @@ static bool ParseAppIndex(napi_env env, napi_value args, int32_t &appIndex)
|
||||
APP_LOGD("start to parse appIndex");
|
||||
PropertyInfo propertyInfo = {
|
||||
.propertyName = APP_INDEX,
|
||||
.isNecessary = false,
|
||||
.isNecessary = true,
|
||||
.propertyType = napi_number
|
||||
};
|
||||
napi_value property = nullptr;
|
||||
@ -1643,7 +1644,12 @@ void ParseAppCloneParam(napi_env env, napi_value args, int32_t &userId, int32_t
|
||||
if (!ParseUserId(env, args, userId)) {
|
||||
APP_LOGI("parse userId failed. assign a default value = %{public}d.", userId);
|
||||
}
|
||||
if (!ParseAppIndex(env, args, appIndex)) {
|
||||
if (ParseAppIndex(env, args, appIndex)) {
|
||||
if (appIndex == 0) {
|
||||
APP_LOGI("parse appIndex success, but appIndex is 0, assign a value: %{public}d.", ILLEGAL_APP_INDEX);
|
||||
appIndex = ILLEGAL_APP_INDEX;
|
||||
}
|
||||
} else {
|
||||
APP_LOGI("parse appIndex failed. assign a default value = %{public}d.", appIndex);
|
||||
}
|
||||
}
|
||||
@ -1677,7 +1683,7 @@ napi_value CreateAppClone(napi_env env, napi_callback_info info)
|
||||
ParseAppCloneParam(env, args[i], asyncCallbackInfo->userId, asyncCallbackInfo->appIndex);
|
||||
}
|
||||
} else {
|
||||
APP_LOGE("The number of parameters is incorrect.");
|
||||
APP_LOGW("The number of parameters is incorrect.");
|
||||
BusinessError::ThrowTooFewParametersError(env, ERROR_PARAM_CHECK_ERROR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -439,6 +439,11 @@ ohos_shared_library("libbms") {
|
||||
defines += [ "APP_DOMAIN_VERIFY_ENABLED" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
|
||||
subsystem_name = "bundlemanager"
|
||||
part_name = "bundle_framework"
|
||||
}
|
||||
|
@ -34,7 +34,8 @@ struct AOTState {
|
||||
class AOTExecutor final {
|
||||
public:
|
||||
static AOTExecutor& GetInstance();
|
||||
void ExecuteAOT(const AOTArgs &aotArgs, ErrCode &ret);
|
||||
void ExecuteAOT(const AOTArgs &aotArgs, ErrCode &ret, std::vector<uint8_t> &pendSignData);
|
||||
ErrCode PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData) const;
|
||||
ErrCode StopAOT();
|
||||
private:
|
||||
AOTExecutor() = default;
|
||||
@ -47,8 +48,8 @@ private:
|
||||
ErrCode PrepareArgs(const AOTArgs &aotArgs, AOTArgs &completeArgs) const;
|
||||
nlohmann::json GetSubjectInfo(const AOTArgs &aotArgs) const;
|
||||
void MapArgs(const AOTArgs &aotArgs, std::unordered_map<std::string, std::string> &argsMap);
|
||||
ErrCode EnforceCodeSign(const AOTArgs &aotArgs, const std::vector<int16_t> &sigData) const;
|
||||
ErrCode StartAOTCompiler(const AOTArgs &aotArgs, std::vector<int16_t> &sigData);
|
||||
ErrCode EnforceCodeSign(const std::string &anFileName, const std::vector<uint8_t> &signData) const;
|
||||
ErrCode StartAOTCompiler(const AOTArgs &aotArgs, std::vector<uint8_t> &signData);
|
||||
void InitState(const AOTArgs &aotArgs);
|
||||
void ResetState();
|
||||
private:
|
||||
|
@ -28,16 +28,22 @@
|
||||
#include "nocopyable.h"
|
||||
#include "serial_queue.h"
|
||||
|
||||
#ifdef PEND_SIGN_SCREENLOCK_MGR_ENABLED
|
||||
#include "common_event_manager.h"
|
||||
#include "common_event_support.h"
|
||||
#include "iservice_registry.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
class AOTHandler final {
|
||||
public:
|
||||
static AOTHandler& GetInstance();
|
||||
void HandleInstall(const std::unordered_map<std::string, InnerBundleInfo> &infos) const;
|
||||
void HandleInstall(const std::unordered_map<std::string, InnerBundleInfo> &infos);
|
||||
void HandleOTA();
|
||||
void HandleIdle() const;
|
||||
void HandleIdle();
|
||||
ErrCode HandleCompile(const std::string &bundleName, const std::string &compileMode, bool isAllBundle,
|
||||
std::vector<std::string> &compileResults) const;
|
||||
std::vector<std::string> &compileResults);
|
||||
void HandleResetAOT(const std::string &bundleName, bool isAllBundle) const;
|
||||
ErrCode HandleCopyAp(const std::string &bundleName, bool isAllBundle, std::vector<std::string> &results) const;
|
||||
private:
|
||||
@ -53,25 +59,25 @@ private:
|
||||
std::string GetArkProfilePath(const std::string &bundleName, const std::string &moduleName) const;
|
||||
std::optional<AOTArgs> BuildAOTArgs(
|
||||
const InnerBundleInfo &info, const std::string &moduleName, const std::string &compileMode) const;
|
||||
void HandleInstallWithSingleHap(const InnerBundleInfo &info, const std::string &compileMode) const;
|
||||
void HandleInstallWithSingleHap(const InnerBundleInfo &info, const std::string &compileMode);
|
||||
ErrCode HandleCompileWithSingleHap(
|
||||
const InnerBundleInfo &info, const std::string &moduleName, const std::string &compileMode) const;
|
||||
const InnerBundleInfo &info, const std::string &moduleName, const std::string &compileMode);
|
||||
EventInfo HandleCompileWithBundle(const std::string &bundleName, const std::string &compileMode,
|
||||
std::shared_ptr<BundleDataMgr> dataMgr) const;
|
||||
std::shared_ptr<BundleDataMgr> dataMgr);
|
||||
ErrCode HandleCompileBundles(const std::vector<std::string> &bundleNames, const std::string &compileMode,
|
||||
std::shared_ptr<BundleDataMgr> &dataMgr, std::vector<std::string> &compileResults) const;
|
||||
std::shared_ptr<BundleDataMgr> &dataMgr, std::vector<std::string> &compileResults);
|
||||
ErrCode HandleCompileModules(const std::vector<std::string> &moduleNames, const std::string &compileMode,
|
||||
InnerBundleInfo &info, std::string &compileResult) const;
|
||||
InnerBundleInfo &info, std::string &compileResult);
|
||||
void ClearArkCacheDir() const;
|
||||
void ResetAOTFlags() const;
|
||||
void HandleIdleWithSingleHap(
|
||||
const InnerBundleInfo &info, const std::string &moduleName, const std::string &compileMode) const;
|
||||
const InnerBundleInfo &info, const std::string &moduleName, const std::string &compileMode);
|
||||
bool CheckDeviceState() const;
|
||||
ErrCode AOTInternal(std::optional<AOTArgs> aotArgs, uint32_t versionCode) const;
|
||||
ErrCode AOTInternal(std::optional<AOTArgs> aotArgs, uint32_t versionCode);
|
||||
void HandleOTACompile();
|
||||
void BeforeOTACompile();
|
||||
void OTACompile() const;
|
||||
void OTACompileInternal() const;
|
||||
void OTACompile();
|
||||
void OTACompileInternal();
|
||||
bool GetOTACompileList(std::vector<std::string> &bundleNames) const;
|
||||
bool GetUserBehaviourAppList(std::vector<std::string> &bundleNames, int32_t size) const;
|
||||
bool IsOTACompileSwitchOn() const;
|
||||
@ -82,6 +88,35 @@ private:
|
||||
mutable std::mutex compileMutex_;
|
||||
std::atomic<bool> OTACompileDeadline_ { false };
|
||||
std::shared_ptr<SerialQueue> serialQueue_;
|
||||
|
||||
#ifdef PEND_SIGN_SCREENLOCK_MGR_ENABLED
|
||||
public:
|
||||
void RegisterScreenUnlockListener();
|
||||
private:
|
||||
bool StartPendingSignEvent();
|
||||
bool ExecutePendingSign();
|
||||
ErrCode FinishPendingSign();
|
||||
bool WaitForCommonEventManager() const;
|
||||
bool RegisterScreenUnlockEvent();
|
||||
void UnregisterScreenUnlockEvent();
|
||||
void FinishWaiting();
|
||||
class UnlockEventSubscriber : public OHOS::EventFwk::CommonEventSubscriber {
|
||||
public:
|
||||
UnlockEventSubscriber(const OHOS::EventFwk::CommonEventSubscribeInfo &info) : CommonEventSubscriber(info) {}
|
||||
~UnlockEventSubscriber() override = default;
|
||||
void OnReceiveEvent(const OHOS::EventFwk::CommonEventData &event) override;
|
||||
};
|
||||
private:
|
||||
struct PendingData {
|
||||
uint32_t versionCode {0};
|
||||
std::vector<uint8_t> signData;
|
||||
};
|
||||
mutable std::mutex unlockMutex_;
|
||||
std::condition_variable unlockConVar_;
|
||||
std::atomic<bool> hasUnlocked_ { false };
|
||||
std::shared_ptr<UnlockEventSubscriber> unlockEventSubscriber_;
|
||||
std::unordered_map<std::string, std::unordered_map<std::string, PendingData>> pendingSignData_;
|
||||
#endif
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
@ -636,6 +636,7 @@ private:
|
||||
ErrCode GetRemoveDataGroupDirs(const InnerBundleInfo &oldInfo, const InnerBundleInfo &newInfo);
|
||||
ErrCode RemoveOldGroupDirs() const;
|
||||
ErrCode CreateGroupDirs() const;
|
||||
void CreateDataGroupDir(InnerBundleInfo &info) const;
|
||||
ErrCode GetDataGroupCreateInfos(const InnerBundleInfo &newInfo);
|
||||
ErrCode RemoveDataGroupDirs(const std::string &bundleName, int32_t userId) const;
|
||||
void DeleteGroupDirsForException() const;
|
||||
|
@ -74,6 +74,7 @@ enum class InstalldInterfaceCode : uint32_t {
|
||||
IS_EXIST_EXTENSION_DIR,
|
||||
CREATE_EXTENSION_DATA_DIR,
|
||||
GET_DISK_USAGE,
|
||||
PEND_SIGN_AOT,
|
||||
};
|
||||
|
||||
} // namespace AppExecFwk
|
||||
|
@ -21,6 +21,10 @@
|
||||
#include "resource_manager.h"
|
||||
#include "resource_info.h"
|
||||
|
||||
#ifdef BUNDLE_FRAMEWORK_GRAPHICS
|
||||
#include "pixel_map.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
class BundleResourceDrawable {
|
||||
@ -30,6 +34,13 @@ public:
|
||||
const int32_t density,
|
||||
std::shared_ptr<Global::Resource::ResourceManager> resourceManager,
|
||||
ResourceInfo &resourceInfo);
|
||||
|
||||
#ifdef BUNDLE_FRAMEWORK_GRAPHICS
|
||||
bool GetBadgedIconResource(
|
||||
const std::shared_ptr<Media::PixelMap> layeredPixelMap,
|
||||
const std::shared_ptr<Media::PixelMap> badgedPixelMap,
|
||||
ResourceInfo &resourceInfo);
|
||||
#endif
|
||||
};
|
||||
} // AppExecFwk
|
||||
} // OHOS
|
||||
|
@ -38,6 +38,9 @@ public:
|
||||
// parse icon resource by hapPath
|
||||
bool ParseIconResourceByPath(const std::string &hapPath, const int32_t iconId, ResourceInfo &resourceInfo);
|
||||
|
||||
// parse clone bundle resource info
|
||||
bool ParserCloneResourceInfo(const int32_t appIndex, std::vector<ResourceInfo> &resourceInfos);
|
||||
|
||||
private:
|
||||
// for defaultIconPath is empty, icon and label exist in same hap.
|
||||
bool ParseResourceInfoWithSameHap(const int32_t userId, ResourceInfo &resourceInfo);
|
||||
|
@ -37,10 +37,6 @@ struct InnerBundleCloneInfo {
|
||||
// disabled abilities of the user.
|
||||
std::vector<std::string> disabledAbilities;
|
||||
|
||||
// overlay module state
|
||||
// element is moduleName_state
|
||||
std::vector<std::string> overlayModulesState;
|
||||
|
||||
uint32_t accessTokenId = 0;
|
||||
|
||||
uint64_t accessTokenIdEx = 0;
|
||||
@ -52,9 +48,6 @@ struct InnerBundleCloneInfo {
|
||||
// The time(unix time) will be recalculated
|
||||
// if the application is uninstalled after being installed.
|
||||
int64_t updateTime = 0;
|
||||
|
||||
// app install control
|
||||
bool isRemovable = true;
|
||||
};
|
||||
|
||||
void from_json(const nlohmann::json& jsonObject, InnerBundleCloneInfo& bundleCloneInfo);
|
||||
|
@ -1008,9 +1008,9 @@ public:
|
||||
private:
|
||||
bool IsExistLauncherAbility() const;
|
||||
void GetBundleWithAbilities(
|
||||
int32_t flags, BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) const;
|
||||
int32_t flags, BundleInfo &bundleInfo, int32_t appIndex, int32_t userId = Constants::UNSPECIFIED_USERID) const;
|
||||
void GetBundleWithExtension(
|
||||
int32_t flags, BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) const;
|
||||
int32_t flags, BundleInfo &bundleInfo, int32_t appIndex, int32_t userId = Constants::UNSPECIFIED_USERID) const;
|
||||
void RemoveDuplicateName(std::vector<std::string> &name) const;
|
||||
void GetBundleWithReqPermissionsV9(
|
||||
int32_t flags, int32_t userId, BundleInfo &bundleInfo, int32_t appIndex = 0) const;
|
||||
@ -1020,7 +1020,7 @@ private:
|
||||
int32_t flags, BundleInfo &bundleInfo, int32_t userId, int32_t appIndex = 0) const;
|
||||
void GetBundleWithAbilitiesV9(
|
||||
int32_t flags, HapModuleInfo &hapModuleInfo, int32_t userId, int32_t appIndex = 0) const;
|
||||
void GetBundleWithExtensionAbilitiesV9(int32_t flags, HapModuleInfo &hapModuleInfo) const;
|
||||
void GetBundleWithExtensionAbilitiesV9(int32_t flags, HapModuleInfo &hapModuleInfo, int32_t appIndex = 0) const;
|
||||
IsolationMode GetIsolationMode(const std::string &isolationMode) const;
|
||||
void UpdateIsCompressNativeLibs();
|
||||
void InnerProcessShortcut(const Shortcut &oldShortcut, ShortcutInfo &shortcutInfo) const;
|
||||
|
@ -63,7 +63,9 @@ public:
|
||||
|
||||
virtual ErrCode ProcessBundleUnInstallNative(const std::string &userId, const std::string &bundleName) override;
|
||||
|
||||
virtual ErrCode ExecuteAOT(const AOTArgs &aotArgs) override;
|
||||
virtual ErrCode ExecuteAOT(const AOTArgs &aotArgs, std::vector<uint8_t> &pendSignData) override;
|
||||
|
||||
virtual ErrCode PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData) override;
|
||||
|
||||
virtual ErrCode StopAOT() override;
|
||||
/**
|
||||
|
@ -186,7 +186,9 @@ public:
|
||||
ErrCode GetNativeLibraryFileNames(const std::string &filePath, const std::string &cpuAbi,
|
||||
std::vector<std::string> &fileNames);
|
||||
|
||||
ErrCode ExecuteAOT(const AOTArgs &aotArgs);
|
||||
ErrCode ExecuteAOT(const AOTArgs &aotArgs, std::vector<uint8_t> &pendSignData);
|
||||
|
||||
ErrCode PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData);
|
||||
|
||||
ErrCode StopAOT();
|
||||
|
||||
|
@ -69,6 +69,8 @@ private:
|
||||
|
||||
bool HandleExecuteAOT(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
bool HandlePendSignAOT(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
bool HandleStopAOT(MessageParcel &data, MessageParcel &reply);
|
||||
/**
|
||||
* @brief Handles the RenameModuleDir function called from a IInstalld proxy object.
|
||||
|
@ -89,11 +89,16 @@ public:
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
virtual ErrCode ExecuteAOT(const AOTArgs &aotArgs)
|
||||
virtual ErrCode ExecuteAOT(const AOTArgs &aotArgs, std::vector<uint8_t> &pendSignData)
|
||||
{
|
||||
return ERR_APPEXECFWK_INSTALLD_AOT_EXECUTE_FAILED;
|
||||
}
|
||||
|
||||
virtual ErrCode PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData)
|
||||
{
|
||||
return ERR_APPEXECFWK_INSTALLD_SIGN_AOT_FAILED;
|
||||
}
|
||||
|
||||
virtual ErrCode StopAOT()
|
||||
{
|
||||
return ERR_APPEXECFWK_INSTALLD_STOP_AOT_FAILED;
|
||||
|
@ -66,7 +66,9 @@ public:
|
||||
|
||||
virtual ErrCode ProcessBundleUnInstallNative(const std::string &userId, const std::string &bundleName) override;
|
||||
|
||||
virtual ErrCode ExecuteAOT(const AOTArgs &aotArgs) override;
|
||||
virtual ErrCode ExecuteAOT(const AOTArgs &aotArgs, std::vector<uint8_t> &pendSignData) override;
|
||||
|
||||
virtual ErrCode PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData) override;
|
||||
|
||||
virtual ErrCode StopAOT() override;
|
||||
/**
|
||||
|
@ -182,25 +182,26 @@ void AOTExecutor::MapArgs(const AOTArgs &aotArgs, std::unordered_map<std::string
|
||||
}
|
||||
}
|
||||
|
||||
ErrCode AOTExecutor::EnforceCodeSign(const AOTArgs &aotArgs, const std::vector<int16_t> &sigData) const
|
||||
ErrCode AOTExecutor::PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData) const
|
||||
{
|
||||
return EnforceCodeSign(anFileName, signData);
|
||||
}
|
||||
|
||||
ErrCode AOTExecutor::EnforceCodeSign(const std::string &anFileName, const std::vector<uint8_t> &signData) const
|
||||
{
|
||||
#if defined(CODE_SIGNATURE_ENABLE)
|
||||
if (sigData.empty()) {
|
||||
if (signData.empty()) {
|
||||
APP_LOGI("not enforce code sign if no aot file save");
|
||||
return ERR_OK;
|
||||
}
|
||||
uint32_t byteSize = static_cast<uint32_t>(sigData.size());
|
||||
std::vector<uint8_t> byteData;
|
||||
for (uint32_t i = 0; i < byteSize; ++i) {
|
||||
byteData.emplace_back(static_cast<uint8_t>(sigData[i]));
|
||||
uint32_t dataSize = static_cast<uint32_t>(signData.size());
|
||||
auto retCS =
|
||||
Security::CodeSign::CodeSignUtils::EnforceCodeSignForFile(anFileName, signData.data(), dataSize);
|
||||
if (retCS == VerifyErrCode::CS_ERR_ENABLE) {
|
||||
APP_LOGI("pending enforce code sign as screen not first unlock after reboot");
|
||||
return ERR_APPEXECFWK_INSTALLD_SIGN_AOT_DISABLE;
|
||||
}
|
||||
Security::CodeSign::ByteBuffer sigBuffer;
|
||||
if (!sigBuffer.CopyFrom(byteData.data(), byteSize)) {
|
||||
APP_LOGE("fail to receive code signature ByteBuffer");
|
||||
return ERR_APPEXECFWK_INSTALLD_SIGN_AOT_FAILED;
|
||||
}
|
||||
if (Security::CodeSign::CodeSignUtils::EnforceCodeSignForFile(aotArgs.anFileName, sigBuffer)
|
||||
!= CommonErrCode::CS_SUCCESS) {
|
||||
if (retCS != CommonErrCode::CS_SUCCESS) {
|
||||
APP_LOGE("fail to enable code signature for the aot file");
|
||||
return ERR_APPEXECFWK_INSTALLD_SIGN_AOT_FAILED;
|
||||
}
|
||||
@ -212,7 +213,7 @@ ErrCode AOTExecutor::EnforceCodeSign(const AOTArgs &aotArgs, const std::vector<i
|
||||
#endif
|
||||
}
|
||||
|
||||
ErrCode AOTExecutor::StartAOTCompiler(const AOTArgs &aotArgs, std::vector<int16_t> &sigData)
|
||||
ErrCode AOTExecutor::StartAOTCompiler(const AOTArgs &aotArgs, std::vector<uint8_t> &signData)
|
||||
{
|
||||
#if defined(CODE_SIGNATURE_ENABLE)
|
||||
std::unordered_map<std::string, std::string> argsMap;
|
||||
@ -225,7 +226,8 @@ ErrCode AOTExecutor::StartAOTCompiler(const AOTArgs &aotArgs, std::vector<int16_
|
||||
return ERR_APPEXECFWK_INSTALLD_AOT_EXECUTE_FAILED;
|
||||
}
|
||||
APP_LOGI("start to aot compiler");
|
||||
ret = ArkCompiler::AotCompilerClient::GetInstance().AotCompiler(argsMap, sigData);
|
||||
std::vector<int16_t> fileData;
|
||||
ret = ArkCompiler::AotCompilerClient::GetInstance().AotCompiler(argsMap, fileData);
|
||||
if (ret == ERR_AOT_COMPILER_SIGN_FAILED) {
|
||||
APP_LOGE("aot compiler local signature fail");
|
||||
return ERR_APPEXECFWK_INSTALLD_SIGN_AOT_FAILED;
|
||||
@ -234,6 +236,10 @@ ErrCode AOTExecutor::StartAOTCompiler(const AOTArgs &aotArgs, std::vector<int16_
|
||||
APP_LOGE("aot compiler fail");
|
||||
return ERR_APPEXECFWK_INSTALLD_AOT_EXECUTE_FAILED;
|
||||
}
|
||||
uint32_t byteSize = static_cast<uint32_t>(fileData.size());
|
||||
for (uint32_t i = 0; i < byteSize; ++i) {
|
||||
signData.emplace_back(static_cast<uint8_t>(fileData[i]));
|
||||
}
|
||||
APP_LOGI("aot compiler success");
|
||||
return ERR_OK;
|
||||
#else
|
||||
@ -242,7 +248,7 @@ ErrCode AOTExecutor::StartAOTCompiler(const AOTArgs &aotArgs, std::vector<int16_
|
||||
#endif
|
||||
}
|
||||
|
||||
void AOTExecutor::ExecuteAOT(const AOTArgs &aotArgs, ErrCode &ret)
|
||||
void AOTExecutor::ExecuteAOT(const AOTArgs &aotArgs, ErrCode &ret, std::vector<uint8_t> &pendSignData)
|
||||
{
|
||||
#if defined(CODE_SIGNATURE_ENABLE)
|
||||
APP_LOGI("begin to execute AOT");
|
||||
@ -265,10 +271,13 @@ void AOTExecutor::ExecuteAOT(const AOTArgs &aotArgs, ErrCode &ret)
|
||||
InitState(aotArgs);
|
||||
}
|
||||
APP_LOGI("begin to call aot compiler");
|
||||
std::vector<int16_t> fileData;
|
||||
ret = StartAOTCompiler(completeArgs, fileData);
|
||||
std::vector<uint8_t> signData;
|
||||
ret = StartAOTCompiler(completeArgs, signData);
|
||||
if (ret == ERR_OK) {
|
||||
ret = EnforceCodeSign(completeArgs, fileData);
|
||||
ret = EnforceCodeSign(completeArgs.anFileName, signData);
|
||||
}
|
||||
if (ret == ERR_APPEXECFWK_INSTALLD_SIGN_AOT_DISABLE) {
|
||||
pendSignData = signData;
|
||||
}
|
||||
APP_LOGI("aot compiler finish");
|
||||
{
|
||||
|
@ -36,6 +36,11 @@
|
||||
#include "user_status_client.h"
|
||||
#endif
|
||||
|
||||
#ifdef PEND_SIGN_SCREENLOCK_MGR_ENABLED
|
||||
#include "datetime_ex.h"
|
||||
#include "screenlock_manager.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
namespace {
|
||||
@ -82,6 +87,14 @@ constexpr const char* PGO_MERGED_AP_PREFIX = "merged_";
|
||||
constexpr const char* PGO_RT_AP_PREFIX = "rt_";
|
||||
constexpr const char* COPY_AP_DEST_PATH = "/data/local/pgo/";
|
||||
constexpr const char* COMPILE_NONE = "none";
|
||||
|
||||
#ifdef PEND_SIGN_SCREENLOCK_MGR_ENABLED
|
||||
constexpr int32_t SLEEP_TIME_FOR_COMMON_EVENT_MGR = 500 * 1000; // 500 ms
|
||||
constexpr int32_t SLEEP_TIME_FOR_COMMON_EVENT_MGR_TIME_OUT = 10 * 60; // 10 min
|
||||
constexpr int32_t COMMON_EVENT_MANAGER_ID = 3299;
|
||||
constexpr int32_t SLEEP_TIME_FOR_WAIT_SIGN_ENABLE = 1; // 1 s
|
||||
constexpr int32_t LOOP_TIMES_FOR_WAIT_SIGN_ENABLE = 5;
|
||||
#endif
|
||||
}
|
||||
|
||||
AOTHandler::AOTHandler()
|
||||
@ -196,19 +209,28 @@ std::optional<AOTArgs> AOTHandler::BuildAOTArgs(
|
||||
return aotArgs;
|
||||
}
|
||||
|
||||
ErrCode AOTHandler::AOTInternal(std::optional<AOTArgs> aotArgs, uint32_t versionCode) const
|
||||
ErrCode AOTHandler::AOTInternal(std::optional<AOTArgs> aotArgs, uint32_t versionCode)
|
||||
{
|
||||
if (!aotArgs) {
|
||||
APP_LOGI("aotArgs empty");
|
||||
return ERR_APPEXECFWK_AOT_ARGS_EMPTY;
|
||||
}
|
||||
ErrCode ret = ERR_OK;
|
||||
std::vector<uint8_t> pendSignData;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(executeMutex_);
|
||||
ret = InstalldClient::GetInstance()->ExecuteAOT(*aotArgs);
|
||||
ret = InstalldClient::GetInstance()->ExecuteAOT(*aotArgs, pendSignData);
|
||||
}
|
||||
APP_LOGI("ExecuteAOT ret : %{public}d", ret);
|
||||
|
||||
#ifdef PEND_SIGN_SCREENLOCK_MGR_ENABLED
|
||||
if (!hasUnlocked_ && !pendSignData.empty()) {
|
||||
PendingData pendingData = {versionCode, pendSignData};
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(unlockMutex_);
|
||||
pendingSignData_[aotArgs->bundleName][aotArgs->moduleName] = pendingData;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
auto dataMgr = DelayedSingleton<BundleMgrService>::GetInstance()->GetDataMgr();
|
||||
if (!dataMgr) {
|
||||
APP_LOGE("dataMgr is null");
|
||||
@ -219,13 +241,13 @@ ErrCode AOTHandler::AOTInternal(std::optional<AOTArgs> aotArgs, uint32_t version
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AOTHandler::HandleInstallWithSingleHap(const InnerBundleInfo &info, const std::string &compileMode) const
|
||||
void AOTHandler::HandleInstallWithSingleHap(const InnerBundleInfo &info, const std::string &compileMode)
|
||||
{
|
||||
std::optional<AOTArgs> aotArgs = BuildAOTArgs(info, info.GetCurrentModulePackage(), compileMode);
|
||||
(void)AOTInternal(aotArgs, info.GetVersionCode());
|
||||
}
|
||||
|
||||
void AOTHandler::HandleInstall(const std::unordered_map<std::string, InnerBundleInfo> &infos) const
|
||||
void AOTHandler::HandleInstall(const std::unordered_map<std::string, InnerBundleInfo> &infos)
|
||||
{
|
||||
auto task = [this, infos]() {
|
||||
APP_LOGD("HandleInstall begin");
|
||||
@ -463,7 +485,7 @@ void AOTHandler::BeforeOTACompile()
|
||||
serialQueue_->ScheduleDelayTask(TASK_NAME, delayTimeSeconds * CONVERSION_FACTOR, task);
|
||||
}
|
||||
|
||||
void AOTHandler::OTACompile() const
|
||||
void AOTHandler::OTACompile()
|
||||
{
|
||||
auto OTACompileTask = [this]() {
|
||||
OTACompileInternal();
|
||||
@ -471,7 +493,7 @@ void AOTHandler::OTACompile() const
|
||||
std::thread(OTACompileTask).detach();
|
||||
}
|
||||
|
||||
void AOTHandler::OTACompileInternal() const
|
||||
void AOTHandler::OTACompileInternal()
|
||||
{
|
||||
APP_LOGI("OTACompileInternal begin");
|
||||
system::SetParameter(OTA_COMPILE_STATUS, OTA_COMPILE_STATUS_BEGIN);
|
||||
@ -546,7 +568,7 @@ bool AOTHandler::GetUserBehaviourAppList(std::vector<std::string> &bundleNames,
|
||||
}
|
||||
|
||||
EventInfo AOTHandler::HandleCompileWithBundle(const std::string &bundleName, const std::string &compileMode,
|
||||
std::shared_ptr<BundleDataMgr> dataMgr) const
|
||||
std::shared_ptr<BundleDataMgr> dataMgr)
|
||||
{
|
||||
APP_LOGI("handle compile bundle : %{public}s", bundleName.c_str());
|
||||
EventInfo eventInfo;
|
||||
@ -624,7 +646,7 @@ void AOTHandler::ReportSysEvent(const std::map<std::string, EventInfo> &sysEvent
|
||||
}
|
||||
|
||||
void AOTHandler::HandleIdleWithSingleHap(
|
||||
const InnerBundleInfo &info, const std::string &moduleName, const std::string &compileMode) const
|
||||
const InnerBundleInfo &info, const std::string &moduleName, const std::string &compileMode)
|
||||
{
|
||||
APP_LOGD("HandleIdleWithSingleHap, moduleName : %{public}s", moduleName.c_str());
|
||||
if (info.GetAOTCompileStatus(moduleName) == AOTCompileStatus::COMPILE_SUCCESS) {
|
||||
@ -636,7 +658,7 @@ void AOTHandler::HandleIdleWithSingleHap(
|
||||
}
|
||||
|
||||
ErrCode AOTHandler::HandleCompileWithSingleHap(
|
||||
const InnerBundleInfo &info, const std::string &moduleName, const std::string &compileMode) const
|
||||
const InnerBundleInfo &info, const std::string &moduleName, const std::string &compileMode)
|
||||
{
|
||||
APP_LOGI("HandleCompileWithSingleHap, moduleName : %{public}s", moduleName.c_str());
|
||||
std::optional<AOTArgs> aotArgs = BuildAOTArgs(info, moduleName, compileMode);
|
||||
@ -659,7 +681,7 @@ bool AOTHandler::CheckDeviceState() const
|
||||
#endif
|
||||
}
|
||||
|
||||
void AOTHandler::HandleIdle() const
|
||||
void AOTHandler::HandleIdle()
|
||||
{
|
||||
APP_LOGI("HandleIdle begin");
|
||||
std::unique_lock<std::mutex> lock(idleMutex_, std::defer_lock);
|
||||
@ -708,7 +730,7 @@ void AOTHandler::HandleIdle() const
|
||||
}
|
||||
|
||||
ErrCode AOTHandler::HandleCompile(const std::string &bundleName, const std::string &compileMode, bool isAllBundle,
|
||||
std::vector<std::string> &compileResults) const
|
||||
std::vector<std::string> &compileResults)
|
||||
{
|
||||
APP_LOGI("HandleCompile begin");
|
||||
std::unique_lock<std::mutex> lock(compileMutex_, std::defer_lock);
|
||||
@ -752,7 +774,7 @@ ErrCode AOTHandler::HandleCompile(const std::string &bundleName, const std::stri
|
||||
}
|
||||
|
||||
ErrCode AOTHandler::HandleCompileBundles(const std::vector<std::string> &bundleNames, const std::string &compileMode,
|
||||
std::shared_ptr<BundleDataMgr> &dataMgr, std::vector<std::string> &compileResults) const
|
||||
std::shared_ptr<BundleDataMgr> &dataMgr, std::vector<std::string> &compileResults)
|
||||
{
|
||||
ErrCode ret = ERR_OK;
|
||||
std::for_each(bundleNames.cbegin(), bundleNames.cend(),
|
||||
@ -788,7 +810,7 @@ ErrCode AOTHandler::HandleCompileBundles(const std::vector<std::string> &bundleN
|
||||
}
|
||||
|
||||
ErrCode AOTHandler::HandleCompileModules(const std::vector<std::string> &moduleNames, const std::string &compileMode,
|
||||
InnerBundleInfo &info, std::string &compileResult) const
|
||||
InnerBundleInfo &info, std::string &compileResult)
|
||||
{
|
||||
ErrCode ret = ERR_OK;
|
||||
std::for_each(moduleNames.cbegin(), moduleNames.cend(),
|
||||
@ -801,6 +823,7 @@ ErrCode AOTHandler::HandleCompileModules(const std::vector<std::string> &moduleN
|
||||
compileResult += " " + moduleName + ":compile-fail";
|
||||
break;
|
||||
case ERR_APPEXECFWK_INSTALLD_SIGN_AOT_FAILED:
|
||||
case ERR_APPEXECFWK_INSTALLD_SIGN_AOT_DISABLE:
|
||||
compileResult += " " + moduleName + ":signature-fail";
|
||||
break;
|
||||
case ERR_APPEXECFWK_AOT_ARGS_EMPTY:
|
||||
@ -816,5 +839,177 @@ ErrCode AOTHandler::HandleCompileModules(const std::vector<std::string> &moduleN
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef PEND_SIGN_SCREENLOCK_MGR_ENABLED
|
||||
void AOTHandler::RegisterScreenUnlockListener()
|
||||
{
|
||||
auto PendingSignTask = [this]() {
|
||||
if (!StartPendingSignEvent()) {
|
||||
APP_LOGE("pending sign AOT event error");
|
||||
}
|
||||
};
|
||||
std::thread(PendingSignTask).detach();
|
||||
}
|
||||
|
||||
bool AOTHandler::StartPendingSignEvent()
|
||||
{
|
||||
if (hasUnlocked_) {
|
||||
return true;
|
||||
}
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(unlockMutex_);
|
||||
bool lockStatus = false;
|
||||
if (ScreenLock::ScreenLockManager::GetInstance()->IsLocked(lockStatus) == ScreenLock::E_SCREENLOCK_OK) {
|
||||
APP_LOGI("screen lock status = %{public}d", lockStatus);
|
||||
hasUnlocked_ = !lockStatus;
|
||||
} else {
|
||||
APP_LOGE("unable get lock screen status");
|
||||
}
|
||||
if (hasUnlocked_) {
|
||||
return true;
|
||||
}
|
||||
if (!WaitForCommonEventManager()) {
|
||||
return false;
|
||||
}
|
||||
if (!RegisterScreenUnlockEvent()) {
|
||||
return false;
|
||||
}
|
||||
unlockConVar_.wait(lock, [this]() {
|
||||
bool ret = this->hasUnlocked_;
|
||||
return ret;
|
||||
});
|
||||
APP_LOGI("thread is wake up");
|
||||
UnregisterScreenUnlockEvent();
|
||||
}
|
||||
return ExecutePendingSign();
|
||||
}
|
||||
|
||||
bool AOTHandler::ExecutePendingSign()
|
||||
{
|
||||
sleep(SLEEP_TIME_FOR_WAIT_SIGN_ENABLE);
|
||||
int32_t loopTimes = 0;
|
||||
while (FinishPendingSign() != ERR_OK) {
|
||||
if (++loopTimes > LOOP_TIMES_FOR_WAIT_SIGN_ENABLE) {
|
||||
APP_LOGE("wait for enforce sign enable time out");
|
||||
return false;
|
||||
}
|
||||
sleep(SLEEP_TIME_FOR_WAIT_SIGN_ENABLE);
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(unlockMutex_);
|
||||
pendingSignData_.clear();
|
||||
}
|
||||
APP_LOGI("pending enforce sign success");
|
||||
return true;
|
||||
}
|
||||
|
||||
ErrCode AOTHandler::FinishPendingSign()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(unlockMutex_);
|
||||
ErrCode ret = ERR_OK;
|
||||
for (auto itBundle = pendingSignData_.begin(); itBundle != pendingSignData_.end(); ++itBundle) {
|
||||
auto &bundleName = itBundle->first;
|
||||
auto &moduleSignData = itBundle->second;
|
||||
for (auto itModule = moduleSignData.begin(); itModule != moduleSignData.end();) {
|
||||
auto &moduleName = itModule->first;
|
||||
auto &signData = itModule->second.signData;
|
||||
std::string anFileName = ServiceConstants::ARK_CACHE_PATH + bundleName + ServiceConstants::PATH_SEPARATOR
|
||||
+ ServiceConstants::ARM64 + ServiceConstants::PATH_SEPARATOR + moduleName + ServiceConstants::AN_SUFFIX;
|
||||
|
||||
ErrCode retCS = InstalldClient::GetInstance()->PendSignAOT(anFileName, signData);
|
||||
if (retCS == ERR_APPEXECFWK_INSTALLD_SIGN_AOT_DISABLE) {
|
||||
APP_LOGE("enforce sign service is disable");
|
||||
ret = ERR_APPEXECFWK_INSTALLD_SIGN_AOT_FAILED;
|
||||
++itModule;
|
||||
continue;
|
||||
} else if (retCS != ERR_OK) {
|
||||
itModule = moduleSignData.erase(itModule);
|
||||
continue;
|
||||
}
|
||||
auto dataMgr = DelayedSingleton<BundleMgrService>::GetInstance()->GetDataMgr();
|
||||
if (!dataMgr) {
|
||||
APP_LOGE("dataMgr is null");
|
||||
ret = ERR_APPEXECFWK_INSTALLD_SIGN_AOT_FAILED;
|
||||
++itModule;
|
||||
continue;
|
||||
}
|
||||
auto versionCode = itModule->second.versionCode;
|
||||
dataMgr->SetAOTCompileStatus(bundleName, moduleName, AOTCompileStatus::COMPILE_SUCCESS, versionCode);
|
||||
itModule = moduleSignData.erase(itModule);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool AOTHandler::WaitForCommonEventManager() const
|
||||
{
|
||||
struct tm doingTime = {0};
|
||||
struct tm startTime = {0};
|
||||
int64_t seconds = 0;
|
||||
bool ret = false;
|
||||
if (!OHOS::GetSystemCurrentTime(&startTime)) {
|
||||
return false;
|
||||
}
|
||||
while (seconds <= SLEEP_TIME_FOR_COMMON_EVENT_MGR_TIME_OUT) {
|
||||
auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (samgr != nullptr && samgr->CheckSystemAbility(COMMON_EVENT_MANAGER_ID) != nullptr) {
|
||||
APP_LOGI("common event manager is loaded");
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
APP_LOGD("get common event manager failed");
|
||||
usleep(SLEEP_TIME_FOR_COMMON_EVENT_MGR);
|
||||
if (OHOS::GetSystemCurrentTime(&doingTime)) {
|
||||
seconds = OHOS::GetSecondsBetween(startTime, doingTime);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool AOTHandler::RegisterScreenUnlockEvent()
|
||||
{
|
||||
APP_LOGI("register screen unlock event start");
|
||||
EventFwk::MatchingSkills matchingSkill;
|
||||
// use COMMON_EVENT_USER_UNLOCKED if only for device with PIN
|
||||
matchingSkill.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_UNLOCKED);
|
||||
EventFwk::CommonEventSubscribeInfo eventInfo(matchingSkill);
|
||||
unlockEventSubscriber_ = std::make_shared<UnlockEventSubscriber>(eventInfo);
|
||||
const auto result = EventFwk::CommonEventManager::SubscribeCommonEvent(unlockEventSubscriber_);
|
||||
if (!result) {
|
||||
APP_LOGE("register screen unlock event error");
|
||||
return false;
|
||||
}
|
||||
APP_LOGI("register screen unlock event success");
|
||||
return true;
|
||||
}
|
||||
|
||||
void AOTHandler::UnregisterScreenUnlockEvent()
|
||||
{
|
||||
APP_LOGI("unregister screen unlock event start");
|
||||
const auto result = EventFwk::CommonEventManager::UnSubscribeCommonEvent(unlockEventSubscriber_);
|
||||
if (!result) {
|
||||
APP_LOGE("unregister screen unlock event error");
|
||||
return;
|
||||
}
|
||||
APP_LOGI("unregister screen unlock event success");
|
||||
}
|
||||
|
||||
void AOTHandler::UnlockEventSubscriber::OnReceiveEvent(const EventFwk::CommonEventData &event)
|
||||
{
|
||||
const auto want = event.GetWant();
|
||||
const auto action = want.GetAction();
|
||||
if (action == EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_UNLOCKED) {
|
||||
APP_LOGI("receive screen unlock event");
|
||||
AOTHandler::GetInstance().FinishWaiting();
|
||||
}
|
||||
}
|
||||
|
||||
void AOTHandler::FinishWaiting()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(unlockMutex_);
|
||||
hasUnlocked_ = true;
|
||||
unlockConVar_.notify_one();
|
||||
}
|
||||
#endif
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
@ -1712,7 +1712,10 @@ ErrCode BaseBundleInstaller::InnerProcessInstallByPreInstallInfo(
|
||||
if (result != ERR_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<std::string> extensionDirs = oldInfo.GetAllExtensionDirs();
|
||||
createExtensionDirs_.assign(extensionDirs.begin(), extensionDirs.end());
|
||||
CreateExtensionDataDir(oldInfo);
|
||||
CreateDataGroupDir(oldInfo);
|
||||
// extract ap file
|
||||
result = ExtractAllArkProfileFile(oldInfo);
|
||||
if (result != ERR_OK) {
|
||||
@ -3478,6 +3481,39 @@ void BaseBundleInstaller::CreateExtensionDataDir(InnerBundleInfo &info) const
|
||||
}
|
||||
}
|
||||
|
||||
void BaseBundleInstaller::CreateDataGroupDir(InnerBundleInfo &info) const
|
||||
{
|
||||
if (dataMgr_ == nullptr) {
|
||||
APP_LOGE("dataMgr_ is nullptr");
|
||||
return;
|
||||
}
|
||||
std::vector<DataGroupInfo> dataGroupInfos;
|
||||
if (!dataMgr_->QueryDataGroupInfos(info.GetBundleName(), userId_, dataGroupInfos)) {
|
||||
APP_LOGW("query group info for bundle %{public}s userId %{public}d failed",
|
||||
info.GetBundleName().c_str(), userId_);
|
||||
return;
|
||||
}
|
||||
if (dataGroupInfos.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const DataGroupInfo &dataGroupInfo : dataGroupInfos) {
|
||||
std::string dir = ServiceConstants::REAL_DATA_PATH + ServiceConstants::PATH_SEPARATOR
|
||||
+ std::to_string(userId_) + ServiceConstants::DATA_GROUP_PATH + dataGroupInfo.uuid;
|
||||
bool dirExist = false;
|
||||
auto result = InstalldClient::GetInstance()->IsExistDir(dir, dirExist);
|
||||
if (result == ERR_OK && dirExist) {
|
||||
continue;
|
||||
}
|
||||
APP_LOGD("create group dir: %{public}s", dir.c_str());
|
||||
result = InstalldClient::GetInstance()->Mkdir(dir,
|
||||
DATA_GROUP_DIR_MODE, dataGroupInfo.uid, dataGroupInfo.gid);
|
||||
if (result != ERR_OK) {
|
||||
APP_LOGW("create data group dir %{public}s userId %{public}d failed", dataGroupInfo.uuid.c_str(), userId_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BaseBundleInstaller::GetCreateExtensionDirs(std::unordered_map<std::string, InnerBundleInfo> &newInfos)
|
||||
{
|
||||
for (auto &item : newInfos) {
|
||||
|
@ -99,6 +99,7 @@ constexpr const char* PKG_CONTEXT_PROFILE_PATH = "pkgContextInfo.json";
|
||||
constexpr const char* PROFILE_PATH = "resources/base/profile/";
|
||||
constexpr const char* PROFILE_PREFIX = "$profile:";
|
||||
constexpr const char* JSON_SUFFIX = ".json";
|
||||
constexpr const char* SCHEME_HTTPS = "https";
|
||||
const std::string BMS_EVENT_ADDITIONAL_INFO_CHANGED = "bms.event.ADDITIONAL_INFO_CHANGED";
|
||||
const std::string ENTRY = "entry";
|
||||
const std::string CLONE_BUNDLE_PREFIX = "clone_";
|
||||
@ -738,9 +739,12 @@ ErrCode BundleDataMgr::QueryAbilityInfosV9(
|
||||
return ERR_OK;
|
||||
}
|
||||
// implicit query
|
||||
(void)ImplicitQueryAbilityInfosV9(want, flags, requestUserId, abilityInfos);
|
||||
ErrCode ret = ImplicitQueryAbilityInfosV9(want, flags, requestUserId, abilityInfos);
|
||||
ImplicitQueryCloneAbilityInfosV9(want, flags, requestUserId, abilityInfos);
|
||||
if (abilityInfos.empty()) {
|
||||
if (ret != ERR_OK) {
|
||||
return ret;
|
||||
}
|
||||
LOG_W(BMS_TAG_QUERY_ABILITY, "no matching abilityInfo action:%{public}s uri:%{private}s type:%{public}s",
|
||||
want.GetAction().c_str(), want.GetUriString().c_str(), want.GetType().c_str());
|
||||
return ERR_BUNDLE_MANAGER_ABILITY_NOT_EXIST;
|
||||
@ -1828,9 +1832,6 @@ void BundleDataMgr::GetMatchLauncherAbilityInfosForCloneInfos(
|
||||
void BundleDataMgr::ModifyApplicationInfoByCloneInfo(const InnerBundleCloneInfo &cloneInfo,
|
||||
ApplicationInfo &applicationInfo) const
|
||||
{
|
||||
if (applicationInfo.removable && !cloneInfo.isRemovable) {
|
||||
applicationInfo.removable = false;
|
||||
}
|
||||
applicationInfo.accessTokenId = cloneInfo.accessTokenId;
|
||||
applicationInfo.accessTokenIdEx = cloneInfo.accessTokenIdEx;
|
||||
applicationInfo.enabled = cloneInfo.enabled;
|
||||
@ -7431,6 +7432,10 @@ void BundleDataMgr::FilterAbilityInfosByAppLinking(const Want &want, int32_t fla
|
||||
APP_LOGD("abilityInfos is empty");
|
||||
return;
|
||||
}
|
||||
if (want.GetUriString().rfind(SCHEME_HTTPS, 0) != 0) {
|
||||
APP_LOGD("scheme is not https");
|
||||
return;
|
||||
}
|
||||
std::vector<AbilityInfo> filteredAbilityInfos;
|
||||
// call FiltedAbilityInfos
|
||||
APP_LOGI("call FilterAbilities");
|
||||
|
@ -273,6 +273,9 @@ void BMSEventHandler::AfterBmsStart()
|
||||
}
|
||||
ListeningUserUnlocked();
|
||||
RemoveUnreservedSandbox();
|
||||
#ifdef PEND_SIGN_SCREENLOCK_MGR_ENABLED
|
||||
AOTHandler::GetInstance().RegisterScreenUnlockListener();
|
||||
#endif
|
||||
DelayedSingleton<BundleMgrService>::GetInstance()->RegisterChargeIdleListener();
|
||||
BundleResourceHelper::RegisterCommonEventSubscriber();
|
||||
BundleResourceHelper::RegisterConfigurationObserver();
|
||||
|
@ -73,5 +73,33 @@ bool BundleResourceDrawable::GetIconResourceByDrawable(
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef BUNDLE_FRAMEWORK_GRAPHICS
|
||||
bool BundleResourceDrawable::GetBadgedIconResource(
|
||||
const std::shared_ptr<Media::PixelMap> layeredPixelMap,
|
||||
const std::shared_ptr<Media::PixelMap> badgedPixelMap,
|
||||
ResourceInfo &resourceInfo)
|
||||
{
|
||||
if ((layeredPixelMap == nullptr) || (badgedPixelMap == nullptr)) {
|
||||
LOG_E(BMS_TAG_DEFAULT, "bundleName:%{public}s layered or badge pixelMap are nullptr",
|
||||
resourceInfo.bundleName_.c_str());
|
||||
return false;
|
||||
}
|
||||
Ace::Napi::LayeredDrawableDescriptor layeredDrawableDescriptor;
|
||||
std::shared_ptr<Media::PixelMap> compositePixelMap;
|
||||
if (!layeredDrawableDescriptor.GetCompositePixelMapWithBadge(layeredPixelMap, badgedPixelMap, compositePixelMap)) {
|
||||
LOG_E(BMS_TAG_DEFAULT, "bundleName:%{public}s GetCompositePixelMapWithBadge failed",
|
||||
resourceInfo.bundleName_.c_str());
|
||||
return false;
|
||||
}
|
||||
if (compositePixelMap == nullptr) {
|
||||
LOG_E(BMS_TAG_DEFAULT, "bundleName:%{public}s compositePixelMap is nullptr",
|
||||
resourceInfo.bundleName_.c_str());
|
||||
return false;
|
||||
}
|
||||
BundleResourceImageInfo info;
|
||||
return info.ConvertToString(compositePixelMap, resourceInfo.icon_);
|
||||
}
|
||||
#endif
|
||||
} // AppExecFwk
|
||||
} // OHOS
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "app_log_wrapper.h"
|
||||
#include "bundle_common_event_mgr.h"
|
||||
#include "bundle_promise.h"
|
||||
#include "bundle_util.h"
|
||||
#include "bundle_memory_guard.h"
|
||||
#include "bundle_resource_parser.h"
|
||||
#include "bundle_resource_process.h"
|
||||
@ -37,6 +38,9 @@ const std::string THREAD_POOL_NAME = "BundleResourceThreadPool";
|
||||
constexpr int32_t CHECK_INTERVAL = 50; // 50ms
|
||||
constexpr const char* FOUNDATION_PROCESS_NAME = "foundation";
|
||||
constexpr int32_t SCENE_ID_UPDATE_RESOURCE = 1 << 1;
|
||||
const std::string SYSTEM_THEME_PATH = "/data/service/el1/public/themes/";
|
||||
const std::string THEME_ICONS_A = "/a/app/icons/";
|
||||
const std::string THEME_ICONS_B = "/b/app/icons/";
|
||||
}
|
||||
|
||||
BundleResourceManager::BundleResourceManager()
|
||||
@ -119,8 +123,26 @@ bool BundleResourceManager::AddAllResourceInfo(const int32_t userId, const uint3
|
||||
APP_LOGE("GetAllResourceInfo failed, userId:%{public}d", userId);
|
||||
return false;
|
||||
}
|
||||
bool needDeleteAllResource = true;
|
||||
if (type == static_cast<uint32_t>(BundleResourceChangeType::SYSTEM_THEME_CHANGE)) {
|
||||
// judge whether the bundle theme exists
|
||||
for (auto iter = resourceInfosMap.begin(); iter != resourceInfosMap.end();) {
|
||||
if (!BundleUtil::IsExistDir(SYSTEM_THEME_PATH + std::to_string(userId) + THEME_ICONS_A + iter->first) &&
|
||||
!BundleUtil::IsExistDir(SYSTEM_THEME_PATH + std::to_string(userId) + THEME_ICONS_B + iter->first)) {
|
||||
iter = resourceInfosMap.erase(iter);
|
||||
} else {
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
needDeleteAllResource = false;
|
||||
}
|
||||
if (resourceInfosMap.empty()) {
|
||||
SendBundleResourcesChangedEvent(userId, type);
|
||||
APP_LOGI("add all resource end, no theme changed");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!AddResourceInfos(resourceInfosMap, true, tempTaskNum)) {
|
||||
if (!AddResourceInfos(resourceInfosMap, needDeleteAllResource, tempTaskNum)) {
|
||||
APP_LOGE("add all resource info failed, userId:%{public}d", userId);
|
||||
return false;
|
||||
}
|
||||
@ -522,6 +544,12 @@ bool BundleResourceManager::AddCloneBundleResourceInfo(
|
||||
return false;
|
||||
}
|
||||
// 2. need to process base icon and badge icon
|
||||
// BundleResourceParser
|
||||
BundleResourceParser parser;
|
||||
if (parser.ParserCloneResourceInfo(appIndex, resourceInfos)) {
|
||||
APP_LOGE("bundleName:%{public}s appIndex:%{public}d parse clone resource failed",
|
||||
bundleName.c_str(), appIndex);
|
||||
}
|
||||
// 3. need delete old clone resource info
|
||||
if (!DeleteCloneBundleResourceInfo(bundleName, appIndex)) {
|
||||
APP_LOGW("delete bundleName:%{public}s appIndex:%{public}d resource failed", bundleName.c_str(), appIndex);
|
||||
|
@ -25,6 +25,11 @@
|
||||
#include "bundle_resource_drawable.h"
|
||||
#include "json_util.h"
|
||||
|
||||
#ifdef BUNDLE_FRAMEWORK_GRAPHICS
|
||||
#include "image_source.h"
|
||||
#include "pixel_map.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
namespace {
|
||||
@ -34,6 +39,10 @@ const char* FOREGROUND = "foreground";
|
||||
const char* BACKGROUND = "background";
|
||||
const char CHAR_COLON = ':';
|
||||
const char* LAYERED_IMAGE = "layered-image";
|
||||
#ifdef BUNDLE_FRAMEWORK_GRAPHICS
|
||||
const std::string OHOS_CLONE_APP_BADGE_RESOURCE = "clone_app_badge_";
|
||||
const int32_t BADGE_SIZE = 62;
|
||||
#endif
|
||||
|
||||
struct LayeredImage {
|
||||
std::string foreground;
|
||||
@ -50,6 +59,49 @@ void from_json(const nlohmann::json &jsonObject, LayeredImage &layeredImage)
|
||||
GetValueIfFindKey<std::string>(jsonObject, jsonObjectEnd, BACKGROUND, layeredImage.background,
|
||||
JsonType::STRING, false, parseResult, ArrayType::NOT_ARRAY);
|
||||
}
|
||||
|
||||
#ifdef BUNDLE_FRAMEWORK_GRAPHICS
|
||||
bool GetBadgeResource(const std::string &resourceName, std::shared_ptr<Media::PixelMap> &badgePixelMap)
|
||||
{
|
||||
std::shared_ptr<Global::Resource::ResourceManager> resMgr(Global::Resource::CreateResourceManager());
|
||||
if (resMgr == nullptr) {
|
||||
APP_LOGE("resMgr is nullptr");
|
||||
return false;
|
||||
}
|
||||
std::unique_ptr<Global::Resource::ResConfig> resConfig(Global::Resource::CreateResConfig());
|
||||
if (resConfig == nullptr) {
|
||||
APP_LOGE("resConfig is nullptr");
|
||||
return false;
|
||||
}
|
||||
resMgr->UpdateResConfig(*resConfig);
|
||||
|
||||
std::unique_ptr<uint8_t[]> badgeResourceData;
|
||||
size_t badgeResourceDataLength = 0;
|
||||
auto ret = resMgr->GetMediaDataByName(resourceName.c_str(), badgeResourceDataLength, badgeResourceData);
|
||||
if (ret != Global::Resource::RState::SUCCESS) {
|
||||
APP_LOGE("get (%{public}s) failed, errorCode:%{public}d", resourceName.c_str(), static_cast<int32_t>(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
Media::SourceOptions opts;
|
||||
uint32_t errorCode = 0;
|
||||
std::unique_ptr<Media::ImageSource> imageSource =
|
||||
Media::ImageSource::CreateImageSource(badgeResourceData.get(), badgeResourceDataLength, opts, errorCode);
|
||||
Media::DecodeOptions decodeOpts;
|
||||
decodeOpts.desiredPixelFormat = Media::PixelFormat::BGRA_8888;
|
||||
decodeOpts.desiredSize.width = BADGE_SIZE;
|
||||
decodeOpts.desiredSize.height = BADGE_SIZE;
|
||||
if (imageSource) {
|
||||
auto pixelMapPtr = imageSource->CreatePixelMap(decodeOpts, errorCode);
|
||||
badgePixelMap = std::shared_ptr<Media::PixelMap>(pixelMapPtr.release());
|
||||
}
|
||||
if (errorCode != 0 || (badgePixelMap == nullptr)) {
|
||||
APP_LOGE("get badge failed, errorCode:%{public}u", errorCode);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
BundleResourceParser::BundleResourceParser()
|
||||
@ -427,5 +479,51 @@ void BundleResourceParser::ProcessResourceInfoWhenParseFailed(
|
||||
newResourceInfo.background_ = newResourceInfo.background_.empty() ? oldResourceInfo.background_ :
|
||||
newResourceInfo.background_;
|
||||
}
|
||||
|
||||
bool BundleResourceParser::ParserCloneResourceInfo(
|
||||
const int32_t appIndex, std::vector<ResourceInfo> &resourceInfos)
|
||||
{
|
||||
#ifdef BUNDLE_FRAMEWORK_GRAPHICS
|
||||
// 1. get badge resource media
|
||||
std::string resourceName = OHOS_CLONE_APP_BADGE_RESOURCE + std::to_string(appIndex);
|
||||
APP_LOGI("parse clone info appIndex:%{public}d resourceName:%{public}s start", appIndex, resourceName.c_str());
|
||||
std::shared_ptr<Media::PixelMap> badgePixelMap;
|
||||
if (!GetBadgeResource(resourceName, badgePixelMap) || (badgePixelMap == nullptr)) {
|
||||
APP_LOGE("resourceName:%{public}s get failed", resourceName.c_str());
|
||||
return false;
|
||||
}
|
||||
bool ans = true;
|
||||
// 2. base64 to pixelMap
|
||||
for (auto &resourceInfo : resourceInfos) {
|
||||
uint32_t errorCode = 0;
|
||||
Media::SourceOptions opts;
|
||||
std::unique_ptr<Media::ImageSource> imageSource =
|
||||
Media::ImageSource::CreateImageSource(resourceInfo.icon_, opts, errorCode); // base64 to image
|
||||
Media::DecodeOptions decodeOpts;
|
||||
decodeOpts.desiredPixelFormat = Media::PixelFormat::BGRA_8888;
|
||||
std::shared_ptr<Media::PixelMap> baseIconResource;
|
||||
if (imageSource) {
|
||||
auto pixelMapPtr = imageSource->CreatePixelMap(decodeOpts, errorCode);
|
||||
baseIconResource = std::shared_ptr<Media::PixelMap>(pixelMapPtr.release());
|
||||
}
|
||||
if ((errorCode != 0) || (baseIconResource == nullptr)) {
|
||||
APP_LOGW("get base icon resource failed, key:%{public}s", resourceInfo.GetKey().c_str());
|
||||
ans = false;
|
||||
continue;
|
||||
}
|
||||
// base icon and badge icon resource
|
||||
BundleResourceDrawable drawable;
|
||||
if (!drawable.GetBadgedIconResource(baseIconResource, badgePixelMap, resourceInfo)) {
|
||||
APP_LOGE("get badge failed, key:%{public}s", resourceInfo.GetKey().c_str());
|
||||
ans = false;
|
||||
}
|
||||
}
|
||||
APP_LOGI("parse clone resource info appIndex:%{public}d end", appIndex);
|
||||
return ans;
|
||||
#else
|
||||
APP_LOGI("not support pixel map");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
} // AppExecFwk
|
||||
} // OHOS
|
@ -33,13 +33,11 @@ const std::string BUNDLE_CLONE_INFO_UID = "uid";
|
||||
const std::string BUNDLE_CLONE_INFO_GIDS = "gids";
|
||||
const std::string BUNDLE_CLONE_INFO_ENABLE = "enabled";
|
||||
const std::string BUNDLE_CLONE_INFO_DISABLE_ABILITIES = "disabledAbilities";
|
||||
const std::string BUNDLE_CLONE_INFO_OVERLAY_STATE = "overlayState";
|
||||
|
||||
const std::string BUNDLE_CLONE_INFO_ACCESS_TOKEN_ID = "accessTokenId";
|
||||
const std::string BUNDLE_CLONE_INFO_ACCESS_TOKEN_ID_EX = "accessTokenIdEx";
|
||||
const std::string BUNDLE_CLONE_INFO_INSTALL_TIME = "installTime";
|
||||
const std::string BUNDLE_CLONE_INFO_UPDATE_TIME = "updateTime";
|
||||
const std::string BUNDLE_CLONE_INFO_IS_REMOVABLE = "isRemovable";
|
||||
} // namespace
|
||||
|
||||
void to_json(nlohmann::json& jsonObject, const InnerBundleCloneInfo& bundleCloneInfo)
|
||||
@ -51,12 +49,10 @@ void to_json(nlohmann::json& jsonObject, const InnerBundleCloneInfo& bundleClone
|
||||
{BUNDLE_CLONE_INFO_GIDS, bundleCloneInfo.gids},
|
||||
{BUNDLE_CLONE_INFO_ENABLE, bundleCloneInfo.enabled},
|
||||
{BUNDLE_CLONE_INFO_DISABLE_ABILITIES, bundleCloneInfo.disabledAbilities},
|
||||
{BUNDLE_CLONE_INFO_OVERLAY_STATE, bundleCloneInfo.overlayModulesState},
|
||||
{BUNDLE_CLONE_INFO_ACCESS_TOKEN_ID, bundleCloneInfo.accessTokenId},
|
||||
{BUNDLE_CLONE_INFO_ACCESS_TOKEN_ID_EX, bundleCloneInfo.accessTokenIdEx},
|
||||
{BUNDLE_CLONE_INFO_INSTALL_TIME, bundleCloneInfo.installTime},
|
||||
{BUNDLE_CLONE_INFO_UPDATE_TIME, bundleCloneInfo.updateTime},
|
||||
{BUNDLE_CLONE_INFO_IS_REMOVABLE, bundleCloneInfo.isRemovable},
|
||||
};
|
||||
}
|
||||
|
||||
@ -76,8 +72,6 @@ void from_json(const nlohmann::json& jsonObject, InnerBundleCloneInfo& bundleClo
|
||||
bundleCloneInfo.enabled, JsonType::BOOLEAN, false, parseResult, ArrayType::NOT_ARRAY);
|
||||
GetValueIfFindKey<std::vector<std::string>>(jsonObject, jsonObjectEnd, BUNDLE_CLONE_INFO_DISABLE_ABILITIES,
|
||||
bundleCloneInfo.disabledAbilities, JsonType::ARRAY, false, parseResult, ArrayType::STRING);
|
||||
GetValueIfFindKey<std::vector<std::string>>(jsonObject, jsonObjectEnd, BUNDLE_CLONE_INFO_OVERLAY_STATE,
|
||||
bundleCloneInfo.overlayModulesState, JsonType::ARRAY, false, parseResult, ArrayType::STRING);
|
||||
GetValueIfFindKey<int32_t>(jsonObject, jsonObjectEnd, BUNDLE_CLONE_INFO_ACCESS_TOKEN_ID,
|
||||
bundleCloneInfo.accessTokenId, JsonType::NUMBER, false, parseResult, ArrayType::NOT_ARRAY);
|
||||
GetValueIfFindKey<int32_t>(jsonObject, jsonObjectEnd, BUNDLE_CLONE_INFO_ACCESS_TOKEN_ID_EX,
|
||||
@ -86,8 +80,6 @@ void from_json(const nlohmann::json& jsonObject, InnerBundleCloneInfo& bundleClo
|
||||
bundleCloneInfo.installTime, JsonType::NUMBER, false, parseResult, ArrayType::NOT_ARRAY);
|
||||
GetValueIfFindKey<int32_t>(jsonObject, jsonObjectEnd, BUNDLE_CLONE_INFO_UPDATE_TIME,
|
||||
bundleCloneInfo.updateTime, JsonType::NUMBER, false, parseResult, ArrayType::NOT_ARRAY);
|
||||
GetValueIfFindKey<bool>(jsonObject, jsonObjectEnd, BUNDLE_CLONE_INFO_IS_REMOVABLE,
|
||||
bundleCloneInfo.isRemovable, JsonType::BOOLEAN, false, parseResult, ArrayType::NOT_ARRAY);
|
||||
if (parseResult != ERR_OK) {
|
||||
APP_LOGE("read module bundleCloneInfo from jsonObject error, error code : %{public}d", parseResult);
|
||||
}
|
||||
|
@ -1351,6 +1351,7 @@ void InnerBundleInfo::GetApplicationInfo(int32_t flags, int32_t userId, Applicat
|
||||
if (!appInfo.permissions.empty()) {
|
||||
RemoveDuplicateName(appInfo.permissions);
|
||||
}
|
||||
appInfo.appIndex = appIndex;
|
||||
}
|
||||
|
||||
ErrCode InnerBundleInfo::GetApplicationInfoV9(int32_t flags, int32_t userId, ApplicationInfo &appInfo,
|
||||
@ -1464,8 +1465,8 @@ bool InnerBundleInfo::GetBundleInfo(int32_t flags, BundleInfo &bundleInfo, int32
|
||||
}
|
||||
bundleInfo.reqPermissionDetails = GetAllRequestPermissions();
|
||||
}
|
||||
GetBundleWithAbilities(flags, bundleInfo, userId);
|
||||
GetBundleWithExtension(flags, bundleInfo, userId);
|
||||
GetBundleWithAbilities(flags, bundleInfo, appIndex, userId);
|
||||
GetBundleWithExtension(flags, bundleInfo, appIndex, userId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1524,6 +1525,7 @@ void InnerBundleInfo::ProcessBundleFlags(
|
||||
bundleInfo.applicationInfo, appIndex);
|
||||
}
|
||||
}
|
||||
bundleInfo.applicationInfo.appIndex = appIndex;
|
||||
GetBundleWithReqPermissionsV9(flags, userId, bundleInfo, appIndex);
|
||||
ProcessBundleWithHapModuleInfoFlag(flags, bundleInfo, userId, appIndex);
|
||||
if ((static_cast<uint32_t>(flags) & static_cast<uint32_t>(GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_SIGNATURE_INFO))
|
||||
@ -1623,7 +1625,7 @@ void InnerBundleInfo::ProcessBundleWithHapModuleInfoFlag(
|
||||
}
|
||||
|
||||
GetBundleWithAbilitiesV9(flags, hapModuleInfo, userId, appIndex);
|
||||
GetBundleWithExtensionAbilitiesV9(flags, hapModuleInfo);
|
||||
GetBundleWithExtensionAbilitiesV9(flags, hapModuleInfo, appIndex);
|
||||
bundleInfo.hapModuleInfos.emplace_back(hapModuleInfo);
|
||||
}
|
||||
}
|
||||
@ -1651,6 +1653,7 @@ void InnerBundleInfo::GetBundleWithAbilitiesV9(
|
||||
}
|
||||
AbilityInfo abilityInfo = ability.second;
|
||||
abilityInfo.enabled = isEnabled;
|
||||
abilityInfo.appIndex = appIndex;
|
||||
|
||||
if ((static_cast<uint32_t>(flags) & static_cast<uint32_t>(GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_METADATA))
|
||||
!= static_cast<uint32_t>(GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_METADATA)) {
|
||||
@ -1666,7 +1669,8 @@ void InnerBundleInfo::GetBundleWithAbilitiesV9(
|
||||
}
|
||||
}
|
||||
|
||||
void InnerBundleInfo::GetBundleWithExtensionAbilitiesV9(int32_t flags, HapModuleInfo &hapModuleInfo) const
|
||||
void InnerBundleInfo::GetBundleWithExtensionAbilitiesV9(
|
||||
int32_t flags, HapModuleInfo &hapModuleInfo, int32_t appIndex) const
|
||||
{
|
||||
hapModuleInfo.extensionInfos.clear();
|
||||
if ((static_cast<uint32_t>(flags) &
|
||||
@ -1680,6 +1684,7 @@ void InnerBundleInfo::GetBundleWithExtensionAbilitiesV9(int32_t flags, HapModule
|
||||
continue;
|
||||
}
|
||||
ExtensionAbilityInfo info = extensionInfo.second;
|
||||
info.appIndex = appIndex;
|
||||
|
||||
if ((static_cast<uint32_t>(flags) & static_cast<uint32_t>(GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_METADATA))
|
||||
!= static_cast<uint32_t>(GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_METADATA)) {
|
||||
@ -1693,7 +1698,8 @@ void InnerBundleInfo::GetBundleWithExtensionAbilitiesV9(int32_t flags, HapModule
|
||||
}
|
||||
}
|
||||
|
||||
void InnerBundleInfo::GetBundleWithAbilities(int32_t flags, BundleInfo &bundleInfo, int32_t userId) const
|
||||
void InnerBundleInfo::GetBundleWithAbilities(
|
||||
int32_t flags, BundleInfo &bundleInfo, int32_t appIndex, int32_t userId) const
|
||||
{
|
||||
APP_LOGD("bundleName:%{public}s userid:%{public}d", bundleInfo.name.c_str(), userId);
|
||||
if (static_cast<uint32_t>(flags) & GET_BUNDLE_WITH_ABILITIES) {
|
||||
@ -1712,12 +1718,14 @@ void InnerBundleInfo::GetBundleWithAbilities(int32_t flags, BundleInfo &bundleIn
|
||||
if ((static_cast<uint32_t>(flags) & GET_BUNDLE_WITH_SKILL) != GET_BUNDLE_WITH_SKILL) {
|
||||
abilityInfo.skills.clear();
|
||||
}
|
||||
abilityInfo.appIndex = appIndex;
|
||||
bundleInfo.abilityInfos.emplace_back(abilityInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InnerBundleInfo::GetBundleWithExtension(int32_t flags, BundleInfo &bundleInfo, int32_t userId) const
|
||||
void InnerBundleInfo::GetBundleWithExtension(
|
||||
int32_t flags, BundleInfo &bundleInfo, int32_t appIndex, int32_t userId) const
|
||||
{
|
||||
APP_LOGD("get bundleInfo with extensionInfo begin");
|
||||
if ((static_cast<uint32_t>(flags) & GET_BUNDLE_WITH_EXTENSION_INFO) == GET_BUNDLE_WITH_EXTENSION_INFO) {
|
||||
@ -1729,6 +1737,7 @@ void InnerBundleInfo::GetBundleWithExtension(int32_t flags, BundleInfo &bundleIn
|
||||
if ((static_cast<uint32_t>(flags) & GET_BUNDLE_WITH_SKILL) != GET_BUNDLE_WITH_SKILL) {
|
||||
info.skills.clear();
|
||||
}
|
||||
info.appIndex = appIndex;
|
||||
bundleInfo.extensionInfos.emplace_back(info);
|
||||
}
|
||||
}
|
||||
@ -3532,7 +3541,6 @@ ErrCode InnerBundleInfo::AddCloneBundle(const InnerBundleCloneInfo &attr)
|
||||
// copy from user
|
||||
cloneInfo.enabled = userInfo.bundleUserInfo.enabled;
|
||||
cloneInfo.disabledAbilities = userInfo.bundleUserInfo.disabledAbilities;
|
||||
cloneInfo.overlayModulesState = userInfo.bundleUserInfo.overlayModulesState;
|
||||
cloneInfo.accessTokenId = attr.accessTokenId;
|
||||
cloneInfo.accessTokenIdEx = attr.accessTokenIdEx;
|
||||
cloneInfo.uid = attr.uid;
|
||||
@ -3540,7 +3548,6 @@ ErrCode InnerBundleInfo::AddCloneBundle(const InnerBundleCloneInfo &attr)
|
||||
int64_t now = BundleUtil::GetCurrentTime();
|
||||
cloneInfo.installTime = now;
|
||||
cloneInfo.updateTime = now;
|
||||
cloneInfo.isRemovable = userInfo.isRemovable;
|
||||
|
||||
cloneInfos[appIndexKey] = cloneInfo;
|
||||
APP_LOGD("Add clone app userId: %{public}d appIndex: %{public}d in bundle: %{public}s",
|
||||
@ -3626,9 +3633,6 @@ bool InnerBundleInfo::GetApplicationInfoAdaptBundleClone(
|
||||
APP_LOGE("appIndex %{public}d not exist", appIndex);
|
||||
return false;
|
||||
}
|
||||
if (appInfo.removable && !iter->second.isRemovable) {
|
||||
appInfo.removable = false;
|
||||
}
|
||||
appInfo.accessTokenId = iter->second.accessTokenId;
|
||||
appInfo.accessTokenIdEx = iter->second.accessTokenIdEx;
|
||||
appInfo.enabled = iter->second.enabled;
|
||||
|
@ -200,7 +200,7 @@ ErrCode InstalldHostImpl::ProcessBundleUnInstallNative(const std::string &userId
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode InstalldHostImpl::ExecuteAOT(const AOTArgs &aotArgs)
|
||||
ErrCode InstalldHostImpl::ExecuteAOT(const AOTArgs &aotArgs, std::vector<uint8_t> &pendSignData)
|
||||
{
|
||||
LOG_D(BMS_TAG_INSTALLD, "begin to execute AOT, args : %{public}s", aotArgs.ToString().c_str());
|
||||
if (!InstalldPermissionMgr::VerifyCallingPermission(Constants::FOUNDATION_UID)) {
|
||||
@ -208,11 +208,23 @@ ErrCode InstalldHostImpl::ExecuteAOT(const AOTArgs &aotArgs)
|
||||
return ERR_APPEXECFWK_INSTALLD_PERMISSION_DENIED;
|
||||
}
|
||||
ErrCode ret = ERR_OK;
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret);
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret, pendSignData);
|
||||
LOG_D(BMS_TAG_INSTALLD, "execute AOT ret : %{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ErrCode InstalldHostImpl::PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData)
|
||||
{
|
||||
LOG_D(BMS_TAG_INSTALLD, "begin to pend sign AOT, anFileName : %{public}s", anFileName.c_str());
|
||||
if (!InstalldPermissionMgr::VerifyCallingPermission(Constants::FOUNDATION_UID)) {
|
||||
LOG_E(BMS_TAG_INSTALLD, "installd permission denied, only used for foundation process");
|
||||
return ERR_APPEXECFWK_INSTALLD_PERMISSION_DENIED;
|
||||
}
|
||||
ErrCode ret = AOTExecutor::GetInstance().PendSignAOT(anFileName, signData);
|
||||
LOG_D(BMS_TAG_INSTALLD, "pend sign AOT ret : %{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ErrCode InstalldHostImpl::StopAOT()
|
||||
{
|
||||
LOG_I(BMS_TAG_INSTALLD, "StopAOT begin");
|
||||
|
@ -80,9 +80,14 @@ ErrCode InstalldClient::ProcessBundleUnInstallNative(const std::string &userId,
|
||||
return CallService(&IInstalld::ProcessBundleUnInstallNative, userId, packageName);
|
||||
}
|
||||
|
||||
ErrCode InstalldClient::ExecuteAOT(const AOTArgs &aotArgs)
|
||||
ErrCode InstalldClient::ExecuteAOT(const AOTArgs &aotArgs, std::vector<uint8_t> &pendSignData)
|
||||
{
|
||||
return CallService(&IInstalld::ExecuteAOT, aotArgs);
|
||||
return CallService(&IInstalld::ExecuteAOT, aotArgs, pendSignData);
|
||||
}
|
||||
|
||||
ErrCode InstalldClient::PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData)
|
||||
{
|
||||
return CallService(&IInstalld::PendSignAOT, anFileName, signData);
|
||||
}
|
||||
|
||||
ErrCode InstalldClient::StopAOT()
|
||||
|
@ -96,6 +96,7 @@ void InstalldHost::Init()
|
||||
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::GET_NATIVE_LIBRARY_FILE_NAMES),
|
||||
&InstalldHost::HandGetNativeLibraryFileNames);
|
||||
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::EXECUTE_AOT), &InstalldHost::HandleExecuteAOT);
|
||||
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::PEND_SIGN_AOT), &InstalldHost::HandlePendSignAOT);
|
||||
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::IS_EXIST_FILE), &InstalldHost::HandleIsExistFile);
|
||||
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::IS_EXIST_AP_FILE),
|
||||
&InstalldHost::HandleIsExistApFile);
|
||||
@ -248,7 +249,25 @@ bool InstalldHost::HandleExecuteAOT(MessageParcel &data, MessageParcel &reply)
|
||||
return false;
|
||||
}
|
||||
|
||||
ErrCode result = ExecuteAOT(*aotArgs);
|
||||
std::vector<uint8_t> pendSignData;
|
||||
ErrCode result = ExecuteAOT(*aotArgs, pendSignData);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, reply, result);
|
||||
if (!reply.WriteUInt8Vector(pendSignData)) {
|
||||
LOG_E(BMS_TAG_INSTALLD, "WriteParcelable ExecuteAOT failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InstalldHost::HandlePendSignAOT(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
std::string anFileName = Str16ToStr8(data.ReadString16());
|
||||
std::vector<uint8_t> signData;
|
||||
if (!data.ReadUInt8Vector(&signData)) {
|
||||
LOG_E(BMS_TAG_INSTALLD, "ReadUInt8Vector PendSignAOT failed");
|
||||
return false;
|
||||
}
|
||||
ErrCode result = PendSignAOT(anFileName, signData);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, reply, result);
|
||||
return true;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ ErrCode InstalldProxy::ProcessBundleUnInstallNative(const std::string &userId, c
|
||||
}
|
||||
|
||||
|
||||
ErrCode InstalldProxy::ExecuteAOT(const AOTArgs &aotArgs)
|
||||
ErrCode InstalldProxy::ExecuteAOT(const AOTArgs &aotArgs, std::vector<uint8_t> &pendSignData)
|
||||
{
|
||||
MessageParcel data;
|
||||
INSTALLD_PARCEL_WRITE_INTERFACE_TOKEN(data, (GetDescriptor()));
|
||||
@ -135,7 +135,31 @@ ErrCode InstalldProxy::ExecuteAOT(const AOTArgs &aotArgs)
|
||||
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
return TransactInstalldCmd(InstalldInterfaceCode::EXECUTE_AOT, data, reply, option);
|
||||
ErrCode ret = TransactInstalldCmd(InstalldInterfaceCode::EXECUTE_AOT, data, reply, option);
|
||||
if (ret != ERR_OK) {
|
||||
LOG_E(BMS_TAG_INSTALLD, "TransactInstalldCmd ExecuteAOT failed");
|
||||
if (!reply.ReadUInt8Vector(&pendSignData)) {
|
||||
LOG_E(BMS_TAG_INSTALLD, "ReadUInt8Vector ExecuteAOT failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode InstalldProxy::PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData)
|
||||
{
|
||||
MessageParcel data;
|
||||
INSTALLD_PARCEL_WRITE_INTERFACE_TOKEN(data, (GetDescriptor()));
|
||||
INSTALLD_PARCEL_WRITE(data, String16, Str8ToStr16(anFileName));
|
||||
if (!data.WriteUInt8Vector(signData)) {
|
||||
LOG_E(BMS_TAG_INSTALLD, "WriteParcelable PendSignAOT failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
return TransactInstalldCmd(InstalldInterfaceCode::PEND_SIGN_AOT, data, reply, option);
|
||||
}
|
||||
|
||||
ErrCode InstalldProxy::StopAOT()
|
||||
|
@ -72,9 +72,14 @@ ErrCode InstalldClient::ProcessBundleUnInstallNative(const std::string &userId,
|
||||
return CallService(&IInstalld::ProcessBundleUnInstallNative, userId, packageName);
|
||||
}
|
||||
|
||||
ErrCode InstalldClient::ExecuteAOT(const AOTArgs &aotArgs)
|
||||
ErrCode InstalldClient::ExecuteAOT(const AOTArgs &aotArgs, std::vector<uint8_t> &pendSignData)
|
||||
{
|
||||
return CallService(&IInstalld::ExecuteAOT, aotArgs);
|
||||
return CallService(&IInstalld::ExecuteAOT, aotArgs, pendSignData);
|
||||
}
|
||||
|
||||
ErrCode InstalldClient::PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData)
|
||||
{
|
||||
return CallService(&IInstalld::PendSignAOT, anFileName, signData);
|
||||
}
|
||||
|
||||
ErrCode InstalldClient::StopAOT()
|
||||
|
@ -49,7 +49,12 @@ ErrCode InstalldClient::ProcessBundleUnInstallNative(const std::string &userId,
|
||||
return 0;
|
||||
}
|
||||
|
||||
ErrCode InstalldClient::ExecuteAOT(const AOTArgs &aotArgs)
|
||||
ErrCode InstalldClient::ExecuteAOT(const AOTArgs &aotArgs, std::vector<uint8_t> &pendSignData)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ErrCode InstalldClient::PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -205,7 +205,12 @@ ErrCode InstalldHostImpl::ExtractFiles(const ExtractParam &extractParam)
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode InstalldHostImpl::ExecuteAOT(const AOTArgs &aotArgs)
|
||||
ErrCode InstalldHostImpl::ExecuteAOT(const AOTArgs &aotArgs, std::vector<uint8_t> &pendSignData)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode InstalldHostImpl::PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -154,6 +154,11 @@ ohos_unittest("BmsAbilityManagerHelperTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -181,6 +181,11 @@ ohos_unittest("BmsBundleAccessTokenIdTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -173,6 +173,11 @@ ohos_unittest("BmsAOTMgrTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -161,7 +161,8 @@ HWTEST_F(BmsAOTMgrTest, AOTExecutor_0100, Function | SmallTest | Level0)
|
||||
{
|
||||
AOTArgs aotArgs;
|
||||
ErrCode ret;
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret);
|
||||
std::vector<uint8_t> pendSignData;
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret, pendSignData);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
}
|
||||
|
||||
@ -175,8 +176,9 @@ HWTEST_F(BmsAOTMgrTest, AOTExecutor_0200, Function | SmallTest | Level0)
|
||||
{
|
||||
AOTArgs aotArgs;
|
||||
ErrCode ret;
|
||||
std::vector<uint8_t> pendSignData;
|
||||
aotArgs.compileMode = ServiceConstants::COMPILE_PARTIAL;
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret);
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret, pendSignData);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
}
|
||||
|
||||
@ -190,8 +192,9 @@ HWTEST_F(BmsAOTMgrTest, AOTExecutor_0300, Function | SmallTest | Level0)
|
||||
{
|
||||
AOTArgs aotArgs;
|
||||
ErrCode ret;
|
||||
std::vector<uint8_t> pendSignData;
|
||||
aotArgs.hapPath = HAP_PATH;
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret);
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret, pendSignData);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
}
|
||||
|
||||
@ -205,8 +208,9 @@ HWTEST_F(BmsAOTMgrTest, AOTExecutor_0400, Function | SmallTest | Level0)
|
||||
{
|
||||
AOTArgs aotArgs;
|
||||
ErrCode ret;
|
||||
std::vector<uint8_t> pendSignData;
|
||||
aotArgs.outputPath = OUT_PUT_PATH;
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret);
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret, pendSignData);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
}
|
||||
|
||||
@ -220,10 +224,11 @@ HWTEST_F(BmsAOTMgrTest, AOTExecutor_0500, Function | SmallTest | Level0)
|
||||
{
|
||||
AOTArgs aotArgs;
|
||||
ErrCode ret;
|
||||
std::vector<uint8_t> pendSignData;
|
||||
aotArgs.compileMode = ServiceConstants::COMPILE_PARTIAL;
|
||||
aotArgs.hapPath = ABC_RELATIVE_PATH;
|
||||
aotArgs.outputPath = OUT_PUT_PATH;
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret);
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret, pendSignData);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
}
|
||||
|
||||
@ -237,11 +242,12 @@ HWTEST_F(BmsAOTMgrTest, AOTExecutor_0600, Function | SmallTest | Level0)
|
||||
{
|
||||
AOTArgs aotArgs;
|
||||
ErrCode ret;
|
||||
std::vector<uint8_t> pendSignData;
|
||||
aotArgs.compileMode = COMPILE_FULL;
|
||||
aotArgs.hapPath = NOHAP_PATH;
|
||||
aotArgs.outputPath = OUT_PUT_PATH;
|
||||
aotArgs.arkProfilePath = OUT_PUT_PATH;
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret);
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret, pendSignData);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
}
|
||||
|
||||
@ -255,12 +261,13 @@ HWTEST_F(BmsAOTMgrTest, AOTExecutor_0700, Function | SmallTest | Level0)
|
||||
{
|
||||
AOTArgs aotArgs;
|
||||
ErrCode ret;
|
||||
std::vector<uint8_t> pendSignData;
|
||||
aotArgs.compileMode = COMPILE_FULL;
|
||||
aotArgs.hapPath = HAP_PATH;
|
||||
aotArgs.outputPath = OUT_PUT_PATH;
|
||||
aotArgs.arkProfilePath = OUT_PUT_PATH;
|
||||
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret);
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret, pendSignData);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
}
|
||||
|
||||
@ -274,12 +281,13 @@ HWTEST_F(BmsAOTMgrTest, AOTExecutor_0800, Function | SmallTest | Level0)
|
||||
{
|
||||
AOTArgs aotArgs;
|
||||
ErrCode ret;
|
||||
std::vector<uint8_t> pendSignData;
|
||||
aotArgs.compileMode = COMPILE_FULL;
|
||||
aotArgs.hapPath = HAP_PATH;
|
||||
aotArgs.outputPath = OUT_PUT_PATH;
|
||||
aotArgs.arkProfilePath = OUT_PUT_PATH;
|
||||
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret);
|
||||
AOTExecutor::GetInstance().ExecuteAOT(aotArgs, ret, pendSignData);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
}
|
||||
|
||||
|
@ -170,6 +170,11 @@ ohos_unittest("BmsBundleAppControlTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleMockAppControlTest") {
|
||||
@ -322,6 +327,11 @@ ohos_unittest("BmsBundleMockAppControlTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -174,6 +174,11 @@ ohos_unittest("BmsBundleAppProvisionInfoTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -164,6 +164,11 @@ ohos_unittest("BmsBundleCloneAppBundleLogicTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleCloneAppDataStructTest") {
|
||||
@ -377,6 +382,11 @@ ohos_unittest("BmsBundleCloneAppIpcTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -119,8 +119,6 @@ HWTEST_F(BmsBundleCloneAppDataStructTest, OTA_BundleCloneInfoJsonSerializer_0001
|
||||
bundleCloneInfo.disabledAbilities = {"a", "b"};
|
||||
bundleCloneInfo.enabled = true;
|
||||
bundleCloneInfo.installTime = 10;
|
||||
bundleCloneInfo.isRemovable = true;
|
||||
bundleCloneInfo.overlayModulesState = {"c", "d"};
|
||||
bundleCloneInfo.uid = 20;
|
||||
bundleCloneInfo.updateTime = 21;
|
||||
|
||||
@ -139,11 +137,6 @@ HWTEST_F(BmsBundleCloneAppDataStructTest, OTA_BundleCloneInfoJsonSerializer_0001
|
||||
);
|
||||
EXPECT_EQ(bundleCloneInfo.enabled, bundleCloneInfo2.enabled);
|
||||
EXPECT_EQ(bundleCloneInfo.installTime, bundleCloneInfo2.installTime);
|
||||
EXPECT_EQ(bundleCloneInfo.isRemovable, bundleCloneInfo2.isRemovable);
|
||||
EXPECT_TRUE(
|
||||
std::equal(bundleCloneInfo.overlayModulesState.begin(), bundleCloneInfo.overlayModulesState.end(),
|
||||
bundleCloneInfo2.overlayModulesState.begin())
|
||||
);
|
||||
EXPECT_EQ(bundleCloneInfo.uid, bundleCloneInfo2.uid);
|
||||
EXPECT_EQ(bundleCloneInfo.updateTime, bundleCloneInfo2.updateTime);
|
||||
}
|
||||
@ -166,8 +159,6 @@ HWTEST_F(BmsBundleCloneAppDataStructTest, OTA_BundleUserInfoJsonSerializer_0001,
|
||||
bundleCloneInfo.disabledAbilities = {"a", "b"};
|
||||
bundleCloneInfo.enabled = true;
|
||||
bundleCloneInfo.installTime = 10;
|
||||
bundleCloneInfo.isRemovable = true;
|
||||
bundleCloneInfo.overlayModulesState = {"c", "d"};
|
||||
bundleCloneInfo.uid = 20;
|
||||
bundleCloneInfo.updateTime = 21;
|
||||
|
||||
@ -194,11 +185,6 @@ HWTEST_F(BmsBundleCloneAppDataStructTest, OTA_BundleUserInfoJsonSerializer_0001,
|
||||
);
|
||||
EXPECT_EQ(bundleCloneInfo.enabled, bundleCloneInfo2.enabled);
|
||||
EXPECT_EQ(bundleCloneInfo.installTime, bundleCloneInfo2.installTime);
|
||||
EXPECT_EQ(bundleCloneInfo.isRemovable, bundleCloneInfo2.isRemovable);
|
||||
EXPECT_TRUE(
|
||||
std::equal(bundleCloneInfo.overlayModulesState.begin(), bundleCloneInfo.overlayModulesState.end(),
|
||||
bundleCloneInfo2.overlayModulesState.begin())
|
||||
);
|
||||
EXPECT_EQ(bundleCloneInfo.uid, bundleCloneInfo2.uid);
|
||||
EXPECT_EQ(bundleCloneInfo.updateTime, bundleCloneInfo2.updateTime);
|
||||
}
|
||||
|
@ -199,6 +199,11 @@ ohos_unittest("BmsBundleCloneInstallerTest") {
|
||||
]
|
||||
defines += [ "APP_DOMAIN_VERIFY_ENABLED" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
group("unittest") {
|
||||
testonly = true
|
||||
|
@ -170,6 +170,11 @@ ohos_unittest("BmsBundleCommonTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -165,6 +165,11 @@ ohos_unittest("BmsBundleCrowdtestingTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -157,6 +157,11 @@ ohos_unittest("BmsBundleDataGroupTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -174,6 +174,11 @@ ohos_unittest("BmsBundleDefaultAppTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -166,6 +166,11 @@ ohos_unittest("BmsBundleDependenciesTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -179,6 +179,11 @@ ohos_unittest("BmsBundleFreeInstallBaseTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleFreeInstallTest") {
|
||||
@ -343,6 +348,11 @@ ohos_unittest("BmsBundleFreeInstallTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -167,6 +167,11 @@ ohos_unittest("BmsBundleHapVerifyTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -168,6 +168,11 @@ ohos_unittest("BmsBundleHspTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleSharedLibraryInstallTest") {
|
||||
@ -324,6 +329,11 @@ ohos_unittest("BmsBundleSharedLibraryInstallTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleSharedLibraryUninstallTest") {
|
||||
@ -475,6 +485,11 @@ ohos_unittest("BmsBundleSharedLibraryUninstallTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -173,6 +173,11 @@ ohos_unittest("BmsBundleInstallerManagerTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -205,6 +205,11 @@ ohos_unittest("BmsBundleInstallerTest") {
|
||||
]
|
||||
defines += [ "APP_DOMAIN_VERIFY_ENABLED" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleOtaUpdateTest") {
|
||||
@ -379,6 +384,11 @@ ohos_unittest("BmsBundleOtaUpdateTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsMultipleBundleInstallerTest") {
|
||||
@ -562,6 +572,11 @@ ohos_unittest("BmsMultipleBundleInstallerTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleInstallIpcTest") {
|
||||
@ -717,6 +732,11 @@ ohos_unittest("BmsBundleInstallIpcTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleInstallCheckerTest") {
|
||||
@ -853,6 +873,11 @@ ohos_unittest("BmsBundleInstallCheckerTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleInstallDeviceTypeTest") {
|
||||
@ -989,6 +1014,11 @@ ohos_unittest("BmsBundleInstallDeviceTypeTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsSystemBundleInstallerTest") {
|
||||
@ -1129,6 +1159,11 @@ ohos_unittest("BmsSystemBundleInstallerTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleInstallDriverTest") {
|
||||
@ -1313,6 +1348,11 @@ ohos_unittest("BmsBundleInstallDriverTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleAppServiceFwkInstallerTest") {
|
||||
@ -1480,6 +1520,11 @@ ohos_unittest("BmsBundleAppServiceFwkInstallerTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -4631,7 +4631,8 @@ HWTEST_F(BmsBundleInstallerTest, ExecuteAOT_0100, Function | SmallTest | Level0)
|
||||
{
|
||||
InstalldHostImpl impl;
|
||||
AOTArgs aotArgs;
|
||||
auto ret = impl.ExecuteAOT(aotArgs);
|
||||
std::vector<uint8_t> pendSignData;
|
||||
auto ret = impl.ExecuteAOT(aotArgs, pendSignData);
|
||||
EXPECT_EQ(ret, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
|
||||
}
|
||||
|
||||
|
@ -173,6 +173,11 @@ ohos_unittest("BmsBundleInstallersTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -169,6 +169,11 @@ ohos_unittest("BmsBundleKitServiceBaseTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -182,6 +182,11 @@ ohos_unittest("BmsBundleDataMgrTest") {
|
||||
]
|
||||
defines += [ "APP_DOMAIN_VERIFY_ENABLED" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleKitServiceTest") {
|
||||
@ -343,6 +348,11 @@ ohos_unittest("BmsBundleKitServiceTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleGetWindowPropertiesTest") {
|
||||
@ -500,6 +510,11 @@ ohos_unittest("BmsBundleGetWindowPropertiesTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -171,6 +171,11 @@ ohos_unittest("BmsBundleManagerTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -162,6 +162,10 @@ ohos_unittest("BmsBundleNavigationTest") {
|
||||
defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
|
||||
external_deps += [ "udmf:udmf_client" ]
|
||||
}
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -142,6 +142,10 @@ ohos_unittest("BmsBundleOverlayCheckerTest") {
|
||||
defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
|
||||
external_deps += [ "udmf:udmf_client" ]
|
||||
}
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleOverlayInfoTest") {
|
||||
@ -344,6 +348,10 @@ ohos_unittest("BmsBundleOverlayIpcTest") {
|
||||
defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
|
||||
external_deps += [ "udmf:udmf_client" ]
|
||||
}
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleManagerOverlayIpcTest") {
|
||||
@ -470,6 +478,10 @@ ohos_unittest("BmsBundleManagerOverlayIpcTest") {
|
||||
defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
|
||||
external_deps += [ "udmf:udmf_client" ]
|
||||
}
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleSetOverlayEnabledTest") {
|
||||
@ -598,6 +610,10 @@ ohos_unittest("BmsBundleSetOverlayEnabledTest") {
|
||||
defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
|
||||
external_deps += [ "udmf:udmf_client" ]
|
||||
}
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundleGetOverlayModuleInfoTest") {
|
||||
@ -726,6 +742,10 @@ ohos_unittest("BmsBundleGetOverlayModuleInfoTest") {
|
||||
defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
|
||||
external_deps += [ "udmf:udmf_client" ]
|
||||
}
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -181,6 +181,11 @@ ohos_unittest("BmsBundlePermissionDefListTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundlePermissionGrantTest") {
|
||||
@ -346,6 +351,11 @@ ohos_unittest("BmsBundlePermissionGrantTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundlePermissionFalseTest") {
|
||||
@ -517,6 +527,11 @@ ohos_unittest("BmsBundlePermissionFalseTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundlePermissionStartFullTest") {
|
||||
@ -687,6 +702,11 @@ ohos_unittest("BmsBundlePermissionStartFullTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundlePermissionSyetemAppFalseTest") {
|
||||
@ -858,6 +878,11 @@ ohos_unittest("BmsBundlePermissionSyetemAppFalseTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundlePermissionTokenTest") {
|
||||
@ -1024,6 +1049,11 @@ ohos_unittest("BmsBundlePermissionTokenTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsBundlePermissionGetRequestTest") {
|
||||
@ -1187,6 +1217,11 @@ ohos_unittest("BmsBundlePermissionGetRequestTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -172,6 +172,11 @@ ohos_unittest("BmsBundleQuickFixBootScannerTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -174,6 +174,11 @@ ohos_unittest("BmsBundleQuickFixDeleterTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "mock_quick_fix_callback.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "system_bundle_installer.h"
|
||||
#include "quick_fix_deleter.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
using namespace std::chrono_literals;
|
||||
@ -220,4 +221,107 @@ HWTEST_F(BmsBundleQuickFixDeleterTest, BmsBundleQuickFixDeleterTest_0500, Functi
|
||||
EXPECT_EQ(result, ERR_OK);
|
||||
CheckResult(callback, BUNDLE_NAME, ERR_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixDeleterTest_0600
|
||||
* Function: Execute
|
||||
* @tc.desc: 1. system running normally
|
||||
* 2. test QuickFixDeleter
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixDeleterTest, BmsBundleQuickFixDeleterTest_0600, Function | SmallTest | Level0)
|
||||
{
|
||||
std::shared_ptr<QuickFixDeleter> quickFixDeleter = std::make_shared<QuickFixDeleter>("");
|
||||
ErrCode result = quickFixDeleter->Execute();
|
||||
EXPECT_EQ(result, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixDeleterTest_0700
|
||||
* Function: Execute
|
||||
* @tc.desc: 1. system running normally
|
||||
* 2. test QuickFixDeleter
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixDeleterTest, BmsBundleQuickFixDeleterTest_0700, Function | SmallTest | Level0)
|
||||
{
|
||||
std::shared_ptr<QuickFixDeleter> quickFixDeleter = std::make_shared<QuickFixDeleter>(BUNDLE_NAME);
|
||||
ErrCode result = quickFixDeleter->Execute();
|
||||
EXPECT_EQ(result, ERR_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixDeleterTest_0800
|
||||
* Function: AddHqfInfo
|
||||
* @tc.desc: 1. system running normally
|
||||
* 2. test InnerAppQuickFix
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixDeleterTest, BmsBundleQuickFixDeleterTest_0800, Function | SmallTest | Level0)
|
||||
{
|
||||
AppQuickFix appQuickFix;
|
||||
QuickFixMark mark;
|
||||
std::shared_ptr<InnerAppQuickFix> innerAppQuickFix = std::make_shared<InnerAppQuickFix>(appQuickFix, mark);
|
||||
ErrCode result = innerAppQuickFix->AddHqfInfo(appQuickFix);
|
||||
EXPECT_EQ(result, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixDeleterTest_0900
|
||||
* Function: AddHqfInfo
|
||||
* @tc.desc: 1. system running normally
|
||||
* 2. test InnerAppQuickFix
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixDeleterTest, BmsBundleQuickFixDeleterTest_0900, Function | SmallTest | Level0)
|
||||
{
|
||||
AppQuickFix appQuickFix;
|
||||
HqfInfo hqfInfo;
|
||||
hqfInfo.moduleName = "moduleName";
|
||||
hqfInfo.hapSha256 = "hapSha256";
|
||||
hqfInfo.hqfFilePath = "/data/test/";
|
||||
appQuickFix.deployingAppqfInfo.hqfInfos.emplace_back(hqfInfo);
|
||||
QuickFixMark mark;
|
||||
std::shared_ptr<InnerAppQuickFix> innerAppQuickFix = std::make_shared<InnerAppQuickFix>(appQuickFix, mark);
|
||||
ErrCode result = innerAppQuickFix->AddHqfInfo(appQuickFix);
|
||||
EXPECT_EQ(result, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixDeleterTest_1000
|
||||
* Function: RemoveHqfInfo
|
||||
* @tc.desc: 1. system running normally
|
||||
* 2. test InnerAppQuickFix
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixDeleterTest, BmsBundleQuickFixDeleterTest_1000, Function | SmallTest | Level0)
|
||||
{
|
||||
AppQuickFix appQuickFix;
|
||||
HqfInfo hqfInfo;
|
||||
hqfInfo.moduleName = "moduleName";
|
||||
hqfInfo.hapSha256 = "hapSha256";
|
||||
hqfInfo.hqfFilePath = "/data/test/";
|
||||
appQuickFix.deployingAppqfInfo.hqfInfos.emplace_back(hqfInfo);
|
||||
QuickFixMark mark;
|
||||
std::shared_ptr<InnerAppQuickFix> innerAppQuickFix = std::make_shared<InnerAppQuickFix>(appQuickFix, mark);
|
||||
innerAppQuickFix->SetAppQuickFix(appQuickFix);
|
||||
ErrCode result = innerAppQuickFix->RemoveHqfInfo("moduleNameNo");
|
||||
EXPECT_EQ(result, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixDeleterTest_1100
|
||||
* Function: RemoveHqfInfo
|
||||
* @tc.desc: 1. system running normally
|
||||
* 2. test InnerAppQuickFix
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixDeleterTest, BmsBundleQuickFixDeleterTest_1100, Function | SmallTest | Level0)
|
||||
{
|
||||
AppQuickFix appQuickFix;
|
||||
HqfInfo hqfInfo;
|
||||
hqfInfo.moduleName = "moduleName";
|
||||
hqfInfo.hapSha256 = "hapSha256";
|
||||
hqfInfo.hqfFilePath = "/data/test/";
|
||||
appQuickFix.deployingAppqfInfo.hqfInfos.emplace_back(hqfInfo);
|
||||
QuickFixMark mark;
|
||||
std::shared_ptr<InnerAppQuickFix> innerAppQuickFix = std::make_shared<InnerAppQuickFix>(appQuickFix, mark);
|
||||
innerAppQuickFix->SetAppQuickFix(appQuickFix);
|
||||
ErrCode result = innerAppQuickFix->RemoveHqfInfo("moduleName");
|
||||
EXPECT_EQ(result, true);
|
||||
}
|
||||
} // OHOS
|
@ -173,6 +173,11 @@ ohos_unittest("BmsBundleQuickFixManagerTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -181,6 +181,11 @@ ohos_unittest("BmsBundleQuickFixMgrRdbTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -153,6 +153,11 @@ ohos_unittest("BmsBundleQuickFixQueryTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -175,6 +175,11 @@ ohos_unittest("BmsBundleQuickFixSwitcherTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "mock_status_receiver.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "system_bundle_installer.h"
|
||||
#include "quick_fix_switcher.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
using namespace std::chrono_literals;
|
||||
@ -596,4 +597,56 @@ HWTEST_F(BmsBundleQuickFixSwitcherTest, BmsBundleQuickFixSwitcherTest_1500, Func
|
||||
ret = UninstallBundle(BUNDLE_NAME);
|
||||
EXPECT_EQ(ret, ERR_OK) << "Uninstall bundle com.example.l3jsdemo failed";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixSwitcherTest_1600
|
||||
* Function: Execute
|
||||
* @tc.desc: 1. system running normally
|
||||
* 2. test QuickFixSwitcher
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixSwitcherTest, BmsBundleQuickFixSwitcherTest_1600, Function | SmallTest | Level0)
|
||||
{
|
||||
std::shared_ptr<QuickFixSwitcher> quickFixSwitcher = std::make_shared<QuickFixSwitcher>("", false);
|
||||
ErrCode result = quickFixSwitcher->Execute();
|
||||
EXPECT_EQ(result, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixSwitcherTest_1700
|
||||
* Function: Execute
|
||||
* @tc.desc: 1. system running normally
|
||||
* 2. test QuickFixSwitcher
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixSwitcherTest, BmsBundleQuickFixSwitcherTest_1700, Function | SmallTest | Level0)
|
||||
{
|
||||
std::shared_ptr<QuickFixSwitcher> quickFixSwitcher = std::make_shared<QuickFixSwitcher>("", true);
|
||||
ErrCode result = quickFixSwitcher->Execute();
|
||||
EXPECT_EQ(result, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixSwitcherTest_1800
|
||||
* Function: Execute
|
||||
* @tc.desc: 1. system running normally
|
||||
* 2. test QuickFixSwitcher
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixSwitcherTest, BmsBundleQuickFixSwitcherTest_1800, Function | SmallTest | Level0)
|
||||
{
|
||||
std::shared_ptr<QuickFixSwitcher> quickFixSwitcher = std::make_shared<QuickFixSwitcher>(BUNDLE_NAME, false);
|
||||
ErrCode result = quickFixSwitcher->Execute();
|
||||
EXPECT_EQ(result, ERR_BUNDLEMANAGER_QUICK_FIX_NOT_EXISTED_BUNDLE_INFO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixSwitcherTest_1900
|
||||
* Function: Execute
|
||||
* @tc.desc: 1. system running normally
|
||||
* 2. test QuickFixSwitcher
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixSwitcherTest, BmsBundleQuickFixSwitcherTest_1900, Function | SmallTest | Level0)
|
||||
{
|
||||
std::shared_ptr<QuickFixSwitcher> quickFixSwitcher = std::make_shared<QuickFixSwitcher>(BUNDLE_NAME, true);
|
||||
ErrCode result = quickFixSwitcher->Execute();
|
||||
EXPECT_EQ(result, ERR_BUNDLEMANAGER_QUICK_FIX_NO_PATCH_IN_DATABASE);
|
||||
}
|
||||
} // OHOS
|
@ -176,6 +176,11 @@ ohos_unittest("BmsBundleQuickFixTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -81,6 +81,8 @@ const std::string INVALID_FILE_SUFFIX_PATH = "/data/test/invalidSuffix.txt";
|
||||
const std::string INVALID_FILE_PATH_1 = "/data/service/el1/public/bms/bundle_manager_service/hello.hqf";
|
||||
const std::string INVALID_FILE_PATH_2 = "/data/service/el1/public/bms/bundle_manager_service/quick_fix/../hello.hqf";
|
||||
const std::string VALID_FILE_PATH_3 = "/data/service/el1/public/bms/bundle_manager_service/quick_fix/hello.hqf";
|
||||
const std::string INVALID_FILE_NAME = "..hello.hqf";
|
||||
const std::string VALID_FILE_NAME = "hello.hqf";
|
||||
} // namespace
|
||||
|
||||
class BmsBundleQuickFixTest : public testing::Test {
|
||||
@ -370,22 +372,7 @@ AppQuickFix BmsBundleQuickFixTest::CreateAppQuickFix()
|
||||
|
||||
sptr<IQuickFixManager> BmsBundleQuickFixTest::GetQuickFixManagerProxy()
|
||||
{
|
||||
auto systemAbilityManager = OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (systemAbilityManager == nullptr) {
|
||||
APP_LOGE("GetSystemAbilityManager failed.");
|
||||
return nullptr;
|
||||
}
|
||||
auto bundleMgrSa = systemAbilityManager->GetSystemAbility(OHOS::BUNDLE_MGR_SERVICE_SYS_ABILITY_ID);
|
||||
if (bundleMgrSa == nullptr) {
|
||||
APP_LOGE("GetSystemAbility failed.");
|
||||
return nullptr;
|
||||
}
|
||||
auto bundleMgr = OHOS::iface_cast<IBundleMgr>(bundleMgrSa);
|
||||
if (bundleMgr == nullptr) {
|
||||
APP_LOGE("iface_cast failed.");
|
||||
return nullptr;
|
||||
}
|
||||
return bundleMgr->GetQuickFixManagerProxy();
|
||||
return bundleMgrService_->GetQuickFixManagerProxy();
|
||||
}
|
||||
|
||||
void BmsBundleQuickFixTest::CreateFiles(const std::vector<std::string>& sourceFiles)
|
||||
@ -1066,7 +1053,7 @@ HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0026, Function | SmallTest
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0027, Function | SmallTest | Level0)
|
||||
{
|
||||
auto quickFixProxy= GetQuickFixManagerProxy();
|
||||
auto quickFixProxy = GetQuickFixManagerProxy();
|
||||
EXPECT_NE(quickFixProxy, nullptr) << "the quickFixProxy is nullptr";
|
||||
sptr<MockQuickFixCallback> callback = new (std::nothrow) MockQuickFixCallback();
|
||||
EXPECT_NE(callback, nullptr) << "the callback is nullptr";
|
||||
@ -2736,6 +2723,94 @@ HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0104, Function | SmallTest
|
||||
UninstallBundleInfo(BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixTest_0105
|
||||
* Function: ExtractQuickFixSoFile
|
||||
* @tc.name: test ExtractQuickFixSoFile
|
||||
* @tc.require: issueI5N7AD
|
||||
* @tc.desc: ExtractQuickFixSoFile
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0105, Function | SmallTest | Level0)
|
||||
{
|
||||
AddInnerBundleInfo(BUNDLE_NAME);
|
||||
auto deployer = GetQuickFixDeployer();
|
||||
EXPECT_FALSE(deployer == nullptr);
|
||||
if (deployer != nullptr) {
|
||||
AppQuickFix appQuickFix;
|
||||
std::string patchPath = "data/test";
|
||||
BundleInfo bundleInfo;
|
||||
auto ret = deployer->ExtractSoAndApplyDiff(appQuickFix, bundleInfo, patchPath);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
appQuickFix = CreateAppQuickFix();
|
||||
ret = deployer->ExtractSoAndApplyDiff(appQuickFix, bundleInfo, patchPath);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
HapModuleInfo info;
|
||||
info.moduleName = "entry";
|
||||
bundleInfo.hapModuleInfos.emplace_back(info);
|
||||
|
||||
ret = deployer->ExtractSoAndApplyDiff(appQuickFix, bundleInfo, patchPath);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
// so exist
|
||||
appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
|
||||
ret = deployer->ExtractSoAndApplyDiff(appQuickFix, bundleInfo, patchPath);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
}
|
||||
UninstallBundleInfo(BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixTest_0106
|
||||
* Function: ExtractQuickFixSoFile
|
||||
* @tc.name: test ExtractQuickFixSoFile
|
||||
* @tc.require: issueI5N7AD
|
||||
* @tc.desc: ExtractQuickFixSoFile
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0106, Function | SmallTest | Level0)
|
||||
{
|
||||
AddInnerBundleInfo(BUNDLE_NAME);
|
||||
auto deployer = GetQuickFixDeployer();
|
||||
EXPECT_FALSE(deployer == nullptr);
|
||||
if (deployer != nullptr) {
|
||||
AppQuickFix appQuickFix;
|
||||
std::string patchPath = "data/test";
|
||||
BundleInfo bundleInfo;
|
||||
appQuickFix = CreateAppQuickFix();
|
||||
appQuickFix.bundleName = "error";
|
||||
auto ret = deployer->ExtractSoAndApplyDiff(appQuickFix, bundleInfo, patchPath);
|
||||
EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_BUNDLE_NAME_NOT_EXIST);
|
||||
}
|
||||
UninstallBundleInfo(BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixTest_0107
|
||||
* Function: ExtractQuickFixSoFile
|
||||
* @tc.name: test ExtractQuickFixSoFile
|
||||
* @tc.require: issueI5N7AD
|
||||
* @tc.desc: ExtractQuickFixSoFile
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0107, Function | SmallTest | Level0)
|
||||
{
|
||||
AddInnerBundleInfo(BUNDLE_NAME);
|
||||
auto deployer = GetQuickFixDeployer();
|
||||
EXPECT_FALSE(deployer == nullptr);
|
||||
if (deployer != nullptr) {
|
||||
AppQuickFix appQuickFix;
|
||||
std::string patchPath = "data/test";
|
||||
BundleInfo bundleInfo;
|
||||
appQuickFix = CreateAppQuickFix();
|
||||
auto &appQfInfo = appQuickFix.deployingAppqfInfo;
|
||||
for (auto &hqf : appQfInfo.hqfInfos) {
|
||||
hqf.moduleName = "name";
|
||||
}
|
||||
auto ret = deployer->ExtractSoAndApplyDiff(appQuickFix, bundleInfo, patchPath);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
}
|
||||
UninstallBundleInfo(BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixTest_0110
|
||||
* Function: DefaultNativeSo
|
||||
@ -3629,7 +3704,7 @@ HWTEST_F(BmsBundleQuickFixTest, BmsBundleCopyFiles_0003, Function | SmallTest |
|
||||
CreateFiles(sourceFiles);
|
||||
std::vector<std::string> destFiles = {"hello.hqf"};
|
||||
ErrCode ret = quickFixProxy->CopyFiles(sourceFiles, destFiles);
|
||||
EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
|
||||
EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_INTERNAL_ERROR);
|
||||
DeleteFiles(sourceFiles);
|
||||
DeleteFiles(destFiles);
|
||||
}
|
||||
@ -3839,7 +3914,6 @@ HWTEST_F(BmsBundleQuickFixTest, QuickFixDeployer_0200, Function | SmallTest | Le
|
||||
UninstallBundleInfo(BUNDLE_NAME);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number: QuickFixDeployer_0400
|
||||
* @tc.name: Test ProcessHotReloadDeployEnd with Execute
|
||||
@ -3970,6 +4044,80 @@ HWTEST_F(BmsBundleQuickFixTest, QuickFixer_0100, Function | SmallTest | Level0)
|
||||
EXPECT_EQ(fixer.statusCallback_, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: QuickFixMgr_0100
|
||||
* @tc.name: Test QuickFixMgr
|
||||
* @tc.desc: 1.Test QuickFixMgr
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixTest, QuickFixMgr_0100, Function | SmallTest | Level0)
|
||||
{
|
||||
sptr<IQuickFixStatusCallback> statusCallback;
|
||||
QuickFixMgr quickFixMgr;
|
||||
const std::vector<std::string> bundleFilePaths;
|
||||
auto ret = quickFixMgr.DeployQuickFix(bundleFilePaths, statusCallback);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
ret = quickFixMgr.SwitchQuickFix("", false, statusCallback);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
ret = quickFixMgr.DeleteQuickFix("", statusCallback);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: QuickFixManagerHostImpl_0100
|
||||
* @tc.name: Test QuickFixManagerHostImpl
|
||||
* @tc.desc: 1.Test the failed scene of QuickFixManagerHostImpl
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerHostImpl_0100, Function | SmallTest | Level0)
|
||||
{
|
||||
sptr<IQuickFixStatusCallback> statusCallback;
|
||||
QuickFixManagerHostImpl quickFixMgrHostImpl;
|
||||
const std::vector<std::string> bundleFilePaths;
|
||||
auto ret = quickFixMgrHostImpl.DeployQuickFix(bundleFilePaths, statusCallback);
|
||||
EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
|
||||
ret = quickFixMgrHostImpl.SwitchQuickFix("", false, statusCallback);
|
||||
EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
|
||||
ret = quickFixMgrHostImpl.DeleteQuickFix("", statusCallback);
|
||||
EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
|
||||
|
||||
std::string fileName = "";
|
||||
int32_t fd = 0;
|
||||
std::string path;
|
||||
auto res = quickFixMgrHostImpl.CreateFd(fileName, fd, path);
|
||||
EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: QuickFixManagerHostImpl_0200
|
||||
* @tc.name: Test QuickFixManagerHostImpl.IsFileNameValid
|
||||
* @tc.desc: 1.Test QuickFixManagerHostImpl.IsFileNameValid
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerHostImpl_0200, Function | SmallTest | Level0)
|
||||
{
|
||||
QuickFixManagerHostImpl quickFixMgrHostImpl;
|
||||
|
||||
auto ret = quickFixMgrHostImpl.IsFileNameValid(INVALID_FILE_NAME);
|
||||
EXPECT_FALSE(ret);
|
||||
ret = quickFixMgrHostImpl.IsFileNameValid(VALID_FILE_NAME);
|
||||
EXPECT_EQ(ret, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: QuickFixManagerHostImpl_0300
|
||||
* @tc.name: Test QuickFixManagerHostImpl.IsFileNameValid
|
||||
* @tc.desc: 1.Test QuickFixManagerHostImpl.IsFileNameValid
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerHostImpl_0300, Function | SmallTest | Level0)
|
||||
{
|
||||
QuickFixManagerHostImpl quickFixMgrHostImpl;
|
||||
std::vector<std::string> bundleFilePaths;
|
||||
bundleFilePaths.push_back(VALID_FILE_PATH_3);
|
||||
|
||||
std::vector<std::string> securityFilePaths;
|
||||
|
||||
auto ret = quickFixMgrHostImpl.CopyHqfToSecurityDir(bundleFilePaths, securityFilePaths);
|
||||
EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_MOVE_PATCH_FILE_FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: QuickFixDataMgr_0100
|
||||
* @tc.name: Test QuickFixDataMgr
|
||||
@ -4626,6 +4774,35 @@ HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0490, Function | SmallTest
|
||||
DelayedSingleton<BundleMgrService>::GetInstance()->dataMgr_ = dataMgr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: BmsBundleQuickFixTest_0610
|
||||
* Function: PrepareCodeSignatureParam
|
||||
* @tc.name: test PrepareCodeSignatureParam
|
||||
* @tc.require: issueI5N7AD
|
||||
* @tc.desc: PrepareCodeSignatureParam
|
||||
*/
|
||||
HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0610, Function | SmallTest | Level0)
|
||||
{
|
||||
AddInnerBundleInfo(BUNDLE_NAME_DEMO);
|
||||
|
||||
auto deployer = GetQuickFixDeployer();
|
||||
EXPECT_FALSE(deployer == nullptr);
|
||||
if (deployer != nullptr) {
|
||||
AppQuickFix appQuickFix = CreateAppQuickFix();
|
||||
appQuickFix.bundleName = BUNDLE_NAME_DEMO;
|
||||
appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
|
||||
|
||||
HqfInfo hqf;
|
||||
BundleInfo bundleInfo;
|
||||
bundleInfo.applicationInfo.compileSdkType = "";
|
||||
std::string hqfSoPath = "/data/test/";
|
||||
CodeSignatureParam codeSignatureParam;
|
||||
deployer->PrepareCodeSignatureParam(appQuickFix, hqf, bundleInfo, hqfSoPath, codeSignatureParam);
|
||||
EXPECT_EQ(codeSignatureParam.isCompileSdkOpenHarmony, false);
|
||||
}
|
||||
UninstallBundleInfo(BUNDLE_NAME_DEMO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DeployQuickFix_0001
|
||||
* Function: DeployQuickFix
|
||||
|
@ -173,6 +173,11 @@ ohos_unittest("BmsBundleResourceManagerTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -197,6 +197,11 @@ ohos_unittest("BmsBundleResourceTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -174,6 +174,11 @@ ohos_unittest("BmsSandboxAppTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsSandboxRdbTest") {
|
||||
@ -333,6 +338,11 @@ ohos_unittest("BmsSandboxRdbTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -183,6 +183,11 @@ ohos_unittest("BmsBundleUninstallerTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -186,6 +186,11 @@ ohos_unittest("BmsBundleUpdaterTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -167,6 +167,11 @@ ohos_unittest("BmsBundleVerifyManagerTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -143,6 +143,11 @@ ohos_unittest("BmsDataMgrTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsExtensionDataMgrTest") {
|
||||
@ -275,6 +280,11 @@ ohos_unittest("BmsExtensionDataMgrTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -124,6 +124,11 @@ ohos_unittest("BmsEventHandlerTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsEventHandlerUnLockedTest") {
|
||||
@ -228,6 +233,11 @@ ohos_unittest("BmsEventHandlerUnLockedTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -168,6 +168,10 @@ ohos_unittest("BmsExtendResourceManagerTest") {
|
||||
defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
|
||||
external_deps += [ "udmf:udmf_client" ]
|
||||
}
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -169,6 +169,10 @@ ohos_unittest("BmsInstallDaemonIpcTest") {
|
||||
defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
|
||||
external_deps += [ "udmf:udmf_client" ]
|
||||
}
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsInstallDaemonHostImplTest") {
|
||||
@ -252,6 +256,10 @@ ohos_unittest("BmsInstallDaemonHostImplTest") {
|
||||
defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
|
||||
external_deps += [ "udmf:udmf_client" ]
|
||||
}
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_unittest("BmsInstallDaemonOperatorTest") {
|
||||
|
@ -810,7 +810,8 @@ HWTEST_F(BmsInstallDaemonHostImplTest, InstalldHostImplTest_4500, Function | Sma
|
||||
{
|
||||
InstalldHostImpl impl;
|
||||
AOTArgs aotArgs;
|
||||
auto ret = impl.ExecuteAOT(aotArgs);
|
||||
std::vector<uint8_t> pendSignData;
|
||||
auto ret = impl.ExecuteAOT(aotArgs, pendSignData);
|
||||
EXPECT_EQ(ret, ERR_APPEXECFWK_INSTALLD_PERMISSION_DENIED);
|
||||
}
|
||||
|
||||
|
@ -590,7 +590,8 @@ HWTEST_F(BmsInstallDaemonIpcTest, InstalldProxyTest_2700, Function | SmallTest |
|
||||
EXPECT_NE(installdProxy, nullptr);
|
||||
|
||||
AOTArgs aotArgs;
|
||||
auto ret = installdProxy->ExecuteAOT(aotArgs);
|
||||
std::vector<uint8_t> pendSignData;
|
||||
auto ret = installdProxy->ExecuteAOT(aotArgs, pendSignData);
|
||||
EXPECT_EQ(ret, ERR_APPEXECFWK_INSTALL_INSTALLD_SERVICE_ERROR);
|
||||
}
|
||||
|
||||
|
@ -165,6 +165,11 @@ ohos_unittest("BmsInstalldHostTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -157,6 +157,11 @@ ohos_unittest("BmsRdbDataManagerTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -139,6 +139,11 @@ ohos_unittest("BmsServiceBundleScanTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -136,6 +136,11 @@ ohos_unittest("BmsServiceStartupTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -163,6 +163,11 @@ ohos_unittest("BmsSyscapToolTest") {
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -79,10 +79,13 @@ group("fuzztest") {
|
||||
"fuzztest_information/querykeepalivebundleinfos_fuzzer:QueryKeepAliveBundleInfosFuzzTest",
|
||||
"fuzztest_information/remoteabilityinfo_fuzzer:RemoteAbilityInfoFuzzTest",
|
||||
"fuzztest_others/appservicefwkinstallerinstall_fuzzer:AppServiceFwkInstallerInstallFuzzTest",
|
||||
"fuzztest_others/bmsextensionclient_fuzzer:BmsExtensionClientFuzzTest",
|
||||
"fuzztest_others/bundlecloneinstaller_fuzzer:BundlecloneinstallerFuzzTest",
|
||||
"fuzztest_others/commonevent_fuzzer:CommonEventFuzzTest",
|
||||
"fuzztest_others/copyfiles_fuzzer:CopyFilesFuzzTest",
|
||||
"fuzztest_others/deletequickfix_fuzzer:DeleteQuickFixFuzzTest",
|
||||
"fuzztest_others/deployquickfix_fuzzer:DeployQuickFixFuzzTest",
|
||||
"fuzztest_others/driverinstaller_fuzzer:DriverInstallerFuzzTest",
|
||||
"fuzztest_others/elementname_fuzzer:ElementNameFuzzTest",
|
||||
"fuzztest_others/filenamevalid_fuzzer:FileNameValidFuzzTest",
|
||||
"fuzztest_others/installparamunmarshalling_fuzzer:InstallParamUnmarshallingFuzzTest",
|
||||
|
@ -135,6 +135,10 @@ ohos_fuzztest("BundleInstalldHostFuzzTest") {
|
||||
defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
|
||||
external_deps += [ "udmf:udmf_client" ]
|
||||
}
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
|
||||
sources += [ "bundleinstalldhost_fuzzer.cpp" ]
|
||||
}
|
||||
|
@ -135,6 +135,10 @@ ohos_fuzztest("BundleInstallerHostFuzzTest") {
|
||||
defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
|
||||
external_deps += [ "udmf:udmf_client" ]
|
||||
}
|
||||
if (code_signature_enable && pend_sign_screenlock_mgr_enable) {
|
||||
defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ]
|
||||
external_deps += [ "screenlock_mgr:screenlock_client" ]
|
||||
}
|
||||
|
||||
sources += [ "bundleinstallerhost_fuzzer.cpp" ]
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/test.gni")
|
||||
import("${services_path}/bundlemgr/appexecfwk_bundlemgr.gni")
|
||||
import("../../../../appexecfwk.gni")
|
||||
import("../../../../services/bundlemgr/appexecfwk_bundlemgr.gni")
|
||||
|
||||
module_output_path = fuzz_test_path
|
||||
|
||||
|
@ -25,18 +25,9 @@ using namespace OHOS::AppExecFwk;
|
||||
namespace OHOS {
|
||||
constexpr size_t FOO_MAX_LEN = 1024;
|
||||
constexpr size_t U32_AT_SIZE = 4;
|
||||
constexpr size_t MESSAGE_SIZE = 4;
|
||||
constexpr size_t DCAMERA_SHIFT_24 = 24;
|
||||
constexpr size_t DCAMERA_SHIFT_16 = 16;
|
||||
constexpr size_t DCAMERA_SHIFT_8 = 8;
|
||||
|
||||
uint32_t GetU32Data(const char* ptr)
|
||||
{
|
||||
return (ptr[0] << DCAMERA_SHIFT_24) | (ptr[1] << DCAMERA_SHIFT_16) | (ptr[2] << DCAMERA_SHIFT_8) | (ptr[3]);
|
||||
}
|
||||
bool DoSomethingInterestingWithMyAPI(const char* data, size_t size)
|
||||
{
|
||||
uint32_t code = (GetU32Data(data) % MESSAGE_SIZE);
|
||||
InstallParam installParam;
|
||||
installParam.isPreInstallApp = true;
|
||||
installParam.removable = false;
|
||||
|
186
test/fuzztest/fuzztest_others/bmsextensionclient_fuzzer/BUILD.gn
Normal file
186
test/fuzztest/fuzztest_others/bmsextensionclient_fuzzer/BUILD.gn
Normal file
@ -0,0 +1,186 @@
|
||||
# Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#####################hydra-fuzz###################
|
||||
import("//build/config/features.gni")
|
||||
import("//build/ohos.gni")
|
||||
import("//build/test.gni")
|
||||
import("../../../../appexecfwk.gni")
|
||||
import("../../../../services/bundlemgr/appexecfwk_bundlemgr.gni")
|
||||
module_output_path = fuzz_test_path
|
||||
|
||||
##############################fuzztest##########################################
|
||||
ohos_fuzztest("BmsExtensionClientFuzzTest") {
|
||||
module_out_path = module_output_path
|
||||
fuzz_config_file =
|
||||
"../../../fuzztest/fuzztest_others/bmsextensionclient_fuzzer"
|
||||
use_exceptions = true
|
||||
include_dirs = [ "//third_party/jsoncpp/include" ]
|
||||
sources = bundle_mgr_source
|
||||
sources += [
|
||||
"${services_path}/bundlemgr/src/aot/aot_executor.cpp",
|
||||
"${services_path}/bundlemgr/src/installd/installd_host_impl.cpp",
|
||||
"${services_path}/bundlemgr/src/installd/installd_operator.cpp",
|
||||
"${services_path}/bundlemgr/src/installd/installd_permission_mgr.cpp",
|
||||
"${services_path}/bundlemgr/src/installd/installd_service.cpp",
|
||||
]
|
||||
|
||||
sources += bundle_install_sources
|
||||
|
||||
sources += [ "bmsextensionclient_fuzzer.cpp" ]
|
||||
|
||||
configs = [ "${services_path}/bundlemgr/test:bundlemgr_test_config" ]
|
||||
cflags = []
|
||||
if (target_cpu == "arm") {
|
||||
cflags += [ "-DBINDER_IPC_32BIT" ]
|
||||
}
|
||||
deps = [
|
||||
"${base_path}:appexecfwk_base",
|
||||
"${common_path}:libappexecfwk_common",
|
||||
"${core_path}:appexecfwk_core",
|
||||
]
|
||||
deps += bundle_install_deps
|
||||
|
||||
external_deps = [
|
||||
"ability_base:want",
|
||||
"access_token:el5_filekey_manager_sdk",
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"access_token:libnativetoken",
|
||||
"access_token:libprivacy_sdk",
|
||||
"access_token:libtoken_setproc",
|
||||
"access_token:libtokenid_sdk",
|
||||
"appspawn:hnpapi",
|
||||
"appverify:libhapverify",
|
||||
"common_event_service:cesfwk_innerkits",
|
||||
"eventhandler:libeventhandler",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
"init:libbegetutil",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
external_deps += bundle_install_external_deps
|
||||
|
||||
defines = []
|
||||
|
||||
if (code_signature_enable) {
|
||||
sources += [ "${services_path}/bundlemgr/src/code_sign_helper.cpp" ]
|
||||
include_dirs += [ "${services_path}/bundlemgr/include" ]
|
||||
external_deps += [
|
||||
"code_signature:libcode_sign_utils",
|
||||
"ets_runtime:libcompiler_service",
|
||||
]
|
||||
defines += [ "CODE_SIGNATURE_ENABLE" ]
|
||||
}
|
||||
|
||||
if (configpolicy_enable) {
|
||||
external_deps += [ "config_policy:configpolicy_util" ]
|
||||
defines += [ "CONFIG_POLOCY_ENABLE" ]
|
||||
}
|
||||
|
||||
if (bundle_framework_app_control) {
|
||||
defines += [ "BUNDLE_FRAMEWORK_APP_CONTROL" ]
|
||||
sources += [
|
||||
"${services_path}/bundlemgr/src/app_control/app_control_manager.cpp",
|
||||
"${services_path}/bundlemgr/src/app_control/app_control_manager_host_impl.cpp",
|
||||
"${services_path}/bundlemgr/src/app_control/app_control_manager_rdb.cpp",
|
||||
"${services_path}/bundlemgr/src/app_control/app_jump_interceptor_event_subscriber.cpp",
|
||||
"${services_path}/bundlemgr/src/app_control/app_jump_interceptor_manager_rdb.cpp",
|
||||
]
|
||||
include_dirs += [ "${services_path}/bundlemgr/include/app_control" ]
|
||||
external_deps += [ "c_utils:utils" ]
|
||||
}
|
||||
|
||||
if (current_cpu == "arm64") {
|
||||
defines += [ "USE_BUNDLE_EXTENSION" ]
|
||||
}
|
||||
|
||||
if (build_selinux) {
|
||||
external_deps += [ "selinux_adapter:libhap_restorecon" ]
|
||||
cflags += [ "-DWITH_SELINUX" ]
|
||||
}
|
||||
if (account_enable) {
|
||||
external_deps += [ "os_account:os_account_innerkits" ]
|
||||
defines += [ "ACCOUNT_ENABLE" ]
|
||||
}
|
||||
if (bundle_framework_free_install) {
|
||||
sources += aging
|
||||
sources += free_install
|
||||
sources += distributed_manager
|
||||
external_deps += [
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:app_manager",
|
||||
"battery_manager:batterysrv_client",
|
||||
"device_usage_statistics:usagestatsinner",
|
||||
"display_manager:displaymgr",
|
||||
"power_manager:powermgr_client",
|
||||
"syscap_codec:syscap_interface_shared",
|
||||
]
|
||||
defines += [ "BUNDLE_FRAMEWORK_FREE_INSTALL" ]
|
||||
}
|
||||
if (global_resmgr_enable) {
|
||||
defines += [ "GLOBAL_RESMGR_ENABLE" ]
|
||||
external_deps += [ "resource_management:global_resmgr" ]
|
||||
}
|
||||
if (hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
defines += [ "HICOLLIE_ENABLE" ]
|
||||
}
|
||||
|
||||
if (hisysevent_enable) {
|
||||
sources += [ "${services_path}/bundlemgr/src/inner_event_report.cpp" ]
|
||||
external_deps += [ "hisysevent:libhisysevent" ]
|
||||
defines += [ "HISYSEVENT_ENABLE" ]
|
||||
}
|
||||
|
||||
if (bundle_framework_quick_fix) {
|
||||
include_dirs += [ "${services_path}/bundlemgr/src/include/quick_fix" ]
|
||||
sources += quick_fix
|
||||
defines += [ "BUNDLE_FRAMEWORK_QUICK_FIX" ]
|
||||
}
|
||||
|
||||
if (storage_service_enable) {
|
||||
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
|
||||
defines += [ "STORAGE_SERVICE_ENABLE" ]
|
||||
}
|
||||
|
||||
external_deps += [ "kv_store:distributeddata_inner" ]
|
||||
configs += [ "../../../../services/bundlemgr:rdb_config" ]
|
||||
external_deps += [ "relational_store:native_rdb" ]
|
||||
sources += [
|
||||
"${services_path}/bundlemgr/src/bundle_data_storage_rdb.cpp",
|
||||
"${services_path}/bundlemgr/src/preinstall_data_storage_rdb.cpp",
|
||||
"${services_path}/bundlemgr/src/rdb/bms_rdb_open_callback.cpp",
|
||||
"${services_path}/bundlemgr/src/rdb/rdb_data_manager.cpp",
|
||||
]
|
||||
if (udmf_enabled) {
|
||||
defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
|
||||
external_deps += [ "udmf:udmf_client" ]
|
||||
}
|
||||
|
||||
if (bms_device_info_manager_part_enabled) {
|
||||
external_deps += [
|
||||
"device_info_manager:distributed_device_profile_common",
|
||||
"device_info_manager:distributed_device_profile_sdk",
|
||||
]
|
||||
defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (app_domain_verify_enabled) {
|
||||
external_deps += [
|
||||
"app_domain_verify:app_domain_verify_common",
|
||||
"app_domain_verify:app_domain_verify_mgr_client",
|
||||
]
|
||||
defines += [ "APP_DOMAIN_VERIFY_ENABLED" ]
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "bms_extension_client.h"
|
||||
|
||||
#include "bmsextensionclient_fuzzer.h"
|
||||
|
||||
using Want = OHOS::AAFwk::Want;
|
||||
|
||||
using namespace OHOS::AppExecFwk;
|
||||
namespace OHOS {
|
||||
constexpr uint8_t ENABLE = 2;
|
||||
bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
|
||||
{
|
||||
Want want;
|
||||
std::string bundleName (reinterpret_cast<const char*>(data), size);
|
||||
bool boolParam = *data % ENABLE;
|
||||
want.SetAction(bundleName);
|
||||
std::vector<AbilityInfo> abilityInfos;
|
||||
AbilityInfo abilityInfo;
|
||||
std::vector<Want> wants;
|
||||
const std::vector<std::string> bundleNames;
|
||||
std::vector<BundleInfo> bundleInfos;
|
||||
std::vector<int64_t> bundleStats;
|
||||
sptr<IRemoteObject> callback;
|
||||
BmsExtensionClient bmsExtensionClient;
|
||||
BundleInfo bundleInfo;
|
||||
bmsExtensionClient.QueryLauncherAbility(want, reinterpret_cast<uintptr_t>(data),
|
||||
abilityInfos);
|
||||
bmsExtensionClient.QueryAbilityInfos(want, reinterpret_cast<uintptr_t>(data),
|
||||
reinterpret_cast<uintptr_t>(data), abilityInfos);
|
||||
bmsExtensionClient.BatchQueryAbilityInfos(wants, reinterpret_cast<uintptr_t>(data),
|
||||
reinterpret_cast<uintptr_t>(data),
|
||||
abilityInfos);
|
||||
bmsExtensionClient.QueryAbilityInfo(want, reinterpret_cast<uintptr_t>(data),
|
||||
reinterpret_cast<uintptr_t>(data), abilityInfo);
|
||||
bmsExtensionClient.GetBundleInfos(reinterpret_cast<uintptr_t>(data), bundleInfos,
|
||||
reinterpret_cast<uintptr_t>(data));
|
||||
bmsExtensionClient.GetBundleInfo(bundleName, reinterpret_cast<uintptr_t>(data), bundleInfo,
|
||||
reinterpret_cast<uintptr_t>(data), boolParam);
|
||||
bmsExtensionClient.BatchGetBundleInfo(bundleNames, reinterpret_cast<uintptr_t>(data),
|
||||
bundleInfos, reinterpret_cast<uintptr_t>(data));
|
||||
bmsExtensionClient.ImplicitQueryAbilityInfos(want, reinterpret_cast<uintptr_t>(data),
|
||||
reinterpret_cast<uintptr_t>(data),
|
||||
abilityInfos, boolParam);
|
||||
bmsExtensionClient.GetBundleStats(bundleName, reinterpret_cast<uintptr_t>(data), bundleStats);
|
||||
bmsExtensionClient.ClearCache(bundleName, callback, reinterpret_cast<uintptr_t>(data));
|
||||
bmsExtensionClient.ClearData(bundleName, reinterpret_cast<uintptr_t>(data));
|
||||
int32_t uid = 3024;
|
||||
bmsExtensionClient.GetUidByBundleName(bundleName, reinterpret_cast<uintptr_t>(data),
|
||||
uid);
|
||||
bmsExtensionClient.GetBundleNameByUid(reinterpret_cast<uintptr_t>(data), bundleName);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Fuzzer entry point.
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
// Run your code on data.
|
||||
OHOS::DoSomethingInterestingWithMyAPI(data, size);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TEST_FUZZTEST_BMSEXTENSIONCLIENT_FUZZER_H
|
||||
#define TEST_FUZZTEST_BMSEXTENSIONCLIENT_FUZZER_H
|
||||
|
||||
#define FUZZ_PROJECT_NAME "BmsExtensionClient_fuzzer"
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user