From c3ccccdff03752460ca6ca4af155058363cf7eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E5=86=AC=E5=86=AC=E5=86=AC?= Date: Thu, 24 Oct 2024 20:21:35 +0800 Subject: [PATCH] Message:fix Codes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑冬冬冬 --- .../native/appkit/dfr/appfreeze_inner.cpp | 17 ----------------- .../kits/native/appkit/dfr/appfreeze_inner.h | 1 - services/appmgr/src/app_mgr_service_inner.cpp | 2 +- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/frameworks/native/appkit/dfr/appfreeze_inner.cpp b/frameworks/native/appkit/dfr/appfreeze_inner.cpp index eb1fc16c32..b94f940621 100644 --- a/frameworks/native/appkit/dfr/appfreeze_inner.cpp +++ b/frameworks/native/appkit/dfr/appfreeze_inner.cpp @@ -25,7 +25,6 @@ #include "freeze_util.h" #include "hilog_tag_wrapper.h" #include "hitrace_meter.h" -#include "hisysevent.h" #include "parameter.h" #include "xcollie/watchdog.h" #include "time_util.h" @@ -112,7 +111,6 @@ void AppfreezeInner::ChangeFaultDateInfo(FaultData& faultData, const std::string faultData.waitSaveState = AppRecovery::GetInstance().IsEnabled(); AAFwk::ExitReason exitReason = {REASON_APP_FREEZE, "Kill Reason:" + faultData.errorObject.name}; AbilityManagerClient::GetInstance()->RecordAppExitReason(exitReason); - SendProcessKillEvent("Kill Reason:" + faultData.errorObject.name); } NotifyANR(faultData); if (isExit) { @@ -177,21 +175,6 @@ bool AppfreezeInner::IsExitApp(const std::string& name) return false; } -void AppfreezeInner::SendProcessKillEvent(const std::string& killReason) -{ - auto applicationInfo = applicationInfo_.lock(); - if (applicationInfo != nullptr) { - int32_t pid = static_cast(getpid()); - std::string processName = applicationInfo->process; - int result = HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::FRAMEWORK, "PROCESS_KILL", - HiviewDFX::HiSysEvent::EventType::FAULT, EVENT_PID, pid, - EVENT_PROCESS_NAME, processName, EVENT_MESSAGE, killReason); - TAG_LOGW(AAFwkTag::APPDFR, "hisysevent write result=%{public}d, send event [FRAMEWORK,PROCESS_KILL]," - " pid=%{public}d, processName=%{public}s, msg=%{public}s", result, pid, processName.c_str(), - killReason.c_str()); - } -} - int AppfreezeInner::AcquireStack(const FaultData& info, bool onlyMainThread) { HITRACE_METER_FMT(HITRACE_TAG_APP, "AppfreezeInner::AcquireStack name:%s", info.errorObject.name.c_str()); diff --git a/interfaces/kits/native/appkit/dfr/appfreeze_inner.h b/interfaces/kits/native/appkit/dfr/appfreeze_inner.h index 06a6346938..90f4bc3bf7 100644 --- a/interfaces/kits/native/appkit/dfr/appfreeze_inner.h +++ b/interfaces/kits/native/appkit/dfr/appfreeze_inner.h @@ -51,7 +51,6 @@ private: static std::weak_ptr appMainHandler_; std::weak_ptr applicationInfo_; void AppFreezeRecovery(); - void SendProcessKillEvent(const std::string& killReason); int NotifyANR(const FaultData& faultData); bool IsExitApp(const std::string& name); bool IsHandleAppfreeze(); diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index ab93869f34..c7bc824874 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -5917,7 +5917,7 @@ int32_t AppMgrServiceInner::KillFaultApp(int32_t pid, const std::string &bundleN if (isNeedExit || (faultData.forceExit && !faultData.waitSaveState)) { TAG_LOGI(AAFwkTag::APPMGR, "faultData: %{public}s,pid: %{public}d will exit because %{public}s", bundleName.c_str(), pid, innerService->FaultTypeToString(faultData.faultType).c_str()); - innerService->KillProcessByPid(pid, "KillFaultApp"); + innerService->KillProcessByPid(pid, faultData.errorObject.name); return; } };