diff --git a/interfaces/innerkits/samgr_proxy/include/system_ability_manager_proxy.h b/interfaces/innerkits/samgr_proxy/include/system_ability_manager_proxy.h index a81713407ab4c0eeddcaada43b422c217bd8c787..ed3543bfab602a6b5d9cb68854b56da5e3fd18d6 100644 --- a/interfaces/innerkits/samgr_proxy/include/system_ability_manager_proxy.h +++ b/interfaces/innerkits/samgr_proxy/include/system_ability_manager_proxy.h @@ -17,6 +17,8 @@ #ifndef INTERFACES_INNERKITS_SAMGR_INCLUDE_SYSTEM_ABILITY_MANAGER_PROXY_H #define INTERFACES_INNERKITS_SAMGR_INCLUDE_SYSTEM_ABILITY_MANAGER_PROXY_H +#include +#include #include #include "if_system_ability_manager.h" #include "system_ability_on_demand_event.h" @@ -134,7 +136,7 @@ public: * @return ERR_OK indicates successful add. */ int32_t AddSystemProcess(const std::u16string& procName, const sptr& procObject) override; - + /** * LoadSystemAbility, Load sa. * diff --git a/services/samgr/native/source/collect/common_event_collect.cpp b/services/samgr/native/source/collect/common_event_collect.cpp index 060277b47d959f2f05f79af0dcfa84da05352f33..0bece175eadb42fcd58efa385d1f2c1411b9ad28 100644 --- a/services/samgr/native/source/collect/common_event_collect.cpp +++ b/services/samgr/native/source/collect/common_event_collect.cpp @@ -76,12 +76,15 @@ void CommonEventCollect::Init(const std::list& onDemandSaProfiles) std::lock_guard autoLock(commonEventStateLock_); commonEventState_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_ON); commonEventState_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_DISCHARGING); + commonEventState_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_DISCONNECTED); } std::lock_guard autoLock(commomEventLock_); commonEventNames_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_ON); commonEventNames_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_OFF); commonEventNames_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_CHARGING); commonEventNames_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_DISCHARGING); + commonEventNames_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_CONNECTED); + commonEventNames_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_DISCONNECTED); for (auto& profile : onDemandSaProfiles) { for (auto iterStart = profile.startOnDemand.onDemandEvents.begin(); iterStart != profile.startOnDemand.onDemandEvents.end(); iterStart++) { @@ -154,6 +157,12 @@ void CommonEventCollect::SaveAction(const std::string& action) } else if (action == EventFwk::CommonEventSupport::COMMON_EVENT_DISCHARGING) { commonEventState_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_DISCHARGING); commonEventState_.erase(EventFwk::CommonEventSupport::COMMON_EVENT_CHARGING); + } else if (action == EventFwk::CommonEventSupport::COMMON_EVENT_CONNECTED) { + commonEventState_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_CONNECTED); + commonEventState_.erase(EventFwk::CommonEventSupport::COMMON_EVENT_DISCONNECTED); + } else if (action == EventFwk::CommonEventSupport::COMMON_EVENT_DISCONNECTED) { + commonEventState_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_DISCONNECTED); + commonEventState_.erase(EventFwk::CommonEventSupport::COMMON_EVENT_CONNECTED); } } diff --git a/services/samgr/native/source/system_ability_manager.cpp b/services/samgr/native/source/system_ability_manager.cpp index 1c21399bc79ec155d700af687094287a1aca24f5..25a7ff3a581b753ff5ca66c00508e71264d206dc 100644 --- a/services/samgr/native/source/system_ability_manager.cpp +++ b/services/samgr/native/source/system_ability_manager.cpp @@ -973,6 +973,9 @@ int32_t SystemAbilityManager::AddSystemAbility(int32_t systemAbilityId, const sp saInfo.isDistributed = extraProp.isDistributed; saInfo.capability = extraProp.capability; saInfo.permission = Str16ToStr8(extraProp.permission); + if (abilityMap_.count(systemAbilityId) > 0) { + HILOGW("systemAbility: %{public}d is being covered", systemAbilityId); + } abilityMap_[systemAbilityId] = std::move(saInfo); HILOGI("insert %{public}d. size : %{public}zu", systemAbilityId, abilityMap_.size()); }