From 212e2d016b31ce4b8091871ec59590bea1416406 Mon Sep 17 00:00:00 2001 From: wuminjie Date: Thu, 7 Aug 2025 21:25:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=B7=AE=E5=BC=82?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuminjie --- bundle.json | 5 +-- interfaces/innerkits/rust/tests/BUILD.gn | 2 +- .../include/if_system_ability_manager.h | 14 ++----- .../include/isystem_ability_status_change.h | 5 +++ .../samgr_proxy/libsamgr_proxy.versionscript | 2 +- services/dfx/source/hisysevent_adapter.cpp | 2 +- .../schedule/system_ability_state_scheduler.h | 7 ++-- .../include/system_ability_manager_stub.h | 2 +- .../include/system_ability_manager_util.h | 4 +- .../system_ability_state_scheduler.cpp | 34 ++++++---------- .../native/source/system_ability_manager.cpp | 26 +++++++++---- .../source/system_ability_manager_stub.cpp | 10 ++--- .../source/system_ability_manager_util.cpp | 15 +++---- .../src/common_event_collect_test.cpp | 3 -- .../src/device_networking_collect_test.cpp | 1 - .../device_status_collect_manager_test.cpp | 1 - .../src/mock_penglai_service_client.cpp | 37 ------------------ .../src/system_ability_mgr_load_test.cpp | 1 + .../src/system_ability_mgr_new_test.cpp | 8 +++- .../src/system_ability_mgr_proxy_test.cpp | 10 +++++ .../src/system_ability_mgr_stub_load_test.cpp | 11 ------ .../src/system_ability_mgr_stub_test.cpp | 36 +++++++++++++---- .../unittest/src/system_ability_mgr_test.cpp | 2 +- .../src/system_ability_mgr_util_test.cpp | 39 ++++++++++++++++--- ...stem_ability_state_scheduler_proc_test.cpp | 11 ------ services/samgr/var.gni | 2 +- test/fuzztest/samgr_fuzzer/BUILD.gn | 2 - test/fuzztest/samgrcoverage_fuzzer/BUILD.gn | 2 - test/fuzztest/samgrdumper_fuzzer/BUILD.gn | 2 - .../systemabilitymanager_fuzzer/BUILD.gn | 2 - 30 files changed, 142 insertions(+), 156 deletions(-) delete mode 100644 services/samgr/native/test/unittest/src/mock_penglai_service_client.cpp diff --git a/bundle.json b/bundle.json index e83679d2..ca353215 100644 --- a/bundle.json +++ b/bundle.json @@ -35,8 +35,6 @@ "c_utils", "common_event_service", "device_manager", - "dsoftbus", - "eventhandler", "ffrt", "hicollie", "hilog", @@ -47,11 +45,10 @@ "json", "libxml2", "preferences", - "rust_cxx", "safwk", "selinux_adapter", "config_policy", - "ylong_runtime" + "rust_cxx" ] }, "build": { diff --git a/interfaces/innerkits/rust/tests/BUILD.gn b/interfaces/innerkits/rust/tests/BUILD.gn index 8746daed..ed4d31d2 100644 --- a/interfaces/innerkits/rust/tests/BUILD.gn +++ b/interfaces/innerkits/rust/tests/BUILD.gn @@ -69,8 +69,8 @@ ohos_rust_systemtest("rust_samgr_sdv_test") { external_deps = [ "hilog:hilog_rust", "ipc:ipc_rust", - "safwk:system_ability_fwk_rust", "rust_cxx:lib" + "safwk:system_ability_fwk_rust", ] defines = [] if (samgr_support_access_token) { diff --git a/interfaces/innerkits/samgr_proxy/include/if_system_ability_manager.h b/interfaces/innerkits/samgr_proxy/include/if_system_ability_manager.h index e794e80b..df81f033 100644 --- a/interfaces/innerkits/samgr_proxy/include/if_system_ability_manager.h +++ b/interfaces/innerkits/samgr_proxy/include/if_system_ability_manager.h @@ -29,13 +29,6 @@ #include "system_ability_on_demand_event.h" namespace OHOS { - -struct IdleProcessInfo { - int32_t pid = -1; - std::u16string processName; - int64_t lastIdleTime = 0; -}; - class ISystemAbilityManager : public IRemoteBroker { public: /** @@ -238,8 +231,7 @@ public: * UnloadProcess, unload process by process name list. * only support for memmgrservice * - * @param processList, Need a processList to unload. - * @return ERR_OK It means unload process in processList success. + * @return ERR_OK It means unload all process in list. */ virtual int32_t UnloadProcess(const std::vector& processList) { @@ -248,10 +240,10 @@ public: } /** - * GetLruIdleSystemAbilityProc, Get idle process info list. + * GetSystemProcessInfo, Get idle process info by said. * only support for memmgrservice * - * @param processInfos, Issue a parameter and return it as a result. + * @param processList, Issue a parameter and return it as a result. * @return ERR_OK indicates that the get successfully. */ virtual int32_t GetLruIdleSystemAbilityProc(std::vector& processInfos) diff --git a/interfaces/innerkits/samgr_proxy/include/isystem_ability_status_change.h b/interfaces/innerkits/samgr_proxy/include/isystem_ability_status_change.h index d0691d80..270fdb7b 100644 --- a/interfaces/innerkits/samgr_proxy/include/isystem_ability_status_change.h +++ b/interfaces/innerkits/samgr_proxy/include/isystem_ability_status_change.h @@ -21,6 +21,11 @@ #include "iremote_proxy.h" namespace OHOS { +struct IdleProcessInfo { + int32_t pid = -1; + std::u16string processName; + int64_t lastIdleTime = 0; +}; class ISystemAbilityStatusChange : public IRemoteBroker { public: diff --git a/interfaces/innerkits/samgr_proxy/libsamgr_proxy.versionscript b/interfaces/innerkits/samgr_proxy/libsamgr_proxy.versionscript index 22aa551d..d79a7e9a 100644 --- a/interfaces/innerkits/samgr_proxy/libsamgr_proxy.versionscript +++ b/interfaces/innerkits/samgr_proxy/libsamgr_proxy.versionscript @@ -33,7 +33,7 @@ *LocalAbilityManagerProxy*; *WriteOnDemandEventsToParcel*; *ReadOnDemandEventsFromParcel*; - *GetLocalAbilitymanagerProxy*; + *GetLocalAbilityManagerProxy*; local: *; }; diff --git a/services/dfx/source/hisysevent_adapter.cpp b/services/dfx/source/hisysevent_adapter.cpp index 72c3629a..c4f0e3f0 100644 --- a/services/dfx/source/hisysevent_adapter.cpp +++ b/services/dfx/source/hisysevent_adapter.cpp @@ -62,7 +62,7 @@ constexpr int32_t CONTAINER_SA_MAX = 0x0001055f; //66911 static bool IsInCrashWhiteList(int32_t saId) { std::vector whiteList = { 1205, 1213, 1215, 9999, 65537, 65830, - 65850, 66064, 69930, 131071, 345135 }; + 65850, 65888, 69930, 131071, 345135 }; for (auto sa : whiteList) { if (saId == sa) { return true; diff --git a/services/samgr/native/include/schedule/system_ability_state_scheduler.h b/services/samgr/native/include/schedule/system_ability_state_scheduler.h index 6a727747..d17ec6d8 100644 --- a/services/samgr/native/include/schedule/system_ability_state_scheduler.h +++ b/services/samgr/native/include/schedule/system_ability_state_scheduler.h @@ -22,7 +22,6 @@ #include "ffrt_handler.h" #include "isystem_process_status_change.h" -#include "if_system_ability_manager.h" #include "nlohmann/json.hpp" #include "sa_profiles.h" #include "schedule/system_ability_event_handler.h" @@ -71,8 +70,10 @@ public: int32_t CheckStopEnableOnce(const OnDemandEvent& event, const SaControlInfo& saControl); void UpdateLimitDelayUnloadTime(int32_t systemAbilityId); void UpdateLimitDelayUnloadTimeTask(int32_t systemAbilityId); - bool GetIdleProcessInfo(int32_t systemAbilityId, IdleProcessInfo& idleProcessInfo); - bool IsSystemProcessCanUnload(const std::u16string& processName); + int64_t GetSystemAbilityIdleTime(int32_t systemAbilityId); + bool GetSystemAbilityIdleTime(int32_t systemAbilityId); + bool GetLruIdleSystemAbilityInfo(int32_t systemAbilityId , std::u16string& processName, int64_t& lastStopTime, + int32_t& pid); private: void InitStateContext(const std::list& saProfiles); diff --git a/services/samgr/native/include/system_ability_manager_stub.h b/services/samgr/native/include/system_ability_manager_stub.h index 92187c64..25508b3c 100644 --- a/services/samgr/native/include/system_ability_manager_stub.h +++ b/services/samgr/native/include/system_ability_manager_stub.h @@ -228,7 +228,7 @@ private: int32_t GetCommonEventExtraDataIdlistInner(MessageParcel& data, MessageParcel& reply); int32_t GetLocalAbilityManagerProxyInner(MessageParcel& data, MessageParcel& reply); static int32_t GetHapIdMultiuser(int32_t uid); -#ifdef SUPPORT_PENGLAT_MODE +#ifdef SUPPORT_PENGLAI_MODE void SetPengLai(bool isPengLai); bool isPengLai_ = false; #endif diff --git a/services/samgr/native/include/system_ability_manager_util.h b/services/samgr/native/include/system_ability_manager_util.h index 938b7ac0..df8855d5 100644 --- a/services/samgr/native/include/system_ability_manager_util.h +++ b/services/samgr/native/include/system_ability_manager_util.h @@ -48,13 +48,13 @@ public: static void InvalidateSACache(); static void FilterCommonSaProfile(const SaProfile& oldProfile, CommonSaProfile& newProfile); static bool CheckPengLai(); -#ifdef SUPPORT_PENGLAT_MODE +#ifdef SUPPORT_PENGLAI_MODE static bool CheckPengLaiPermission(int32_t systemAbilityId); #endif static void GetFilesByPriority(const std::string& path, std::vector& files); static void GetFilesFromPath(const std::string& path, std::map& fileNamesMap); private: -#ifdef SUPPORT_PENGLAT_MODE +#ifdef SUPPORT_PENGLAI_MODE static void* InitPenglaiFunc(); static void* penglaiFunc_; #endif 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 f0662a55..db8c03be 100644 --- a/services/samgr/native/source/schedule/system_ability_state_scheduler.cpp +++ b/services/samgr/native/source/schedule/system_ability_state_scheduler.cpp @@ -41,7 +41,6 @@ constexpr const char* LOCAL_DEVICE = "local"; constexpr int32_t MAX_DELAY_TIME = 5 * 60 * 1000; constexpr int32_t MAX_DURATION = 10 * 60 * 1000; // ms constexpr int32_t ONCE_DELAY_TIME = 10 * 1000; // ms -constexpr int64_t TWO_MINUTES_MS = 120 * 1000; // ms constexpr const char* CANCEL_UNLOAD = "cancelUnload"; constexpr const char* KEY_EVENT_ID = "eventId"; constexpr const char* KEY_NAME = "name"; @@ -1423,37 +1422,28 @@ int32_t SystemAbilityStateScheduler::CheckStopEnableOnce(const OnDemandEvent& ev return result; } -bool SystemAbilityStateScheduler::GetIdleProcessInfo(int32_t systemAbilityId, IdleProcessInfo& idleProcessInfo) +int64_t SystemAbilityStateScheduler::GetSystemAbilityIdleTime(int32_t systemAbilityId) { std::shared_ptr abilityContext; if (!GetSystemAbilityContext(systemAbilityId, abilityContext)) { - return false; + return -1; } std::lock_guard autoLock(abilityContext->ownProcessContext->processLock); - if (abilityContext->state != SystemAbilityState::UNLOADABLE || - abilityContext->ownProcessContext->state == SystemProcessState::NOT_STARTED) { - HILOGD("GetIdleProcessInfo SA:%{public}d state not idle or proc not started", systemAbilityId); - return false; - } - int64_t lastStopTime = abilityContext->ownProcessContext->lastStopTime; - if (lastStopTime != -1 && (GetTickCount() - lastStopTime < TWO_MINUTES_MS)) { - HILOGD("GetIdleProcessInfo SA:%{public}d lastStopTime less than 2 min", systemAbilityId); - return false; - } - idleProcessInfo.processName = abilityContext->ownProcessContext->processName; - idleProcessInfo.pid = abilityContext->ownProcessContext->pid; - idleProcessInfo.lastIdleTime = abilityContext->lastIdleTime; - return true; + return abilityContext->lastIdleTime; } -bool SystemAbilityStateScheduler::IsSystemProcessCanUnload(const std::u16string& processName) +bool SystemAbilityStateScheduler::GetLruIdleSystemAbilityInfo(int32_t systemAbilityId, std::u16string& processName, + int64_t& lastStopTime, int32_t& pid) { - std::shared_ptr processContext; - if (!GetSystemProcessContext(processName, processContext)) { + std::shared_ptr abilityContext; + if (!GetSystemAbilityContext(systemAbilityId, abilityContext)) { return false; } - std::lock_guard autoLock(processContext->processLock); - return CanUnloadAllSystemAbilityLocked(processContext); + std::lock_guard autoLock(abilityContext->ownProcessContext->processLock); + processName = abilityContext->ownProcessContext->processName; + pid = abilityContext->ownProcessContext->pid; + lastStopTime = abilityContext->ownProcessContext->lastStopTime; + return true; } void SystemAbilityStateScheduler::UnloadEventHandler::ProcessEvent(uint32_t eventId) diff --git a/services/samgr/native/source/system_ability_manager.cpp b/services/samgr/native/source/system_ability_manager.cpp index 4ec3f076..97b6c736 100644 --- a/services/samgr/native/source/system_ability_manager.cpp +++ b/services/samgr/native/source/system_ability_manager.cpp @@ -84,6 +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 } samgr::mutex SystemAbilityManager::instanceLock; @@ -1049,6 +1050,11 @@ int32_t SystemAbilityManager::AddSystemAbility(int32_t systemAbilityId, const sp return ERR_INVALID_VALUE; } RefreshListenerState(systemAbilityId); + if (extraProp.isDistributed != IsDistributedSystemAbility(systemAbilityId)) { + HILOGE("SA:%{public}d extraProp isDistributed:%{public}d different from saProfile", systemAbilityId, + extraProp.isDistributed); + return ERR_INVALID_VALUE; + } { unique_lock writeLock(abilityMapLock_); auto saSize = abilityMap_.size(); @@ -1056,11 +1062,6 @@ int32_t SystemAbilityManager::AddSystemAbility(int32_t systemAbilityId, const sp HILOGE("map size error, (Has been greater than %zu)", saSize); return ERR_INVALID_VALUE; } - if (extraProp.isDistributed != IsDistributedSystemAbility(systemAbilityId)) { - HILOGE("SA:%{public}d extraProp isDistributed:%{public}d different from saProfile", systemAbilityId, - extraProp.isDistributed); - return ERR_INVALID_VALUE; - } SAInfo saInfo = { ability, extraProp.isDistributed, extraProp.capability, Str16ToStr8(extraProp.permission) }; if (abilityMap_.count(systemAbilityId) > 0) { SystemAbilityInvalidateCache(systemAbilityId); @@ -1747,9 +1748,19 @@ int32_t SystemAbilityManager::GetLruIdleSystemAbilityProc(std::vector saIds = collectManager_->GetLowMemPrepareList(); std::map procInfos; + std::set activeProcess; for (const auto& saId : saIds) { IdleProcessInfo info; - if (!abilityStateScheduler_->GetIdleProcessInfo(saId, info)) { + int64_t lastStopTime = -1; + if (!abilityStateScheduler_->GetLruIdleSystemAbilityInfo(saId, info.processName, lastStopTime, info.pid)) { + continue; + } + info.lastIdleTime = abilityStateScheduler_->GetSystemAbilityIdleTime(saId); + if (info.lastIdleTime < 0) { + activeProcess.insert(info.processName); + continue; + } + if (lastStopTime != -1 && (GetTickCount() - lastStopTime < TWO_MINUTES_SECONDS)) { continue; } auto procInfo = procInfos.find(info.processName); @@ -1760,9 +1771,8 @@ int32_t SystemAbilityManager::GetLruIdleSystemAbilityProc(std::vectorIsSystemProcessCanUnload(pair.first)) { + if (activeProcess.find(pair.first) == activeProcess.end()) { processInfos.push_back(pair.second); - HILOGD("GetLruIdle processName:%{public}s", Str16ToStr8(pair.first).c_str()); } } std::sort(processInfos.begin(), processInfos.end(), [](const IdleProcessInfo& a, IdleProcessInfo& b) { diff --git a/services/samgr/native/source/system_ability_manager_stub.cpp b/services/samgr/native/source/system_ability_manager_stub.cpp index 46611c65..290377d5 100644 --- a/services/samgr/native/source/system_ability_manager_stub.cpp +++ b/services/samgr/native/source/system_ability_manager_stub.cpp @@ -124,7 +124,7 @@ const std::string EXT_TRANSACTION_PERMISSION = "ohos.permission.ACCESS_EXT_SYSTE const std::string PERMISSION_SVC = "ohos.permission.CONTROL_SVC_CMD"; } -#ifdef SUPPORT_PENGLAT_MODE +#ifdef SUPPORT_PENGLAI_MODE void SystemAbilityManagerStub::SetPengLai(bool isPengLai) { isPengLai_ = isPengLai; @@ -180,7 +180,7 @@ void SystemAbilityManagerStub::SetProcessFuncMap() SystemAbilityManagerStub::SystemAbilityManagerStub() { -#ifdef SUPPORT_PENGLAT_MODE +#ifdef SUPPORT_PENGLAI_MODE SetPengLai(SamgrUtil::CheckPengLai()); #endif SetAbilityFuncMap(); @@ -437,7 +437,7 @@ int32_t SystemAbilityManagerStub::CheckSystemAbilityImmeInner(MessageParcel& dat return ERR_NULL_OBJECT; } -#ifdef SUPPORT_PENGLAT_MODE +#ifdef SUPPORT_PENGLAI_MODE if (isPengLai_ && !SamgrUtil::CheckPengLaiPermission(systemAbilityId)) { HILOGW("CheckSAImme CheckPengLaiPermission denied! SA:%{public}d,callUid:%{public}d", systemAbilityId, OHOS::IPCSkeleton::GetCallingUid()); @@ -562,7 +562,7 @@ int32_t SystemAbilityManagerStub::GetSystemAbilityInner(MessageParcel& data, Mes return ERR_NULL_OBJECT; } -#ifdef SUPPORT_PENGLAT_MODE +#ifdef SUPPORT_PENGLAI_MODE if (isPengLai_ && !SamgrUtil::CheckPengLaiPermission(systemAbilityId)) { HILOGW("GetSA CheckPengLaiPermission denied! SA:%{public}d,callUid:%{public}d", systemAbilityId, OHOS::IPCSkeleton::GetCallingUid()); @@ -600,7 +600,7 @@ int32_t SystemAbilityManagerStub::CheckSystemAbilityInner(MessageParcel& data, M return ERR_NULL_OBJECT; } -#ifdef SUPPORT_PENGLAT_MODE +#ifdef SUPPORT_PENGLAI_MODE if (isPengLai_ && !SamgrUtil::CheckPengLaiPermission(systemAbilityId)) { HILOGW("CheckSA CheckPengLaiPermission denied! SA:%{public}d,callUid:%{public}d", systemAbilityId, OHOS::IPCSkeleton::GetCallingUid()); diff --git a/services/samgr/native/source/system_ability_manager_util.cpp b/services/samgr/native/source/system_ability_manager_util.cpp index 1f0ad3ba..31ebd1e2 100644 --- a/services/samgr/native/source/system_ability_manager_util.cpp +++ b/services/samgr/native/source/system_ability_manager_util.cpp @@ -28,9 +28,9 @@ namespace OHOS { namespace fs = std::filesystem; using namespace std; #ifdef SUPPORT_PENGLAI_MODE -using PenglaiFunc = bool (*) (const int32_t, const int32_t); +using PenglaiFunc = bool (*)(const int32_t, const int32_t); constexpr const char* PENGLAI_SO_PATH = "libpenglai_client.z.so"; -constexpr const char* PENGLAT_SYM = "IsLaunchAllowedByUid"; +constexpr const char* PENGLAI_SYM = "IsLaunchAllowedByUid"; void* SamgrUtil::penglaiFunc_ = InitPenglaiFunc(); #endif constexpr int32_t MAX_NAME_SIZE = 200; @@ -261,23 +261,24 @@ void* SamgrUtil::InitPenglaiFunc() HILOGE("InitPenglaiFunc dlopen %{public}s so failed.", PENGLAI_SO_PATH); return nullptr; } - void* func = dlsym(handle, PENGLAT_SYM); + void* func = dlsym(handle, PENGLAI_SYM); if (func == nullptr) { - HILOGE("InitPenglaiFunc dlsym %{public}s symbol failed.", PENGLAT_SYM); + HILOGE("InitPenglaiFunc dlsym %{public}s symbol failed.", PENGLAI_SYM); dlclose(handle); return nullptr; } - HILOGI("InitPenglaiFunc success"); + HILOGI("InitPenglaiFunc success."); return func; } bool SamgrUtil::CheckPengLaiPermission(int32_t systemAbilityId) { auto callingUid = IPCSkeleton::GetCallingUid(); + if (penglaiFunc_ == nullptr) { return true; } - PenglaiFunc IsLaunchAllowedByUid = (PenglaiFunc)PenglaiFunc_; + PenglaiFunc IsLaunchAllowedByUid = (PenglaiFunc)penglaiFunc_; bool isAllow = IsLaunchAllowedByUid(callingUid, systemAbilityId); if (!isAllow) { HILOGE("IsLaunchAllowedByUid failed. callingUid:%{public}d, SA:%{public}d", callingUid, systemAbilityId); @@ -309,7 +310,7 @@ void SamgrUtil::GetFilesFromPath(const std::string& path, std::map& fileNames) { std::map fileNamesMap; - + GetFilesFromPath(path, fileNamesMap); if (SamgrUtil::CheckPengLai()) { diff --git a/services/samgr/native/test/unittest/src/common_event_collect_test.cpp b/services/samgr/native/test/unittest/src/common_event_collect_test.cpp index 3d8d9599..2a61f876 100644 --- a/services/samgr/native/test/unittest/src/common_event_collect_test.cpp +++ b/services/samgr/native/test/unittest/src/common_event_collect_test.cpp @@ -166,7 +166,6 @@ HWTEST_F(CommonEventCollectTest, ProcessEvent001, TestSize.Level3) EXPECT_EQ(true, ret); ret = commonEventCollect->workHandler_->SendEvent(COMMON_DIED_EVENT); EXPECT_EQ(true, ret); - commonEventCollect->workHandler_->CleanFfrt(); DTEST_LOG << " ProcessEvent001 END" << std::endl; } @@ -407,7 +406,6 @@ HWTEST_F(CommonEventCollectTest, RemoveOnDemandReasonExtraData001, TestSize.Leve commonEventCollect->SaveOnDemandReasonExtraData(eventData); commonEventCollect->RemoveOnDemandReasonExtraData(1); EXPECT_TRUE(commonEventCollect->extraDatas_.empty()); - commonEventCollect->workHandler_->CleanFfrt(); DTEST_LOG << "RemoveOnDemandReasonExtraData001 end" << std::endl; } @@ -448,7 +446,6 @@ HWTEST_F(CommonEventCollectTest, GetOnDemandReasonExtraData002, TestSize.Level3) commonEventCollect->SaveOnDemandReasonExtraData(eventData); bool ret = commonEventCollect->GetOnDemandReasonExtraData(1, onDemandReasonExtraData); EXPECT_TRUE(ret); - commonEventCollect->workHandler_->CleanFfrt(); DTEST_LOG << "GetOnDemandReasonExtraData002 end" << std::endl; } diff --git a/services/samgr/native/test/unittest/src/device_networking_collect_test.cpp b/services/samgr/native/test/unittest/src/device_networking_collect_test.cpp index ca2d55de..0656f2e0 100644 --- a/services/samgr/native/test/unittest/src/device_networking_collect_test.cpp +++ b/services/samgr/native/test/unittest/src/device_networking_collect_test.cpp @@ -681,7 +681,6 @@ HWTEST_F(DeviceNetworkingCollectTest, SendEvent001, TestSize.Level3) std::function callback = [] () {}; sptr collectOne = new DeviceNetworkingCollect(nullptr); collectOne->PostTask(callback); - networkingCollect->workHandler_->handler_ = std::make_shared("WorkHandler"); bool bRet = networkingCollect->workHandler_->SendEvent(DM_DIED_EVENT); EXPECT_EQ(true, bRet); diff --git a/services/samgr/native/test/unittest/src/device_status_collect_manager_test.cpp b/services/samgr/native/test/unittest/src/device_status_collect_manager_test.cpp index 1cadd123..89b11bee 100644 --- a/services/samgr/native/test/unittest/src/device_status_collect_manager_test.cpp +++ b/services/samgr/native/test/unittest/src/device_status_collect_manager_test.cpp @@ -531,7 +531,6 @@ HWTEST_F(DeviceStatusCollectManagerTest, ReportEvent003, TestSize.Level3) OnDemandEvent event = { DEVICE_ONLINE, SA_TAG_DEVICE_ON_LINE, "on" }; std::list saControlList; SaProfile saProfile; - collect->collectHandler_ = std::make_shared("collect"); OnDemandEvent event1 = { DEVICE_ONLINE, SA_TAG_DEVICE_ON_LINE, "on" }; OnDemandEvent event2 = { DEVICE_ONLINE, SA_TAG_DEVICE_ON_LINE, "off" }; saProfile.startOnDemand.onDemandEvents.emplace_back(event1); diff --git a/services/samgr/native/test/unittest/src/mock_penglai_service_client.cpp b/services/samgr/native/test/unittest/src/mock_penglai_service_client.cpp deleted file mode 100644 index dd4c6333..00000000 --- a/services/samgr/native/test/unittest/src/mock_penglai_service_client.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifdef SUPPORT_PENGLAI_MODE -#include "penglai_service_client.h" - -namespace OHOS { -namespace Penglai { - -bool permissionRet = true; -PenglaiServiceClient::PenglaiServiceClient() -{ -} - -PenglaiServiceClient::~PenglaiServiceClient() -{ -} - -bool PenglaiServiceClient::IsLaunchAllowedByUid(const int32_t &callerUid, const int32_t &systemAbilityId) -{ - return permissionRet; -} -} // namespace Penglai -} // namespace OHOS -#endif //SUPPORT_PENGLAI_MODE \ No newline at end of file diff --git a/services/samgr/native/test/unittest/src/system_ability_mgr_load_test.cpp b/services/samgr/native/test/unittest/src/system_ability_mgr_load_test.cpp index a9a10949..3007aeb1 100644 --- a/services/samgr/native/test/unittest/src/system_ability_mgr_load_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_mgr_load_test.cpp @@ -400,6 +400,7 @@ HWTEST_F(SystemAbilityMgrLoadTest, LoadRemoteSystemAbility001, TestSize.Level2) DTEST_LOG << "LoadRemoteSystemAbility001 begin" << std::endl; sptr saMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); EXPECT_TRUE(saMgr != nullptr); + EXPECT_TRUE(saMgr != nullptr); int32_t systemAbilityId = TEST_EXCEPTION_LOW_SA_ID; std::string deviceId = ""; int32_t result = saMgr->LoadSystemAbility(systemAbilityId, deviceId, nullptr); diff --git a/services/samgr/native/test/unittest/src/system_ability_mgr_new_test.cpp b/services/samgr/native/test/unittest/src/system_ability_mgr_new_test.cpp index 153125a3..87454cc0 100644 --- a/services/samgr/native/test/unittest/src/system_ability_mgr_new_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_mgr_new_test.cpp @@ -189,6 +189,7 @@ HWTEST_F(SystemAbilityMgrNewTest, GetLocalNodeId001, TestSize.Level3) sptr saMgr = new SystemAbilityManager; EXPECT_TRUE(saMgr != nullptr); InitSaMgr(saMgr); + string ret = saMgr->GetLocalNodeId(); EXPECT_EQ(ret, ""); } @@ -204,6 +205,7 @@ HWTEST_F(SystemAbilityMgrNewTest, ReportGetSAPeriodically001, TestSize.Level3) sptr saMgr = new SystemAbilityManager; EXPECT_TRUE(saMgr != nullptr); InitSaMgr(saMgr); + uint64_t pid_said = 123; int32_t count = 1; saMgr->saFrequencyMap_[pid_said] = count; @@ -222,6 +224,7 @@ HWTEST_F(SystemAbilityMgrNewTest, StartDynamicSystemProcess001, TestSize.Level3) sptr saMgr = new SystemAbilityManager; EXPECT_TRUE(saMgr != nullptr); InitSaMgr(saMgr); + std::u16string invalidProcess = u"1234567890123456789012345678901234567890123456789" "01234567890123456789012345678901234567890123456"; OnDemandEvent event; @@ -240,6 +243,7 @@ HWTEST_F(SystemAbilityMgrNewTest, GetSystemAbilityWithDevice001, TestSize.Level3 sptr saMgr = new SystemAbilityManager; EXPECT_TRUE(saMgr != nullptr); InitSaMgr(saMgr); + std::string deviceId = ""; auto ability = saMgr->GetSystemAbility(TEST_EXCEPTION_LOW_SA_ID, deviceId); EXPECT_EQ(ability, nullptr); @@ -278,6 +282,7 @@ HWTEST_F(SystemAbilityMgrNewTest, GetSystemAbilityFromRemote002, TestSize.Level3 sptr saMgr = new SystemAbilityManager; EXPECT_TRUE(saMgr != nullptr); InitSaMgr(saMgr); + auto ability = saMgr->GetSystemAbilityFromRemote(TEST_SYSTEM_ABILITY1); EXPECT_EQ(ability, nullptr); } @@ -291,6 +296,7 @@ HWTEST_F(SystemAbilityMgrNewTest, GetSystemAbilityFromRemote003, TestSize.Level3 { sptr saMgr = new SystemAbilityManager; EXPECT_TRUE(saMgr != nullptr); + EXPECT_TRUE(saMgr != nullptr); InitSaMgr(saMgr); SAInfo saInfo; saMgr->abilityMap_[1] = saInfo; @@ -1142,7 +1148,6 @@ HWTEST_F(SystemAbilityMgrNewTest, DoLoadForPerf001, TestSize.Level2) sptr saMgr = new SystemAbilityManager; EXPECT_TRUE(saMgr != nullptr); InitSaMgr(saMgr); - saMgr->abilityStateScheduler_ = std::make_shared(); CommonSaProfile saProfile; saProfile.process = u"memmgrservice"; saMgr->saProfileMap_[-1] = saProfile; @@ -1184,7 +1189,6 @@ HWTEST_F(SystemAbilityMgrNewTest, RegisterDistribute001, TestSize.Level2) sptr saMgr = new SystemAbilityManager(); EXPECT_FALSE(saMgr == nullptr); InitSaMgr(saMgr); - saMgr->Init(); saMgr->isDbinderServiceInit_ = false; saMgr->distributedSaList_.push_back(softBusServerSaID); saMgr->InitDbinderService(); diff --git a/services/samgr/native/test/unittest/src/system_ability_mgr_proxy_test.cpp b/services/samgr/native/test/unittest/src/system_ability_mgr_proxy_test.cpp index dc33f42f..3a512aba 100644 --- a/services/samgr/native/test/unittest/src/system_ability_mgr_proxy_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_mgr_proxy_test.cpp @@ -1340,6 +1340,11 @@ HWTEST_F(SystemAbilityMgrProxyTest, GetLruIdleSystemAbilityProc002, TestSize.Lev EXPECT_NE(res, ERR_OK); } +/** + * @tc.name: UnloadProcess002 + * @tc.desc: UnloadProcess base interface cover + * @tc.type: FUNC + */ HWTEST_F(SystemAbilityMgrProxyTest, UnloadProcess002, TestSize.Level3) { DTEST_LOG << " UnloadProcess002 begin " << std::endl; @@ -1351,6 +1356,11 @@ HWTEST_F(SystemAbilityMgrProxyTest, UnloadProcess002, TestSize.Level3) DTEST_LOG << " UnloadProcess002 end " << std::endl; } +/** + * @tc.name: GetLruIdleSystemAbilityProc003 + * @tc.desc: GetLruIdleSystemAbilityProc base interface cover + * @tc.type: FUNC + */ HWTEST_F(SystemAbilityMgrProxyTest, GetLruIdleSystemAbilityProc003, TestSize.Level3) { DTEST_LOG << " GetLruIdleSystemAbilityProc003 begin " << std::endl; diff --git a/services/samgr/native/test/unittest/src/system_ability_mgr_stub_load_test.cpp b/services/samgr/native/test/unittest/src/system_ability_mgr_stub_load_test.cpp index bb43b9c5..7435eddd 100644 --- a/services/samgr/native/test/unittest/src/system_ability_mgr_stub_load_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_mgr_stub_load_test.cpp @@ -41,17 +41,6 @@ const string DEFAULT_LOAD_NAME = "loadevent"; constexpr uint32_t SAID = 1499; constexpr int64_t DEFAULT_EVENTID = 0; constexpr int32_t INVALID_SAID = -1; -void InitSaMgr(sptr& saMgr) -{ - saMgr->abilityDeath_ = sptr(new AbilityDeathRecipient()); - saMgr->systemProcessDeath_ = sptr(new SystemProcessDeathRecipient()); - saMgr->abilityStatusDeath_ = sptr(new AbilityStatusDeathRecipient()); - saMgr->abilityCallbackDeath_ = sptr(new AbilityCallbackDeathRecipient()); - saMgr->remoteCallbackDeath_ = sptr(new RemoteCallbackDeathRecipient()); - saMgr->workHandler_ = make_shared("workHandler"); - saMgr->collectManager_ = sptr(new DeviceStatusCollectManager()); - saMgr->abilityStateScheduler_ = std::make_shared(); -} } void SystemAbilityMgrStubLoadTest::SetUpTestCase() diff --git a/services/samgr/native/test/unittest/src/system_ability_mgr_stub_test.cpp b/services/samgr/native/test/unittest/src/system_ability_mgr_stub_test.cpp index 07c8189c..5024627f 100644 --- a/services/samgr/native/test/unittest/src/system_ability_mgr_stub_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_mgr_stub_test.cpp @@ -28,6 +28,7 @@ #define private public #include "sa_status_change_mock.h" #include "system_ability_manager.h" +#include "system_ability_manager_util.h" using namespace std; using namespace testing; @@ -44,9 +45,22 @@ constexpr int32_t INVALID_SAID = -1; constexpr uint32_t INVALID_CODE = 50; } #ifdef SUPPORT_PENGLAI_MODE -namespace Penglai { +bool g_permissionRet = false; +void* g_originHandle = SamgrUtil::penglaiFunc_; +bool MockIsLaunchAllowedByUid(const int32_t callingUid, const int32_t systemAbilityId) +{ + return g_permissionRet; +} + +void SetPenglaiPerm(bool permission) +{ + SamgrUtil::penglaiFunc_ = (void*)MockIsLaunchAllowedByUid; + g_permissionRet = permission; +} -extern bool permissionRet; +void UnSetPenglaiPerm() +{ + SamgrUtil::penglaiFunc_ = g_originHandle; } #endif @@ -573,9 +587,10 @@ HWTEST_F(SystemAbilityMgrStubTest, CheckSystemAbilityImmeInner004, TestSize.Leve data.WriteInt32(SAID); saMgr->SetPengLai(true); // set permission denied - Penglai::permissionRet = false; + SetPenglaiPerm(false); int32_t result = saMgr->CheckSystemAbilityImmeInner(data, reply); EXPECT_EQ(result, ERR_PERMISSION_DENIED); + UnSetPenglaiPerm(); saMgr->SetPengLai(false); } #endif @@ -595,9 +610,10 @@ HWTEST_F(SystemAbilityMgrStubTest, CheckSystemAbilityImmeInner005, TestSize.Leve data.WriteInt32(SAID); saMgr->SetPengLai(true); // set permission true - Penglai::permissionRet = true; + SetPenglaiPerm(true); int32_t result = saMgr->CheckSystemAbilityImmeInner(data, reply); EXPECT_NE(result, ERR_PERMISSION_DENIED); + UnSetPenglaiPerm(); saMgr->SetPengLai(false); } #endif @@ -632,9 +648,10 @@ HWTEST_F(SystemAbilityMgrStubTest, GetSystemAbilityInner002, TestSize.Level3) data.WriteInt32(SAID); saMgr->SetPengLai(true); // set permission denied - Penglai::permissionRet = false; + SetPenglaiPerm(false); int32_t result = saMgr->GetSystemAbilityInner(data, reply); EXPECT_EQ(result, ERR_PERMISSION_DENIED); + UnSetPenglaiPerm(); saMgr->SetPengLai(false); } #endif @@ -654,9 +671,10 @@ HWTEST_F(SystemAbilityMgrStubTest, GetSystemAbilityInner003, TestSize.Level3) data.WriteInt32(SAID); saMgr->SetPengLai(true); // set permission true - Penglai::permissionRet = true; + SetPenglaiPerm(true); int32_t result = saMgr->GetSystemAbilityInner(data, reply); EXPECT_NE(result, ERR_PERMISSION_DENIED); + UnSetPenglaiPerm(); saMgr->SetPengLai(false); } #endif @@ -691,9 +709,10 @@ HWTEST_F(SystemAbilityMgrStubTest, CheckSystemAbilityInner002, TestSize.Level3) data.WriteInt32(SAID); saMgr->SetPengLai(true); // set permission denied - Penglai::permissionRet = false; + SetPenglaiPerm(false); int32_t result = saMgr->CheckSystemAbilityInner(data, reply); EXPECT_EQ(result, ERR_PERMISSION_DENIED); + UnSetPenglaiPerm(); saMgr->SetPengLai(false); } #endif @@ -713,9 +732,10 @@ HWTEST_F(SystemAbilityMgrStubTest, CheckSystemAbilityInner003, TestSize.Level3) data.WriteInt32(SAID); saMgr->SetPengLai(true); // set permission true - Penglai::permissionRet = true; + SetPenglaiPerm(true); int32_t result = saMgr->CheckSystemAbilityInner(data, reply); EXPECT_NE(result, ERR_PERMISSION_DENIED); + UnSetPenglaiPerm(); saMgr->SetPengLai(false); } #endif diff --git a/services/samgr/native/test/unittest/src/system_ability_mgr_test.cpp b/services/samgr/native/test/unittest/src/system_ability_mgr_test.cpp index d17794e4..b55af14b 100644 --- a/services/samgr/native/test/unittest/src/system_ability_mgr_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_mgr_test.cpp @@ -1631,7 +1631,7 @@ HWTEST_F(SystemAbilityMgrTest, GetDeviceName001, TestSize.Level3) HWTEST_F(SystemAbilityMgrTest, OnAbilityCallbackDied001, TestSize.Level3) { sptr saMgr = new SystemAbilityManager; - InitSaMgr(saMgr); + saMgr->startingAbilityMap_.clear(); saMgr->OnAbilityCallbackDied(nullptr); EXPECT_TRUE(saMgr->startingAbilityMap_.empty()); } 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 8d5201a0..2f7c7978 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 @@ -37,11 +37,12 @@ namespace system { const std::u16string PROCESS_NAME = u"test_process_name"; constexpr const char* PENG_LAI = "penglai"; -struct CfgFiles { +struct CfgFiles +{ const char* paths[MAX_CFG_POLICY_DIRS_CNT]; }; -CfgFiles* g_mockCfgFiles = nullptr; +CfgFiles* mockCfgFiles = nullptr; std::vector mockDirFiles; void InitSaMgr(sptr& saMgr) @@ -63,7 +64,7 @@ void GetDirFiles(const char* path, std::vector& files) CfgFiles* GetCfgFiles(const char* path) { - return g_mockCfgFiles; + return mockCfgFiles; } void SamgrUtilTest::SetUpTestCase() @@ -81,7 +82,7 @@ void SamgrUtilTest::SetUp() SamMockPermission::MockPermission(); system::mockValue = ""; mockDirFiles.clear(); - g_mockCfgFiles = nullptr; + mockCfgFiles = nullptr; DTEST_LOG << "SetUp" << std::endl; } @@ -433,12 +434,38 @@ HWTEST_F(SamgrUtilTest, TestGetFilesByPriority001, TestSize.Level3) HWTEST_F(SamgrUtilTest, TestGetFilesByPriority002, TestSize.Level3) { system::mockValue = ""; - g_mockCfgFiles = new CfgFiles(); + mockCfgFiles = new CfgFiles(); std::vector result; SamgrUtil::GetFilesByPriority("test_path", result); ASSERT_TRUE(result.empty()); - delete g_mockCfgFiles; + delete mockCfgFiles; +} + +#ifdef SUPPORT_PENGLAI_MODE +/** + * @tc.name: InitPenglaiFunc001 + * @tc.desc: test InitPenglaiFunc + * @tc.type: FUNC + */ +HWTEST_F(SamgrUtilTest, InitPenglaiFunc001, TestSize.Level3) +{ + system::mockValue = PENG_LAI; + void* func = SamgrUtil::InitPenglaiFunc(); + EXPECT_TRUE(func != nullptr); } + +/** + * @tc.name: CheckPenglaiPermission001 + * @tc.desc: test CheckPenglaiPermission + * @tc.type: FUNC + */ +HWTEST_F(SamgrUtilTest, CheckPenglaiPermission001, TestSize.Level3) +{ + SamgrUtil::penglaiFunc_ = nullptr; + bool ret = SamgrUtil::CheckPengLaiPermission(1); + EXPECT_TRUE(ret); +} +#endif } \ No newline at end of file diff --git a/services/samgr/native/test/unittest/src/system_ability_state_scheduler_proc_test.cpp b/services/samgr/native/test/unittest/src/system_ability_state_scheduler_proc_test.cpp index c55ace60..67b7555a 100644 --- a/services/samgr/native/test/unittest/src/system_ability_state_scheduler_proc_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_state_scheduler_proc_test.cpp @@ -39,17 +39,6 @@ constexpr int32_t STATENUMS = 1; const std::u16string process = u"test"; const std::u16string process_invalid = u"test_invalid"; const std::string LOCAL_DEVICE = "local"; -void InitSaMgr(sptr& saMgr) -{ - saMgr->abilityDeath_ = sptr(new AbilityDeathRecipient()); - saMgr->systemProcessDeath_ = sptr(new SystemProcessDeathRecipient()); - saMgr->abilityStatusDeath_ = sptr(new AbilityStatusDeathRecipient()); - saMgr->abilityCallbackDeath_ = sptr(new AbilityCallbackDeathRecipient()); - saMgr->remoteCallbackDeath_ = sptr(new RemoteCallbackDeathRecipient()); - saMgr->workHandler_ = make_shared("workHandler"); - saMgr->collectManager_ = sptr(new DeviceStatusCollectManager()); - saMgr->abilityStateScheduler_ = std::make_shared(); -} } void SystemAbilityStateSchedulerProcTest::SetUpTestCase() diff --git a/services/samgr/var.gni b/services/samgr/var.gni index 19982e76..6998a8bf 100644 --- a/services/samgr/var.gni +++ b/services/samgr/var.gni @@ -49,7 +49,7 @@ declare_args() { samgr_support_access_token = false } if (defined(global_parts_info) && - defined(global_parts_info.penglai_penglai_mode_service)) { + defined(global_parts_info.penglai_PenglaiModeService)) { support_penglai_mode = true } } diff --git a/test/fuzztest/samgr_fuzzer/BUILD.gn b/test/fuzztest/samgr_fuzzer/BUILD.gn index f72c43a5..8e9e07f8 100644 --- a/test/fuzztest/samgr_fuzzer/BUILD.gn +++ b/test/fuzztest/samgr_fuzzer/BUILD.gn @@ -185,7 +185,6 @@ foreach(item, samgr_fuzztests) { "ipc:libdbinder", "json:nlohmann_json_static", "safwk:system_ability_fwk", - "samgr:dynamic_cache", "samgr:samgr_common", "samgr:samgr_proxy", ] @@ -212,7 +211,6 @@ foreach(item, samgr_fuzztests) { } if (support_penglai_mode) { - external_deps += [ "penglai_mode_service:penglai_client" ] defines += [ "SUPPORT_PENGLAI_MODE" ] } defines += ["SAMGR_USE_FFRT"] diff --git a/test/fuzztest/samgrcoverage_fuzzer/BUILD.gn b/test/fuzztest/samgrcoverage_fuzzer/BUILD.gn index 58dd770f..e44b7bab 100644 --- a/test/fuzztest/samgrcoverage_fuzzer/BUILD.gn +++ b/test/fuzztest/samgrcoverage_fuzzer/BUILD.gn @@ -89,7 +89,6 @@ ohos_fuzztest("SamgrCoverageFuzzTest") { "ipc:libdbinder", "json:nlohmann_json_static", "safwk:system_ability_fwk", - "samgr:dynamic_cache", "samgr:samgr_common", "samgr:samgr_proxy", ] @@ -113,7 +112,6 @@ ohos_fuzztest("SamgrCoverageFuzzTest") { defines += [ "SUPPORT_DEVICE_MANAGER" ] } if (support_penglai_mode) { - external_deps += [ "penglai_mode_service:penglai_client" ] defines += [ "SUPPORT_PENGLAI_MODE" ] } defines += ["SAMGR_USE_FFRT"] diff --git a/test/fuzztest/samgrdumper_fuzzer/BUILD.gn b/test/fuzztest/samgrdumper_fuzzer/BUILD.gn index 536b4818..a4884847 100644 --- a/test/fuzztest/samgrdumper_fuzzer/BUILD.gn +++ b/test/fuzztest/samgrdumper_fuzzer/BUILD.gn @@ -88,7 +88,6 @@ ohos_fuzztest("SamgrDumperFuzzTest") { "ipc:libdbinder", "json:nlohmann_json_static", "safwk:system_ability_fwk", - "samgr:dynamic_cache", "samgr:samgr_common", "samgr:samgr_proxy", ] @@ -114,7 +113,6 @@ ohos_fuzztest("SamgrDumperFuzzTest") { } if (support_penglai_mode) { - external_deps += [ "penglai_mode_service:penglai_client" ] defines += [ "SUPPORT_PENGLAI_MODE" ] } defines += ["SAMGR_USE_FFRT"] diff --git a/test/fuzztest/systemabilitymanager_fuzzer/BUILD.gn b/test/fuzztest/systemabilitymanager_fuzzer/BUILD.gn index 9c9a24aa..021bffda 100644 --- a/test/fuzztest/systemabilitymanager_fuzzer/BUILD.gn +++ b/test/fuzztest/systemabilitymanager_fuzzer/BUILD.gn @@ -87,7 +87,6 @@ ohos_fuzztest("SystemAbilityManagerFuzzTest") { "ipc:libdbinder", "json:nlohmann_json_static", "safwk:system_ability_fwk", - "samgr:dynamic_cache", "samgr:samgr_common", "samgr:samgr_proxy", ] @@ -113,7 +112,6 @@ ohos_fuzztest("SystemAbilityManagerFuzzTest") { } if (support_penglai_mode) { - external_deps += [ "penglai_mode_service:penglai_client" ] defines += [ "SUPPORT_PENGLAI_MODE" ] } defines += ["SAMGR_USE_FFRT"] -- Gitee From b3a5477ddb69f96635c376360ee3d119cd4ba525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=95=8F=E6=9D=B0?= Date: Thu, 7 Aug 2025 13:47:44 +0000 Subject: [PATCH 2/3] update bundle.json. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 吴敏杰 --- bundle.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bundle.json b/bundle.json index ca353215..2aace2aa 100644 --- a/bundle.json +++ b/bundle.json @@ -35,6 +35,8 @@ "c_utils", "common_event_service", "device_manager", + "dsoftbus", + "eventhandler", "ffrt", "hicollie", "hilog", -- Gitee From 44ad5920ef271067fd7c6ebe772fdccc60b98b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=95=8F=E6=9D=B0?= Date: Thu, 7 Aug 2025 14:24:46 +0000 Subject: [PATCH 3/3] update services/samgr/native/include/schedule/system_ability_state_scheduler.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 吴敏杰 --- .../native/include/schedule/system_ability_state_scheduler.h | 1 - 1 file changed, 1 deletion(-) diff --git a/services/samgr/native/include/schedule/system_ability_state_scheduler.h b/services/samgr/native/include/schedule/system_ability_state_scheduler.h index d17ec6d8..fcd3626c 100644 --- a/services/samgr/native/include/schedule/system_ability_state_scheduler.h +++ b/services/samgr/native/include/schedule/system_ability_state_scheduler.h @@ -71,7 +71,6 @@ public: void UpdateLimitDelayUnloadTime(int32_t systemAbilityId); void UpdateLimitDelayUnloadTimeTask(int32_t systemAbilityId); int64_t GetSystemAbilityIdleTime(int32_t systemAbilityId); - bool GetSystemAbilityIdleTime(int32_t systemAbilityId); bool GetLruIdleSystemAbilityInfo(int32_t systemAbilityId , std::u16string& processName, int64_t& lastStopTime, int32_t& pid); private: -- Gitee