mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 22:21:36 -04:00
@@ -33,6 +33,11 @@ BundleMgrHelper::~BundleMgrHelper()
|
||||
}
|
||||
}
|
||||
|
||||
void BundleMgrHelper::PreConnect()
|
||||
{
|
||||
Connect();
|
||||
}
|
||||
|
||||
ErrCode BundleMgrHelper::GetNameForUid(const int32_t uid, std::string &name)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::BUNDLEMGRHELPER, "called");
|
||||
@@ -204,7 +209,7 @@ std::string BundleMgrHelper::GetAppIdByBundleName(const std::string &bundleName,
|
||||
TAG_LOGE(AAFwkTag::BUNDLEMGRHELPER, "Failed to connect.");
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
return bundleMgr->GetAppIdByBundleName(bundleName, userId);
|
||||
}
|
||||
|
||||
@@ -364,6 +364,13 @@ void MainThread::Attach()
|
||||
return;
|
||||
}
|
||||
mainThreadState_ = MainThreadState::ATTACH;
|
||||
isDeveloperMode_ = system::GetBoolParameter(DEVELOPER_MODE_STATE, false);
|
||||
auto bundleMgrHelper = DelayedSingleton<BundleMgrHelper>::GetInstance();
|
||||
if (bundleMgrHelper == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "The bundleMgrHelper is nullptr");
|
||||
return;
|
||||
}
|
||||
bundleMgrHelper->PreConnect();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1042,10 +1049,6 @@ void MainThread::OnStartAbility(const std::string &bundleName,
|
||||
loadPath = std::regex_replace(loadPath, pattern, std::string(LOCAL_CODE_PATH));
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ModuleResPath: %{public}s", loadPath.c_str());
|
||||
// getOverlayPath
|
||||
auto res = GetOverlayModuleInfos(bundleName, entryHapModuleInfo.moduleName, overlayModuleInfos_);
|
||||
if (res != ERR_OK) {
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "getOverlayPath failed");
|
||||
}
|
||||
if (overlayModuleInfos_.size() == 0) {
|
||||
if (!resourceManager->AddResource(loadPath.c_str())) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "AddResource failed");
|
||||
@@ -1527,7 +1530,9 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
debugOption.perfCmd = perfCmd;
|
||||
runtime->StartProfiler(debugOption);
|
||||
} else {
|
||||
runtime->StartDebugMode(debugOption);
|
||||
if (isDeveloperMode_) {
|
||||
runtime->StartDebugMode(debugOption);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<HqfInfo> hqfInfos = appInfo.appQuickFix.deployedAppqfInfo.hqfInfos;
|
||||
@@ -1676,11 +1681,10 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
entryHapModuleInfo.hapPath.empty() ? entryHapModuleInfo.resourcePath : entryHapModuleInfo.hapPath;
|
||||
std::regex inner_pattern(std::string(ABS_CODE_PATH) + std::string(FILE_SEPARATOR) + bundleInfo.name);
|
||||
loadPath = std::regex_replace(loadPath, inner_pattern, LOCAL_CODE_PATH);
|
||||
std::vector<OverlayModuleInfo> overlayModuleInfos;
|
||||
auto res = GetOverlayModuleInfos(bundleInfo.name, moduleName, overlayModuleInfos);
|
||||
auto res = GetOverlayModuleInfos(bundleInfo.name, moduleName, overlayModuleInfos_);
|
||||
std::vector<std::string> overlayPaths;
|
||||
if (res == ERR_OK) {
|
||||
overlayPaths = GetAddOverlayPaths(overlayModuleInfos);
|
||||
overlayPaths = GetAddOverlayPaths(overlayModuleInfos_);
|
||||
}
|
||||
std::unique_ptr<Global::Resource::ResConfig> resConfig(Global::Resource::CreateResConfig());
|
||||
int32_t appType;
|
||||
@@ -3244,12 +3248,12 @@ void MainThread::AssertFaultResumeMainThreadDetection()
|
||||
|
||||
void MainThread::HandleInitAssertFaultTask(bool isDebugModule, bool isDebugApp)
|
||||
{
|
||||
if (!system::GetBoolParameter(PRODUCT_ASSERT_FAULT_DIALOG_ENABLED, false)) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Unsupport assert fault dialog");
|
||||
if (!isDeveloperMode_) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Developer Mode is false");
|
||||
return;
|
||||
}
|
||||
if (!system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "Developer Mode is false");
|
||||
if (!system::GetBoolParameter(PRODUCT_ASSERT_FAULT_DIALOG_ENABLED, false)) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Unsupport assert fault dialog");
|
||||
return;
|
||||
}
|
||||
if (!isDebugApp) {
|
||||
|
||||
@@ -27,6 +27,7 @@ using Want = OHOS::AAFwk::Want;
|
||||
class BundleMgrHelper : public std::enable_shared_from_this<BundleMgrHelper> {
|
||||
public:
|
||||
DISALLOW_COPY_AND_MOVE(BundleMgrHelper);
|
||||
void PreConnect();
|
||||
ErrCode GetNameForUid(const int32_t uid, std::string &name);
|
||||
ErrCode GetNameAndIndexForUid(const int32_t uid, std::string &bundleName, int32_t &appIndex);
|
||||
bool GetBundleInfo(const std::string &bundleName, const BundleFlag flag, BundleInfo &bundleInfo, int32_t userId);
|
||||
@@ -109,7 +110,7 @@ private:
|
||||
sptr<IBundleInstaller> ConnectBundleInstaller();
|
||||
void OnDeath();
|
||||
std::string ParseBundleNameByAppId(const std::string &appId) const;
|
||||
|
||||
|
||||
private:
|
||||
DECLARE_DELAYED_SINGLETON(BundleMgrHelper)
|
||||
std::mutex mutex_;
|
||||
|
||||
@@ -661,6 +661,7 @@ private:
|
||||
std::string pathSeparator_ = "/";
|
||||
std::string abilityLibraryType_ = ".so";
|
||||
static std::weak_ptr<OHOSApplication> applicationForDump_;
|
||||
bool isDeveloperMode_ = false;
|
||||
|
||||
#ifdef ABILITY_LIBRARY_LOADER
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user