From 2ce5101cbb5fdadb06de30aa23622980e5b3415d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E6=80=9D=E6=88=90?= Date: Fri, 30 May 2025 01:36:26 +0000 Subject: [PATCH] auto ScheduleSaveAppState MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 林思成 --- .../native/ability/native/recovery/app_recovery.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frameworks/native/ability/native/recovery/app_recovery.cpp b/frameworks/native/ability/native/recovery/app_recovery.cpp index 4655b2f69a6..c46639486d0 100644 --- a/frameworks/native/ability/native/recovery/app_recovery.cpp +++ b/frameworks/native/ability/native/recovery/app_recovery.cpp @@ -187,6 +187,12 @@ bool AppRecovery::IsNeedSaveAppState(StateReason reason) bool AppRecovery::ScheduleSaveAppState(StateReason reason, uintptr_t ability) { TAG_LOGI(AAFwkTag::RECOVERY, "begin"); + if (reason != StateReason::DEVELOPER_REQUEST && + OHOS::system::GetParameter("const.dfx.sub_health_recovery.enable", "") == "true") { + std::string str = "0x7"; + std::string filePath = "/proc/" + std::to_string(getpid()) + "/unexpected_die_catch"; + OHOS::SaveStringToFile(filePath, str, true); + } bool ret = IsNeedSaveAppState(reason); if (!ret && this->freezeCallback == nullptr) { return false; @@ -229,6 +235,10 @@ bool AppRecovery::ScheduleSaveAppState(StateReason reason, uintptr_t ability) return false; } + if (getpid() == gettid()) { + DoSaveAppState(reason); + return true; + } auto task = [reason, ability]() { AppRecovery::GetInstance().DoSaveAppState(reason, ability); }; -- Gitee