From b9c9d354d05998421e25060f566db7d896bcacf7 Mon Sep 17 00:00:00 2001 From: cs1111 Date: Mon, 8 Sep 2025 20:22:52 +0800 Subject: [PATCH] feature:async stack open normally Signed-off-by: cs1111 Change-Id: I9de5482b742da5b4f02dc6c5949f01686054d98e --- frameworks/native/appkit/app/main_thread.cpp | 15 +++++++-------- frameworks/native/appkit/dfr/watchdog.cpp | 4 ++-- interfaces/kits/native/appkit/dfr/watchdog.h | 3 ++- .../dfr_test/watchdog_test/watchdog_test.cpp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/frameworks/native/appkit/app/main_thread.cpp b/frameworks/native/appkit/app/main_thread.cpp index 0c3a5a2a723..e9d156d4feb 100644 --- a/frameworks/native/appkit/app/main_thread.cpp +++ b/frameworks/native/appkit/app/main_thread.cpp @@ -1500,18 +1500,18 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con TAG_LOGE(AAFwkTag::APPKIT, "null bundleMgrHelper"); return; } - - auto bundleName = appInfo.bundleName; - auto tmpWatchdog = watchdog_; - if (tmpWatchdog != nullptr) { - tmpWatchdog->SetBundleInfo(bundleName, appInfo.versionName); - tmpWatchdog = nullptr; - } BundleInfo bundleInfo; + auto bundleName = appInfo.bundleName; if (!GetBundleForLaunchApplication(bundleMgrHelper, bundleName, appLaunchData.GetAppIndex(), bundleInfo)) { TAG_LOGE(AAFwkTag::APPKIT, "get bundleInfo failed"); return; } + auto tmpWatchdog = watchdog_; + bool isSystemApp = bundleInfo.applicationInfo.isSystemApp; + if (tmpWatchdog != nullptr) { + tmpWatchdog->SetBundleInfo(bundleName, appInfo.versionName, isSystemApp); + tmpWatchdog = nullptr; + } bool moduelJson = false; bool isStageBased = false; @@ -1639,7 +1639,6 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con } GetNativeLibPath(bundleInfo, hspList, appLibPaths); - bool isSystemApp = bundleInfo.applicationInfo.isSystemApp; TAG_LOGD(AAFwkTag::APPKIT, "the application isSystemApp: %{public}d", isSystemApp); #ifdef CJ_FRONTEND AbilityRuntime::CJRuntime::SetAppVersion(bundleInfo.applicationInfo.compileSdkVersion); diff --git a/frameworks/native/appkit/dfr/watchdog.cpp b/frameworks/native/appkit/dfr/watchdog.cpp index 8026e3370c3..06904b3e258 100644 --- a/frameworks/native/appkit/dfr/watchdog.cpp +++ b/frameworks/native/appkit/dfr/watchdog.cpp @@ -163,9 +163,9 @@ void Watchdog::ChangeTimeOut(const std::string& bundleName) } #endif -void Watchdog::SetBundleInfo(const std::string& bundleName, const std::string& bundleVersion) +void Watchdog::SetBundleInfo(const std::string& bundleName, const std::string& bundleVersion, bool isSystemApp) { - OHOS::HiviewDFX::Watchdog::GetInstance().SetBundleInfo(bundleName, bundleVersion); + OHOS::HiviewDFX::Watchdog::GetInstance().SetBundleInfo(bundleName, bundleVersion, isSystemApp); #ifdef APP_NO_RESPONSE_DIALOG if (isDeviceType2in1()) { ChangeTimeOut(bundleName); diff --git a/interfaces/kits/native/appkit/dfr/watchdog.h b/interfaces/kits/native/appkit/dfr/watchdog.h index 438d2cd6d5b..211e6a242e9 100644 --- a/interfaces/kits/native/appkit/dfr/watchdog.h +++ b/interfaces/kits/native/appkit/dfr/watchdog.h @@ -98,7 +98,7 @@ public: * @brief Set bundle info. * */ - void SetBundleInfo(const std::string& bundleName, const std::string& bundleVersion); + void SetBundleInfo(const std::string& bundleName, const std::string& bundleVersion, bool isSystemApp); /** * @@ -130,6 +130,7 @@ private: static std::shared_ptr appMainHandler_; int64_t lastWatchTime_ = 0; std::string bundleName_; + bool isSystemApp_ = true; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/dfr_test/watchdog_test/watchdog_test.cpp b/test/unittest/dfr_test/watchdog_test/watchdog_test.cpp index 74b27923f73..00729625e91 100644 --- a/test/unittest/dfr_test/watchdog_test/watchdog_test.cpp +++ b/test/unittest/dfr_test/watchdog_test/watchdog_test.cpp @@ -493,7 +493,7 @@ HWTEST_F(WatchdogTest, WatchdogTest_ReportEvent_009, TestSize.Level1) system_clock::now().time_since_epoch()).count() - TEST_INTERVAL_TIME; watchdog_->isInBackground_ = true; watchdog_->ReportEvent(); - watchdog_->SetBundleInfo("test", "1.1.0"); + watchdog_->SetBundleInfo("test", "1.1.0", true); watchdog_->SetBgWorkingThreadStatus(false); } -- Gitee