From ca1d18baecc71b9b7e25ec7607b19d1605417ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=95=8F=E6=9D=B0?= Date: Fri, 6 Jun 2025 02:24:53 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 吴敏杰 --- .../native/source/system_ability_manager_proxy.cpp | 3 ++- .../schedule/system_ability_state_scheduler.cpp | 4 ++-- .../samgr/native/source/system_ability_manager.cpp | 4 ++-- .../unittest/src/system_ability_mgr_util_test.cpp | 13 ++++++------- .../src/system_ability_state_scheduler_test.cpp | 1 - 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/frameworks/native/source/system_ability_manager_proxy.cpp b/frameworks/native/source/system_ability_manager_proxy.cpp index 7be2e6c8..abd76e4a 100644 --- a/frameworks/native/source/system_ability_manager_proxy.cpp +++ b/frameworks/native/source/system_ability_manager_proxy.cpp @@ -890,7 +890,8 @@ int32_t SystemAbilityManagerProxy::GetLruIdleSystemAbilityProc(std::vectorSendRequest( - static_cast(SamgrInterfaceCode::GET_LRU_IDLE_SYSTEM_ABILITY_PROCESS_TRANSACTION), data, reply, option); + static_cast(SamgrInterfaceCode::GET_LRU_IDLE_SYSTEM_ABILITY_PROCESS_TRANSACTION), + data, reply, option); if (err != ERR_NONE) { HILOGE("GetLruIdleSystempAbilityProc SendRequest error:%{public}d", err); return err; diff --git a/services/samgr/native/source/schedule/system_ability_state_scheduler.cpp b/services/samgr/native/source/schedule/system_ability_state_scheduler.cpp index 62071a78..d7bdd978 100644 --- a/services/samgr/native/source/schedule/system_ability_state_scheduler.cpp +++ b/services/samgr/native/source/schedule/system_ability_state_scheduler.cpp @@ -1432,8 +1432,8 @@ int64_t SystemAbilityStateScheduler::GetSystemAbilityIdleTime(int32_t systemAbil return abilityContext->lastIdleTime; } -bool SystemAbilityStateScheduler::GetLruIdleSystemAbilityInfo(int32_t systemAbilityId, std::u16string& processName, int64_t& lastStopTime, - int32_t& pid) +bool SystemAbilityStateScheduler::GetLruIdleSystemAbilityInfo(int32_t systemAbilityId, + std::u16string& processName, int64_t& lastStopTime, int32_t& pid) { std::shared_ptr abilityContext; if (!GetSystemAbilityContext(systemAbilityId, abilityContext)) { diff --git a/services/samgr/native/source/system_ability_manager.cpp b/services/samgr/native/source/system_ability_manager.cpp index d49bf9fb..4dc5a7c9 100644 --- a/services/samgr/native/source/system_ability_manager.cpp +++ b/services/samgr/native/source/system_ability_manager.cpp @@ -84,7 +84,7 @@ constexpr int64_t CHECK_LOADED_DELAY_TIME = 4 * 1000; // ms #endif constexpr int32_t SOFTBUS_SERVER_SA_ID = 4700; constexpr int32_t FIRST_DUMP_INDEX = 0; -constexpr int64_t TWO_MINUTES_SECONDS = 120 *1000; // ms +constexpr int64_t TWO_MINUTES_SECONDS = 120 * 1000; // ms } std::mutex SystemAbilityManager::instanceLock; @@ -1783,7 +1783,7 @@ int32_t SystemAbilityManager::GetLruIdleSystemAbilityProc(std::vector mockDirFiles; void InitSaMgr(sptr& saMgr) @@ -64,7 +63,7 @@ void GetDirFiles(const char* path, std::vector& files) CfgFiles* GetCfgFiles(const char* path) { - return mockCfgFiles; + return g_mockCfgFiles; } void SamgrUtilTest::SetUpTestCase() @@ -82,7 +81,7 @@ void SamgrUtilTest::SetUp() SamMockPermission::MockPermission(); system::mockValue = ""; mockDirFiles.clear(); - mockCfgFiles = nullptr; + g_g_mockCfgFiles = nullptr; DTEST_LOG << "SetUp" << std::endl; } @@ -434,12 +433,12 @@ HWTEST_F(SamgrUtilTest, TestGetFilesByPriority001, TestSize.Level3) HWTEST_F(SamgrUtilTest, TestGetFilesByPriority002, TestSize.Level3) { system::mockValue = ""; - mockCfgFiles = new CfgFiles(); + g_mockCfgFiles = new CfgFiles(); std::vector result; SamgrUtil::GetFilesByPriority("test_path", result); ASSERT_TRUE(result.empty()); - delete mockCfgFiles; + delete g_mockCfgFiles; } } \ No newline at end of file diff --git a/services/samgr/native/test/unittest/src/system_ability_state_scheduler_test.cpp b/services/samgr/native/test/unittest/src/system_ability_state_scheduler_test.cpp index 7f6ae4de..40028c9a 100644 --- a/services/samgr/native/test/unittest/src/system_ability_state_scheduler_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_state_scheduler_test.cpp @@ -1941,7 +1941,6 @@ HWTEST_F(SystemAbilityStateSchedulerTest, GetLruIdleSystemAbilityInfo001, TestSi bool ret = systemAbilityStateScheduler->GetLruIdleSystemAbilityInfo(invalidSaid, processName, lastStopTime, pid); EXPECT_EQ(ret, false); DTEST_LOG<<"GetLruIdleSystemAbilityInfo001 END"< Date: Fri, 6 Jun 2025 02:44:43 +0000 Subject: [PATCH 2/2] update services/samgr/native/test/unittest/src/system_ability_mgr_util_test.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 吴敏杰 --- .../native/test/unittest/src/system_ability_mgr_util_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/samgr/native/test/unittest/src/system_ability_mgr_util_test.cpp b/services/samgr/native/test/unittest/src/system_ability_mgr_util_test.cpp index ff0a74c3..8d5201a0 100644 --- a/services/samgr/native/test/unittest/src/system_ability_mgr_util_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_mgr_util_test.cpp @@ -81,7 +81,7 @@ void SamgrUtilTest::SetUp() SamMockPermission::MockPermission(); system::mockValue = ""; mockDirFiles.clear(); - g_g_mockCfgFiles = nullptr; + g_mockCfgFiles = nullptr; DTEST_LOG << "SetUp" << std::endl; } -- Gitee