From 1536a77d27612ccf526ca5e825a765af51ef445a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=98=89=E5=AE=9D?= Date: Wed, 11 Jun 2025 16:40:58 +0800 Subject: [PATCH 1/6] modify utimer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄嘉宝 --- services/samgr/native/source/collect/ref_count_collect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/samgr/native/source/collect/ref_count_collect.cpp b/services/samgr/native/source/collect/ref_count_collect.cpp index 2062fbbf..1372a612 100644 --- a/services/samgr/native/source/collect/ref_count_collect.cpp +++ b/services/samgr/native/source/collect/ref_count_collect.cpp @@ -40,7 +40,7 @@ void RefCountCollect::Init(const std::list& saProfiles) int32_t RefCountCollect::OnStart() { uint32_t timerId = 0; - timer_ = std::make_unique("RefCountCollectTimer"); + timer_ = std::make_unique("RefCountCollectTimer", -1); timer_->Setup(); if (!residentSaList_.empty()) { -- Gitee From 48984c46f078d7f70d2b3d9640a2ce779f1e027c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=98=89=E5=AE=9D?= Date: Wed, 11 Jun 2025 16:41:11 +0800 Subject: [PATCH 2/6] modify utimer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄嘉宝 --- services/samgr/native/source/system_ability_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/samgr/native/source/system_ability_manager.cpp b/services/samgr/native/source/system_ability_manager.cpp index 4dc5a7c9..24a0cad9 100644 --- a/services/samgr/native/source/system_ability_manager.cpp +++ b/services/samgr/native/source/system_ability_manager.cpp @@ -170,7 +170,7 @@ void SystemAbilityManager::Init() collectManager_ = sptr(new DeviceStatusCollectManager()); abilityStateScheduler_ = std::make_shared(); InitSaProfile(); - reportEventTimer_ = std::make_unique("DfxReporter"); + reportEventTimer_ = std::make_unique("DfxReporter", -1); OndemandLoadForPerf(); SetKey(DYNAMIC_CACHE_PARAM); SamgrUtil::InvalidateSACache(); -- Gitee From 734c4a615d0f9cab860de7a592465a0387977a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=98=89=E5=AE=9D?= Date: Thu, 12 Jun 2025 10:48:36 +0800 Subject: [PATCH 3/6] commit msg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄嘉宝 --- .../samgr/native/test/unittest/src/ref_count_collect_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp b/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp index e505408c..d888ed58 100644 --- a/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp +++ b/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp @@ -175,7 +175,7 @@ HWTEST_F(RefCountCollectTest, IdentifyUnrefOndemand001, TestSize.Level1) sptr manager = new DeviceStatusCollectManager(); std::shared_ptr statuCollect = std::make_shared(manager); uint32_t timerId = 0; - statuCollect->timer_ = std::make_unique("refCountCollectTimer"); + statuCollect->timer_ = std::make_unique("refCountCollectTimer", -1); statuCollect->timer_->Setup(); statuCollect->unrefUnloadSaList_.push_back(1); timerId = statuCollect->timer_->Register(std::bind(&RefCountCollect::IdentifyUnrefOndemand, statuCollect), -- Gitee From da60c7825c7ff871273af9a26c2484c568488f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=98=89=E5=AE=9D?= Date: Mon, 16 Jun 2025 10:59:39 +0800 Subject: [PATCH 4/6] commit msg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄嘉宝 --- .../unittest/include/ref_count_collect_test.h | 1 - .../unittest/src/ref_count_collect_test.cpp | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/services/samgr/native/test/unittest/include/ref_count_collect_test.h b/services/samgr/native/test/unittest/include/ref_count_collect_test.h index c85bb686..646ffc01 100644 --- a/services/samgr/native/test/unittest/include/ref_count_collect_test.h +++ b/services/samgr/native/test/unittest/include/ref_count_collect_test.h @@ -26,7 +26,6 @@ protected: static void TearDownTestCase(); void SetUp(); void TearDown(); - std::shared_ptr collect; }; } // namespace OHOS #endif /* SAMGR_TEST_UNITTEST_REF_COUNT_COLLECT_TEST_H */ \ No newline at end of file diff --git a/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp b/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp index d888ed58..704ade42 100644 --- a/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp +++ b/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp @@ -34,8 +34,6 @@ void RefCountCollectTest::TearDownTestCase() void RefCountCollectTest::SetUp() { - sptr manager = new DeviceStatusCollectManager(); - collect = std::make_shared(manager); DTEST_LOG << "SetUp" << std::endl; } @@ -51,6 +49,8 @@ void RefCountCollectTest::TearDown() */ HWTEST_F(RefCountCollectTest, Init001, TestSize.Level1) { + sptr manager = new DeviceStatusCollectManager(); + sptr collect = new RefCountCollect(manager); std::list saProfiles; { SaProfile saProfile; @@ -76,6 +76,8 @@ HWTEST_F(RefCountCollectTest, Init001, TestSize.Level1) */ HWTEST_F(RefCountCollectTest, Init002, TestSize.Level1) { + sptr manager = new DeviceStatusCollectManager(); + sptr collect = new RefCountCollect(manager); std::list saProfiles; { SaProfile saProfile; @@ -101,6 +103,8 @@ HWTEST_F(RefCountCollectTest, Init002, TestSize.Level1) */ HWTEST_F(RefCountCollectTest, Init003, TestSize.Level1) { + sptr manager = new DeviceStatusCollectManager(); + sptr collect = new RefCountCollect(manager); std::list saProfiles; SaProfile saProfile; saProfile.saId = 1; @@ -120,6 +124,8 @@ HWTEST_F(RefCountCollectTest, Init003, TestSize.Level1) */ HWTEST_F(RefCountCollectTest, OnStart001, TestSize.Level1) { + sptr manager = new DeviceStatusCollectManager(); + sptr collect = new RefCountCollect(manager); collect->residentSaList_.push_back(1); auto ret = collect->OnStart(); EXPECT_EQ(ret, ERR_OK); @@ -134,6 +140,8 @@ HWTEST_F(RefCountCollectTest, OnStart001, TestSize.Level1) */ HWTEST_F(RefCountCollectTest, OnStart002, TestSize.Level1) { + sptr manager = new DeviceStatusCollectManager(); + sptr collect = new RefCountCollect(manager); collect->residentSaList_.clear(); collect->unrefUnloadSaList_.push_back(1); auto ret = collect->OnStart(); @@ -149,6 +157,8 @@ HWTEST_F(RefCountCollectTest, OnStart002, TestSize.Level1) */ HWTEST_F(RefCountCollectTest, OnStart003, TestSize.Level1) { + sptr manager = new DeviceStatusCollectManager(); + sptr collect = new RefCountCollect(manager); collect->residentSaList_.clear(); collect->unrefUnloadSaList_.clear(); auto ret = collect->OnStart(); @@ -173,9 +183,9 @@ HWTEST_F(RefCountCollectTest, IdentifyUnrefOndemand001, TestSize.Level1) { DTEST_LOG<<"IdentifyUnrefOndemand001 BEGIN"< manager = new DeviceStatusCollectManager(); - std::shared_ptr statuCollect = std::make_shared(manager); + sptr collect = new RefCountCollect(manager); uint32_t timerId = 0; - statuCollect->timer_ = std::make_unique("refCountCollectTimer", -1); + statuCollect->timer_ = std::make_unique("refCountCollectTimer"); statuCollect->timer_->Setup(); statuCollect->unrefUnloadSaList_.push_back(1); timerId = statuCollect->timer_->Register(std::bind(&RefCountCollect::IdentifyUnrefOndemand, statuCollect), -- Gitee From 2106d52ea7973aff085e2ad44f92401a6b5619b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=98=89=E5=AE=9D?= Date: Mon, 16 Jun 2025 11:01:46 +0800 Subject: [PATCH 5/6] commit msg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄嘉宝 --- .../samgr/native/test/unittest/src/ref_count_collect_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp b/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp index 704ade42..53c56857 100644 --- a/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp +++ b/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp @@ -174,6 +174,8 @@ HWTEST_F(RefCountCollectTest, OnStart003, TestSize.Level1) */ HWTEST_F(RefCountCollectTest, OnStop001, TestSize.Level1) { + sptr manager = new DeviceStatusCollectManager(); + sptr collect = new RefCountCollect(manager); collect->timer_ = nullptr; auto ret = collect->OnStop(); EXPECT_EQ(ret, ERR_OK); -- Gitee From 195ad703c1e543fb43895782df183876ad451526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=98=89=E5=AE=9D?= Date: Mon, 16 Jun 2025 11:53:28 +0800 Subject: [PATCH 6/6] commit msg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄嘉宝 --- .../samgr/native/test/unittest/src/ref_count_collect_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp b/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp index 53c56857..77e3d153 100644 --- a/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp +++ b/services/samgr/native/test/unittest/src/ref_count_collect_test.cpp @@ -185,7 +185,7 @@ HWTEST_F(RefCountCollectTest, IdentifyUnrefOndemand001, TestSize.Level1) { DTEST_LOG<<"IdentifyUnrefOndemand001 BEGIN"< manager = new DeviceStatusCollectManager(); - sptr collect = new RefCountCollect(manager); + sptr statuCollect = new RefCountCollect(manager); uint32_t timerId = 0; statuCollect->timer_ = std::make_unique("refCountCollectTimer"); statuCollect->timer_->Setup(); -- Gitee