From 180833caea7ee50a3b7036318cd637c5dbdea3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E5=9B=BD=E5=86=9B?= Date: Wed, 10 Sep 2025 16:32:26 +0800 Subject: [PATCH] access local debug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 任国军 --- frameworks/native/runtime/hdc_register.cpp | 16 ++++++--- services/appmgr/src/app_mgr_service_inner.cpp | 36 +++++++++---------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/frameworks/native/runtime/hdc_register.cpp b/frameworks/native/runtime/hdc_register.cpp index 496c1bdc464..049a00fde22 100644 --- a/frameworks/native/runtime/hdc_register.cpp +++ b/frameworks/native/runtime/hdc_register.cpp @@ -42,12 +42,20 @@ void HdcRegister::StartHdcRegister(const std::string& bundleName, const std::str TAG_LOGD(AAFwkTag::JSRUNTIME, "called"); if (debugMode == BOTH_REG) { - registerLocalHandler_ = dlopen("libda_register.z.so", RTLD_LAZY); - registerHdcHandler_ = dlopen("libhdc_register.z.so", RTLD_LAZY); + if (registerLocalHandler_ == nullptr) { + registerLocalHandler_ = dlopen("libda_register.z.so", RTLD_LAZY); + } + if (registerHdcHandler_ == nullptr) { + registerHdcHandler_ = dlopen("libhdc_register.z.so", RTLD_LAZY); + } } else if (debugMode == LOCAL_DEBUG_REG) { - registerLocalHandler_ = dlopen("libda_register.z.so", RTLD_LAZY); + if (registerLocalHandler_ == nullptr) { + registerLocalHandler_ = dlopen("libda_register.z.so", RTLD_LAZY); + } } else { - registerHdcHandler_ = dlopen("libhdc_register.z.so", RTLD_LAZY); + if (registerHdcHandler_ == nullptr) { + registerHdcHandler_ = dlopen("libhdc_register.z.so", RTLD_LAZY); + } } if (registerLocalHandler_ != nullptr) { auto startRegister = reinterpret_cast(dlsym(registerLocalHandler_, "StartConnect")); diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 79bf6363287..667f3c0ce44 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -631,7 +631,7 @@ void AppMgrServiceInner::PreloadModuleFinished(const int32_t pid) auto reportLoadTask = [appRecord]() { auto priorityObj = appRecord->GetPriorityObject(); if (priorityObj) { - AAFwk::ResSchedUtil::GetInstance().ReportLoadingEventToRss(AAFwk::LoadingStage::PRELOAD_END, + AAFwk::ResSchedUtil::GetInstance().ReportLoadingEventToRss(AAFwk::LoadingStage::PRELOAD_END, priorityObj->GetPid(), appRecord->GetUid(), 0, 0); } }; @@ -2114,7 +2114,7 @@ bool AppMgrServiceInner::IsUninstallingOrUpgrading(int32_t uid) std::lock_guard lock(uninstallOrUpgradeUidSetLock_); if (uninstallOrUpgradeUidSet_.find(uid) != uninstallOrUpgradeUidSet_.end()) { return true; - } + } return false; } @@ -4840,7 +4840,7 @@ void AppMgrServiceInner::OnRemoteDied(const wptr &remote, bool is } } ClearData(appRecord); - + if (appRecord->IsStartSpecifiedAbility() && startSpecifiedAbilityResponse_) { startSpecifiedAbilityResponse_->OnStartSpecifiedFailed(appRecord->GetSpecifiedRequestId()); } @@ -7934,8 +7934,8 @@ int32_t AppMgrServiceInner::UnregisterAppDebugListener(const sptrGetChildProcessType(); info.srcEntry = childProcessRecord->GetSrcEntry(); @@ -10448,7 +10448,7 @@ int32_t AppMgrServiceInner::PromoteCurrentToCandidateMasterProcess(bool isInsert { TAG_LOGI(AAFwkTag::APPMGR, "call"); HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); - + if (!appRunningManager_) { TAG_LOGE(AAFwkTag::APPMGR, "appRunningManager_ null"); return AAFwk::ERR_NOT_ISOLATION_PROCESS; @@ -10463,21 +10463,21 @@ int32_t AppMgrServiceInner::PromoteCurrentToCandidateMasterProcess(bool isInsert if (!AAFwk::AppUtils::GetInstance().IsStartSpecifiedProcess()) { TAG_LOGE(AAFwkTag::APPMGR, "Capability not support"); - return AAFwk::ERR_CAPABILITY_NOT_SUPPORT; + return AAFwk::ERR_CAPABILITY_NOT_SUPPORT; } - + if (appRecord->GetSpecifiedProcessFlag() == "" && !appRecord->IsMasterProcess()) { TAG_LOGE(AAFwkTag::APPMGR, "Current process is not running a component " "configured with \"isolationProcess\"."); - return AAFwk::ERR_NOT_ISOLATION_PROCESS; + return AAFwk::ERR_NOT_ISOLATION_PROCESS; } auto now = std::chrono::steady_clock::now().time_since_epoch(); int64_t timeStamp = std::chrono::duration_cast(now).count(); if(!isInsertToHead){ timeStamp = -timeStamp; - } + } appRecord->SetTimeStamp(timeStamp); return ERR_OK; } @@ -10495,17 +10495,17 @@ int32_t AppMgrServiceInner::DemoteCurrentFromCandidateMasterProcess() if (!AAFwk::AppUtils::GetInstance().IsStartSpecifiedProcess()) { TAG_LOGE(AAFwkTag::APPMGR, "Capability not support"); - return AAFwk::ERR_CAPABILITY_NOT_SUPPORT; + return AAFwk::ERR_CAPABILITY_NOT_SUPPORT; } if (appRecord->IsMasterProcess()) { TAG_LOGE(AAFwkTag::APPMGR, "Current process is already a master process"); return AAFwk::ERR_ALREADY_MASTER_PROCESS; } - + if (appRecord->GetTimeStamp() == 0) { TAG_LOGE(AAFwkTag::APPMGR, "Current process is not a candidate master process"); - return AAFwk::ERR_NOT_CANDIDATE_MASTER_PROCESS; + return AAFwk::ERR_NOT_CANDIDATE_MASTER_PROCESS; } appRecord->SetTimeStamp(0); @@ -10520,7 +10520,7 @@ int32_t AppMgrServiceInner::ExitMasterProcessRole() std::lock_guard guard(exitMasterProcessRoleLock_); if (!AAFwk::AppUtils::GetInstance().IsStartSpecifiedProcess()) { TAG_LOGE(AAFwkTag::APPMGR, "Capability not support"); - return AAFwk::ERR_CAPABILITY_NOT_SUPPORT; + return AAFwk::ERR_CAPABILITY_NOT_SUPPORT; } int32_t pid = IPCSkeleton::GetCallingPid(); @@ -10534,10 +10534,10 @@ int32_t AppMgrServiceInner::ExitMasterProcessRole() TAG_LOGE(AAFwkTag::APPMGR, "Not a master process"); return AAFwk::ERR_NOT_MASTER_PROCESS; } - + if (appRecord->IsNewProcessRequest()) { TAG_LOGE(AAFwkTag::APPMGR, "There is an unfinished onNewProcessRequest"); - return AAFwk::ERR_NOT_ON_NEW_PROCESS_REQUEST_DONE; + return AAFwk::ERR_NOT_ON_NEW_PROCESS_REQUEST_DONE; } appRecord->SetMasterProcess(false); @@ -10558,7 +10558,7 @@ void AppMgrServiceInner::OnProcessDied(std::shared_ptr appReco DelayedSingleton::GetInstance()->OnProcessDied(appRecord); } -bool AppMgrServiceInner::IsBlockedByDisposeRules(const std::string &bundleName, int32_t userId, +bool AppMgrServiceInner::IsBlockedByDisposeRules(const std::string &bundleName, int32_t userId, int32_t appIndex) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); -- Gitee