From 08fb3b882577c6186f72ccf06be5d9de4721418f Mon Sep 17 00:00:00 2001 From: huangxiaolinabc123 Date: Fri, 17 Feb 2023 09:30:07 +0000 Subject: [PATCH] add common Signed-off-by: huangxiaolinabc123 Change-Id: Ie9a8563cd0175e4d56f35015c34876763c74ab09 --- etc/samgr_standard.cfg | 12 +- .../lsamgr/include/if_local_ability_manager.h | 5 +- .../include/local_ability_manager_proxy.h | 4 +- .../src/local_ability_manager_proxy.cpp | 20 +- services/samgr/native/BUILD.gn | 9 + .../include/collect/common_event_collect.h | 85 +++++++++ .../collect/device_status_collect_manager.h | 2 +- .../schedule/system_ability_state_context.h | 3 + .../schedule/system_ability_state_scheduler.h | 3 +- .../native/include/system_ability_manager.h | 18 +- .../source/collect/common_event_collect.cpp | 180 ++++++++++++++++++ .../collect/device_status_collect_manager.cpp | 8 + .../schedule/system_ability_event_handler.cpp | 1 + .../system_ability_state_scheduler.cpp | 13 +- .../native/source/system_ability_manager.cpp | 89 +++++++-- .../src/local_ability_manager_proxy_test.cpp | 12 +- .../src/system_ability_mgr_stub_test.cpp | 7 +- services/samgr/var.gni | 5 + 18 files changed, 421 insertions(+), 55 deletions(-) create mode 100644 services/samgr/native/include/collect/common_event_collect.h create mode 100644 services/samgr/native/source/collect/common_event_collect.cpp diff --git a/etc/samgr_standard.cfg b/etc/samgr_standard.cfg index 7adfb3fa..e76102ad 100644 --- a/etc/samgr_standard.cfg +++ b/etc/samgr_standard.cfg @@ -8,7 +8,17 @@ "bootevents":"bootevent.samgr.ready", "permission": [ "ohos.permission.DISTRIBUTED_DATASYNC", - "ohos.permission.ACCESS_SERVICE_DM" + "ohos.permission.ACCESS_SERVICE_DM", + "ohos.permission.RECEIVER_STARTUP_COMPLETED", + "ohos.permission.MANAGE_LOCAL_ACCOUNTS", + "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS", + "ohos.permission.LOCATION", + "ohos.permission.GET_WIFI_INFO", + "ohos.permission.MPLINK_CHANGE_STATE", + "ohos.permission.MANAGE_LOCAL_ACCOUNTS", + "ohos.permission.STORAGE_MANAGER", + "ohos.permission.RECEIVER_SPLIT_SCREEN", + "ohos.permission.NOTIFICATION_CONTROLLER" ], "secon" : "u:r:samgr:s0", "start-mode" : "boot" diff --git a/services/lsamgr/include/if_local_ability_manager.h b/services/lsamgr/include/if_local_ability_manager.h index e38b53a1..921b125e 100644 --- a/services/lsamgr/include/if_local_ability_manager.h +++ b/services/lsamgr/include/if_local_ability_manager.h @@ -25,9 +25,8 @@ namespace OHOS { class ILocalAbilityManager : public IRemoteBroker { public: - virtual bool StartAbility(int32_t systemAbilityId) = 0; - virtual bool StopAbility(int32_t systemAbilityId) = 0; - + virtual bool StartAbility(int32_t systemAbilityId, const std::string& eventStr) = 0; + virtual bool StopAbility(int32_t systemAbilityId, const std::string& eventStr) = 0; DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ILocalAbilityManager"); protected: enum { diff --git a/services/lsamgr/include/local_ability_manager_proxy.h b/services/lsamgr/include/local_ability_manager_proxy.h index 7d57ced8..19e3f11f 100644 --- a/services/lsamgr/include/local_ability_manager_proxy.h +++ b/services/lsamgr/include/local_ability_manager_proxy.h @@ -30,8 +30,8 @@ public: : IRemoteProxy(impl) {} ~LocalAbilityManagerProxy() = default; - bool StartAbility(int32_t systemAbilityId); - bool StopAbility(int32_t systemAbilityId); + bool StartAbility(int32_t systemAbilityId, const std::string& eventStr); + bool StopAbility(int32_t systemAbilityId, const std::string& eventStr); private: static inline BrokerDelegator delegator_; OHOS::HiviewDFX::HiLogLabel label_ = { LOG_CORE, 0xD001800, "SA" }; diff --git a/services/lsamgr/src/local_ability_manager_proxy.cpp b/services/lsamgr/src/local_ability_manager_proxy.cpp index cb32df85..6f3d9afd 100644 --- a/services/lsamgr/src/local_ability_manager_proxy.cpp +++ b/services/lsamgr/src/local_ability_manager_proxy.cpp @@ -25,10 +25,10 @@ using namespace std; using namespace OHOS::HiviewDFX; namespace OHOS { -bool LocalAbilityManagerProxy::StartAbility(int32_t systemAbilityId) +bool LocalAbilityManagerProxy::StartAbility(int32_t systemAbilityId, const std::string& eventStr) { - if (systemAbilityId <= 0) { - HiLog::Warn(label_, "StartAbility systemAbilityId invalid."); + if (systemAbilityId <= 0 || eventStr.empty()) { + HiLog::Warn(label_, "StartAbility systemAbilityId or eventStr invalid."); return false; } @@ -48,7 +48,11 @@ bool LocalAbilityManagerProxy::StartAbility(int32_t systemAbilityId) HiLog::Warn(label_, "StartAbility write systemAbilityId failed!"); return false; } - + ret = data.WriteString(eventStr); + if (!ret) { + HiLog::Warn(label_, "StartAbility write eventStr failed!"); + return false; + } MessageParcel reply; MessageOption option(MessageOption::TF_ASYNC); int32_t status = iro->SendRequest(START_ABILITY_TRANSACTION, data, reply, option); @@ -59,7 +63,7 @@ bool LocalAbilityManagerProxy::StartAbility(int32_t systemAbilityId) return true; } -bool LocalAbilityManagerProxy::StopAbility(int32_t systemAbilityId) +bool LocalAbilityManagerProxy::StopAbility(int32_t systemAbilityId, const std::string& eventStr) { if (systemAbilityId <= 0) { HiLog::Warn(label_, "StopAbility systemAbilityId invalid."); @@ -82,7 +86,11 @@ bool LocalAbilityManagerProxy::StopAbility(int32_t systemAbilityId) HiLog::Warn(label_, "StopAbility write systemAbilityId failed!"); return false; } - + ret = data.WriteString(eventStr); + if (!ret) { + HiLog::Warn(label_, "StopAbility write eventStr failed!"); + return false; + } MessageParcel reply; MessageOption option(MessageOption::TF_ASYNC); int32_t status = iro->SendRequest(STOP_ABILITY_TRANSACTION, data, reply, option); diff --git a/services/samgr/native/BUILD.gn b/services/samgr/native/BUILD.gn index 460948fa..72082c57 100644 --- a/services/samgr/native/BUILD.gn +++ b/services/samgr/native/BUILD.gn @@ -100,6 +100,15 @@ ohos_executable("samgr") { defines += [ "SUPPORT_DEVICE_MANAGER" ] } + if (support_common_event) { + sources += [ "//foundation/systemabilitymgr/samgr/services/samgr/native/source/collect/common_event_collect.cpp" ] + external_deps += [ + "ability_base:want", + "common_event_service:cesfwk_innerkits", + ] + defines += [ "SUPPORT_COMMON_EVENT" ] + } + public_deps = [ "//third_party/libxml2:libxml2" ] part_name = "samgr" } diff --git a/services/samgr/native/include/collect/common_event_collect.h b/services/samgr/native/include/collect/common_event_collect.h new file mode 100644 index 00000000..a10965c4 --- /dev/null +++ b/services/samgr/native/include/collect/common_event_collect.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2023 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. + */ +#ifndef SYSTEM_ABILITY_MANAGER_COMMON_EVENT_COLLECT_H +#define SYSTEM_ABILITY_MANAGER_COMMON_EVENT_COLLECT_H + +#include +#include + +#include "common_event_subscriber.h" +#include "icollect_plugin.h" +#include "iremote_object.h" +#include "event_handler.h" + +namespace OHOS { +class CommonEventStatusCollect : public ICollectPlugin, public std::enable_shared_from_this { +public: + explicit CommonEventStatusCollect(const sptr& report); + ~CommonEventStatusCollect() = default; + + int32_t OnStart() override; + int32_t OnStop() override; + void init(const std::list& saProfiles); + bool AddCommonListener(); +private: + bool IsCesReady(); + bool IsCommonEvent(const OnDemandEvent& event); + std::shared_ptr CreateCommonEventSubscriber(); + sptr commonEventDeath_; + std::vector commonNames_; + std::shared_ptr workHandler_; + std::shared_ptr commonEventSubscriber = nullptr; +}; + +class CommonHandler : public AppExecFwk::EventHandler { + public: + CommonHandler(const std::shared_ptr& runner, + const sptr& collect) + :AppExecFwk::EventHandler(runner), commonCollect_(collect) {} + ~CommonHandler() = default; + void ProcessEvent(const OHOS::AppExecFwk::InnerEvent::Pointer& event) override; + + private: + sptr commonCollect_; +}; + +class CommonEventStatusSubscriber : public EventFwk::CommonEventSubscriber { +public: + CommonEventStatusSubscriber(const EventFwk::CommonEventSubscribeInfo &subscribeInfo, + const std::shared_ptr &collect); + ~CommonEventStatusSubscriber() override = default; + /** + * @brief The OnReceiveEvent callback. + * + * @param data The data. + */ + void JudgeAction(const std::string action); + void OnReceiveEvent(const EventFwk::CommonEventData &data) override; +private: + std::set commonState_; + std::shared_ptr collect_; + std::mutex commonStateLock_; +}; + +class CommonEventDeathRecipient : public IRemoteObject::DeathRecipient { +public: + void OnRemoteDied(const wptr& remote) override; + explicit CommonEventDeathRecipient(const std::shared_ptr& handler) : handler_(handler) {} + ~CommonEventDeathRecipient() override = default; +private: + std::shared_ptr handler_; +}; +} // namespace OHOS +#endif // SYSTEM_ABILITY_MANAGER_COMMON_EVENT_COLLECT_H \ No newline at end of file diff --git a/services/samgr/native/include/collect/device_status_collect_manager.h b/services/samgr/native/include/collect/device_status_collect_manager.h index cc722a23..3f6f7007 100644 --- a/services/samgr/native/include/collect/device_status_collect_manager.h +++ b/services/samgr/native/include/collect/device_status_collect_manager.h @@ -31,13 +31,13 @@ public: void UnInit(); void ReportEvent(const OnDemandEvent& event) override; void StartCollect(); + std::list onDemandSaProfiles_; private: void FilterOnDemandSaProfiles(const std::list& saProfiles); void GetSaControlListByEvent(const OnDemandEvent& event, std::list& saControlList); static bool IsSameEvent(const OnDemandEvent& ev1, const OnDemandEvent& ev2); std::map> collectPluginMap_; std::shared_ptr collectHandler_; - std::list onDemandSaProfiles_; }; } // namespace OHOS #endif // OHOS_SYSTEM_ABILITY_MANAGER_DEVICE_STATUS_COLLECT_MANAGER_H \ No newline at end of file diff --git a/services/samgr/native/include/schedule/system_ability_state_context.h b/services/samgr/native/include/schedule/system_ability_state_context.h index 18189732..b19b0f3e 100644 --- a/services/samgr/native/include/schedule/system_ability_state_context.h +++ b/services/samgr/native/include/schedule/system_ability_state_context.h @@ -25,6 +25,7 @@ #include "refbase.h" #include "isystem_ability_load_callback.h" +#include "sa_profiles.h" namespace OHOS { enum class SystemAbilityState { @@ -52,6 +53,7 @@ struct LoadRequestInfo { std::string deviceId; sptr callback; int32_t callingPid = -1; + OnDemandEvent event; }; enum class UnloadReason { @@ -78,6 +80,7 @@ struct SystemAbilityContext { std::map pendingLoadEventCountMap; std::list pendingLoadEventList; UnloadReason pendingUnloadReason = UnloadReason::INTERFACE_CAll; + OnDemandEvent event = {-1, "", ""}; }; } // namespace OHOS 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 63cb4c19..7f42930a 100644 --- a/services/samgr/native/include/schedule/system_ability_state_scheduler.h +++ b/services/samgr/native/include/schedule/system_ability_state_scheduler.h @@ -42,7 +42,7 @@ public: int32_t HandleLoadAbilityEvent(const LoadRequestInfo& loadRequestInfo); int32_t HandleLoadAbilityEvent(int32_t systemAbilityId, bool& isExist); - int32_t HandleUnloadAbilityEvent(int32_t systemAbilityId, UnloadReason unloadReason); + int32_t HandleUnloadAbilityEvent(int32_t systemAbilityId, UnloadReason unloadReason, const OnDemandEvent& event); int32_t SendAbilityStateEvent(int32_t systemAbilityId, AbilityStateEvent event); int32_t SendProcessStateEvent(const ProcessInfo& processInfo, ProcessStateEvent event); bool IsSystemAbilityUnloading(int32_t systemAbilityId); @@ -97,7 +97,6 @@ private: private: std::weak_ptr stateScheduler_; }; - std::shared_ptr stateMachine_; std::shared_ptr stateEventHandler_; std::shared_mutex abiltyMapLock_; diff --git a/services/samgr/native/include/system_ability_manager.h b/services/samgr/native/include/system_ability_manager.h index 55b04be9..7061af7b 100644 --- a/services/samgr/native/include/system_ability_manager.h +++ b/services/samgr/native/include/system_ability_manager.h @@ -97,18 +97,18 @@ public: int32_t LoadSystemAbility(int32_t systemAbilityId, const sptr& callback) override; int32_t DoLoadSystemAbility(int32_t systemAbilityId, const std::u16string& procName, - const sptr& callback, int32_t callingPid); + const sptr& callback, int32_t callingPid, const OnDemandEvent& event); int32_t LoadSystemAbility(int32_t systemAbilityId, const std::string& deviceId, const sptr& callback) override; int32_t UnloadSystemAbility(int32_t systemAbilityId) override; - int32_t DoUnloadSystemAbility(int32_t systemAbilityId, const std::u16string& procName); + int32_t DoUnloadSystemAbility(int32_t systemAbilityId, const std::u16string& procName, const OnDemandEvent& event); void OnAbilityCallbackDied(const sptr& remoteObject); void OnRemoteCallbackDied(const sptr& remoteObject); sptr GetSystemAbilityFromRemote(int32_t systemAbilityId); bool LoadSystemAbilityFromRpc(const std::string& srcDeviceId, int32_t systemAbilityId, const sptr& callback); int32_t DoLoadSystemAbilityFromRpc(const std::string& srcDeviceId, int32_t systemAbilityId, - const std::u16string& procName, const sptr& callback); + const std::u16string& procName, const sptr& callback, const OnDemandEvent& event); void NotifyRpcLoadCompleted(const std::string& srcDeviceId, int32_t systemAbilityId, const sptr& remoteObject); void StartDfxTimer(); @@ -126,9 +126,11 @@ private: struct AbilityItem { AbilityState state = AbilityState::INIT; std::map callbackMap; // key : networkid + OnDemandEvent event; }; SystemAbilityManager(); + std::string EventToJson(const OnDemandEvent& event); void DoInsertSaData(const std::u16string& name, const sptr& ability, const SAExtraProp& extraProp); bool IsNameInValid(const std::u16string& name); int32_t StartOnDemandAbility(int32_t systemAbilityId, bool& isExist); @@ -156,12 +158,12 @@ private: void NotifySystemAbilityLoaded(int32_t systemAbilityId, const sptr& remoteObject, const sptr& callback); void NotifySystemAbilityLoadFail(int32_t systemAbilityId, const sptr& callback); - int32_t StartingSystemProcess(const std::u16string& name, int32_t systemAbilityId); + int32_t StartingSystemProcess(const std::u16string& name, int32_t systemAbilityId, const OnDemandEvent& event); void StartOnDemandAbility(const std::u16string& name, int32_t systemAbilityId); int32_t StartOnDemandAbilityInner(const std::u16string& name, int32_t systemAbilityId, AbilityItem& abilityItem); - int32_t StartDynamicSystemProcess(const std::u16string& name, int32_t systemAbilityId); - bool StopOnDemandAbility(const std::u16string& name, int32_t systemAbilityId); - bool StopOnDemandAbilityInner(const std::u16string& name, int32_t systemAbilityId); + int32_t StartDynamicSystemProcess(const std::u16string& name, int32_t systemAbilityId, const OnDemandEvent& event); + bool StopOnDemandAbility(const std::u16string& name, int32_t systemAbilityId, const OnDemandEvent& event); + bool StopOnDemandAbilityInner(const std::u16string& name, int32_t systemAbilityId, const OnDemandEvent& event); void RemoveStartingAbilityCallback(CallbackList& callbackList, const sptr& remoteObject); void RemoveStartingAbilityCallbackForDevice(AbilityItem& abilityItem, const sptr& remoteObject); void RemoveStartingAbilityCallbackLocked(std::pair, int32_t>& itemPair); @@ -178,13 +180,13 @@ private: const sptr& remoteObject); void CleanCallbackForLoadFailed(int32_t systemAbilityId, const std::u16string& name, const std::string& srcDeviceId, const sptr& callback); - void UpdateSaFreMap(int32_t pid, int32_t saId); uint64_t GenerateFreKey(int32_t pid, int32_t saId) const; void ReportGetSAPeriodically(); void OndemandLoad(); void OndemandLoadForPerf(); std::list GetAllOndemandSa(); + std::string EventToStr(const OnDemandEvent& event); std::u16string deviceName_; static sptr instance; diff --git a/services/samgr/native/source/collect/common_event_collect.cpp b/services/samgr/native/source/collect/common_event_collect.cpp new file mode 100644 index 00000000..1964dd94 --- /dev/null +++ b/services/samgr/native/source/collect/common_event_collect.cpp @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2023 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. + */ + +#include "ability_death_recipient.h" +#include "common_event_collect.h" +#include "common_event_manager.h" +#include "common_event_support.h" +#include "matching_skills.h" +#include "want.h" +#include "sam_log.h" +#include "sa_profiles.h" +#include "system_ability_definition.h" +#include "system_ability_manager.h" + +using namespace OHOS::AppExecFwk; +namespace OHOS { +namespace { +constexpr uint32_t INIT_EVENT = 10; +constexpr uint32_t COMMON_DIED_EVENT = 11; +constexpr int64_t DELAY_TIME = 1000; +} + +CommonEventStatusCollect::CommonEventStatusCollect(const sptr& report) + : ICollectPlugin(report) +{ +} + +int32_t CommonEventStatusCollect::OnStart() +{ + HILOGI("CommonEventStatusCollect OnStart called"); + std::shared_ptr handler = EventHandler::Current(); + if (handler == nullptr) { + HILOGW("CommonEventStatusCollect current handler is nullptr"); + return ERR_INVALID_VALUE; + } + workHandler_ = std::make_shared(handler->GetEventRunner(), this); + commonEventDeath_ = sptr(new CommonEventDeathRecipient(workHandler_)); + workHandler_->SendEvent(INIT_EVENT); + return ERR_OK; +} + +int32_t CommonEventStatusCollect::OnStop() +{ + if (workHandler_ != nullptr) { + workHandler_->SetEventRunner(nullptr); + workHandler_ = nullptr; + } + return ERR_OK; +} + +void CommonEventStatusCollect::init(const std::list& onDemandSaProfiles) +{ + for (auto& profile : onDemandSaProfiles) { + for (auto iterStart = profile.startOnDemand.begin(); iterStart != profile.startOnDemand.end(); iterStart++) { + if (IsCommonEvent(*iterStart)) { + commonNames_.push_back(iterStart->name); + } + } + for (auto iterStop = profile.stopOnDemand.begin(); iterStop != profile.stopOnDemand.end(); iterStop++) { + if (IsCommonEvent(*iterStop)) { + commonNames_.push_back(iterStop->name); + } + } + } +} + +bool CommonEventStatusCollect::AddCommonListener() +{ + if (IsCesReady()) { + HILOGI("CommonEventStatusCollect AddCommonListener ces is ready"); + std::shared_ptr CommonEventstatusCollect + = std::make_shared(*this); + commonEventSubscriber = CommonEventstatusCollect->CreateCommonEventSubscriber(); + return EventFwk::CommonEventManager::SubscribeCommonEvent(commonEventSubscriber); + } + return false; +} + +std::shared_ptr CommonEventStatusCollect::CreateCommonEventSubscriber() +{ + EventFwk::MatchingSkills skill = EventFwk::MatchingSkills(); + for (auto& commonName : commonNames_) { + skill.AddEvent(commonName); + } + EventFwk::CommonEventSubscribeInfo info(skill); + return std::make_shared(info, shared_from_this()); +} + +bool CommonEventStatusCollect::IsCesReady() +{ + auto cesProxy = SystemAbilityManager::GetInstance()->CheckSystemAbility( + COMMON_EVENT_SERVICE_ID); + if (cesProxy != nullptr) { + IPCObjectProxy* proxy = reinterpret_cast(cesProxy.GetRefPtr()); + if (commonEventDeath_ != nullptr) { + cesProxy->AddDeathRecipient(commonEventDeath_); + } + // make sure the proxy is not dead + if (proxy != nullptr && !proxy->IsObjectDead()) { + return true; + } + } + return false; +} + +bool CommonEventStatusCollect::IsCommonEvent(const OnDemandEvent& event) +{ + return event.eventId == COMMON_EVENT; +} + +void CommonHandler::ProcessEvent(const InnerEvent::Pointer& event) +{ + if (commonCollect_ == nullptr || event == nullptr) { + HILOGE("CommonEventStatusCollect ProcessEvent collect or event is null!"); + return; + } + auto eventId = event->GetInnerEventId(); + if (eventId != INIT_EVENT && eventId != COMMON_DIED_EVENT) { + HILOGE("CommonEventStatusCollect ProcessEvent error event code!"); + return; + } + if (!commonCollect_->AddCommonListener()) { + HILOGW("CommonEventStatusCollect AddCommonListener retry"); + SendEvent(INIT_EVENT, DELAY_TIME); + } + HILOGI("CommonEventStatusCollect AddCommonListener success"); +} + +CommonEventStatusSubscriber::CommonEventStatusSubscriber(const EventFwk::CommonEventSubscribeInfo& subscribeInfo, + const std::shared_ptr& collect) + :EventFwk::CommonEventSubscriber(subscribeInfo), collect_(collect) {} + +void CommonEventStatusSubscriber::OnReceiveEvent(const EventFwk::CommonEventData& data) +{ + const std::string action = data.GetWant().GetAction(); + HILOGI("OnReceiveEvent get action: %{public}s", action.c_str()); + JudgeAction(action); + OnDemandEvent event = { COMMON_EVENT, action, ""}; + collect_->ReportEvent(event); +} + +void CommonEventStatusSubscriber::JudgeAction(const std::string action) +{ + std::lock_guard autoLock(commonStateLock_); + if (action == EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_ON) { + commonState_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_ON); + commonState_.erase(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_OFF); + } else if (action == EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_OFF) { + commonState_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_OFF); + commonState_.erase(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_ON); + } else if (action == EventFwk::CommonEventSupport::COMMON_EVENT_CHARGING) { + commonState_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_CHARGING); + commonState_.erase(EventFwk::CommonEventSupport::COMMON_EVENT_DISCHARGING); + } else if (action == EventFwk::CommonEventSupport::COMMON_EVENT_DISCHARGING) { + commonState_.insert(EventFwk::CommonEventSupport::COMMON_EVENT_DISCHARGING); + commonState_.erase(EventFwk::CommonEventSupport::COMMON_EVENT_CHARGING); + } +} + +void CommonEventDeathRecipient::OnRemoteDied(const wptr& remote) +{ + HILOGI("RemoteCallbackDeathRecipient called!"); + if (handler_ != nullptr) { + handler_->SendEvent(COMMON_DIED_EVENT, DELAY_TIME); + } + HILOGD("RemoteCallbackDeathRecipient death notice success"); +} +} // namespace OHOS \ No newline at end of file diff --git a/services/samgr/native/source/collect/device_status_collect_manager.cpp b/services/samgr/native/source/collect/device_status_collect_manager.cpp index 83b2a06d..7c1622d3 100644 --- a/services/samgr/native/source/collect/device_status_collect_manager.cpp +++ b/services/samgr/native/source/collect/device_status_collect_manager.cpp @@ -19,6 +19,9 @@ #ifdef SUPPORT_DEVICE_MANAGER #include "device_networking_collect.h" #endif +#ifdef SUPPORT_COMMON_EVENT +#include "common_event_collect.h" +#endif #include "sam_log.h" #include "system_ability_manager.h" @@ -32,6 +35,11 @@ void DeviceStatusCollectManager::Init(const std::list& saProfiles) #ifdef SUPPORT_DEVICE_MANAGER sptr networkingCollect = new DeviceNetworkingCollect(this); collectPluginMap_[DEVICE_ONLINE] = networkingCollect; +#endif +#ifdef SUPPORT_COMMON_EVENT + sptr eventStatuscollect = new CommonEventStatusCollect(this); + eventStatuscollect->init(onDemandSaProfiles_); + collectPluginMap_[COMMON_EVENT] = eventStatuscollect; #endif StartCollect(); HILOGI("DeviceStatusCollectManager Init end"); diff --git a/services/samgr/native/source/schedule/system_ability_event_handler.cpp b/services/samgr/native/source/schedule/system_ability_event_handler.cpp index 17d09a0b..731260f7 100644 --- a/services/samgr/native/source/schedule/system_ability_event_handler.cpp +++ b/services/samgr/native/source/schedule/system_ability_event_handler.cpp @@ -132,6 +132,7 @@ int32_t SystemAbilityEventHandler::HandleAbilityUnLoadSuccessEventLocked( context->pendingEvent = PendingEvent::NO_EVENT; } result = stateMachine_->AbilityStateTransitionLocked(context, SystemAbilityState::NOT_LOADED); + break; case SystemAbilityState::LOADED: case SystemAbilityState::UNLOADABLE: case SystemAbilityState::UNLOADING: 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 aff8f927..2832c699 100644 --- a/services/samgr/native/source/schedule/system_ability_state_scheduler.cpp +++ b/services/samgr/native/source/schedule/system_ability_state_scheduler.cpp @@ -62,7 +62,6 @@ void SystemAbilityStateScheduler::InitStateContext(const std::list& s } processContextMap_[saProfile.process]->saList.push_back(saProfile.saId); processContextMap_[saProfile.process]->abilityStateCountMap[SystemAbilityState::NOT_LOADED]++; - auto abilityContext = std::make_shared(); abilityContext->systemAbilityId = saProfile.saId; abilityContext->ownProcessContext = processContextMap_[saProfile.process]; @@ -187,13 +186,15 @@ int32_t SystemAbilityStateScheduler::HandleLoadAbilityEventLocked( return result; } -int32_t SystemAbilityStateScheduler::HandleUnloadAbilityEvent(int32_t systemAbilityId, UnloadReason unloadReason) +int32_t SystemAbilityStateScheduler::HandleUnloadAbilityEvent(int32_t systemAbilityId, UnloadReason unloadReason, + const OnDemandEvent& event) { HILOGI("[SA Scheduler][SA: %{public}d] handle unload event start", systemAbilityId); std::shared_ptr abilityContext; if (!GetSystemAbilityContext(systemAbilityId, abilityContext)) { return ERR_INVALID_VALUE; } + abilityContext->event = event; std::lock_guard autoLock(abilityContext->ownProcessContext->processLock); return HandleUnloadAbilityEventLocked(abilityContext, unloadReason); } @@ -365,11 +366,13 @@ int32_t SystemAbilityStateScheduler::DoLoadSystemAbilityLocked( if (loadRequestInfo.deviceId == LOCAL_DEVICE) { HILOGI("[SA Scheduler][SA: %{public}d] load ability from local start", abilityContext->systemAbilityId); result = SystemAbilityManager::GetInstance()->DoLoadSystemAbility(abilityContext->systemAbilityId, - abilityContext->ownProcessContext->processName, loadRequestInfo.callback, loadRequestInfo.callingPid); + abilityContext->ownProcessContext->processName, loadRequestInfo.callback, loadRequestInfo.callingPid, + loadRequestInfo.event); } else { HILOGI("[SA Scheduler][SA: %{public}d] load ability from remote start", abilityContext->systemAbilityId); result = SystemAbilityManager::GetInstance()->DoLoadSystemAbilityFromRpc(loadRequestInfo.deviceId, - abilityContext->systemAbilityId, abilityContext->ownProcessContext->processName, loadRequestInfo.callback); + abilityContext->systemAbilityId, abilityContext->ownProcessContext->processName, loadRequestInfo.callback, + loadRequestInfo.event); } if (result == ERR_OK && abilityContext->state == SystemAbilityState::NOT_LOADED) { return stateMachine_->AbilityStateTransitionLocked(abilityContext, SystemAbilityState::LOADING); @@ -444,7 +447,7 @@ int32_t SystemAbilityStateScheduler::DoUnloadSystemAbilityLocked( int32_t result = ERR_OK; HILOGI("[SA Scheduler][SA: %{public}d] unload start", abilityContext->systemAbilityId); result = SystemAbilityManager::GetInstance()->DoUnloadSystemAbility(abilityContext->systemAbilityId, - abilityContext->ownProcessContext->processName); + abilityContext->ownProcessContext->processName, abilityContext->event); if (result == ERR_OK) { return stateMachine_->AbilityStateTransitionLocked(abilityContext, SystemAbilityState::UNLOADING); } diff --git a/services/samgr/native/source/system_ability_manager.cpp b/services/samgr/native/source/system_ability_manager.cpp index b772a797..1466dc42 100644 --- a/services/samgr/native/source/system_ability_manager.cpp +++ b/services/samgr/native/source/system_ability_manager.cpp @@ -38,13 +38,20 @@ #include "system_ability_definition.h" #include "tools.h" + using namespace std; namespace OHOS { namespace { +const string START_SAID = "said"; +const string COMMON_TYPE = "type"; +const string COMMON_NAME = "name"; +const string COMMON_VALUE = "value"; const string PREFIX = "/system/profile/"; const string LOCAL_DEVICE = "local"; const string ONDEMAND_PARAM = "persist.samgr.perf.ondemand"; +const string DEFAULT_LOAD_NAME = "loadevent"; +const string DEFAULT_UNLOAD_NAME = "unloadevent"; constexpr const char* ONDEMAND_PERF_PARAM = "persist.samgr.perf.ondemand"; constexpr uint32_t REPORT_GET_SA_INTERVAL = 24 * 60 * 60 * 1000; // ms and is one day @@ -58,6 +65,8 @@ constexpr int32_t MAX_SA_FREQUENCY_COUNT = INT32_MAX - 1000000; constexpr int32_t SHFIT_BIT = 32; constexpr int64_t ONDEMAND_PERF_DELAY_TIME = 60 * 1000; // ms constexpr int64_t CHECK_LOADED_DELAY_TIME = 4 * 1000; // ms +constexpr int64_t DEFAULT_EVENTID = 0; +constexpr int64_t DEFAULT_CALLINGPID = -1; } std::mutex SystemAbilityManager::instanceLock; @@ -260,10 +269,11 @@ void SystemAbilityManager::ProcessOnDemandEvent(const OnDemandEvent& event, int32_t result = ERR_INVALID_VALUE; if (saControl.ondemandId == START_ON_DEMAND) { auto callingPid = IPCSkeleton::GetCallingPid(); - LoadRequestInfo loadRequestInfo = {saControl.saId, LOCAL_DEVICE, callback, callingPid}; + LoadRequestInfo loadRequestInfo = {saControl.saId, LOCAL_DEVICE, callback, callingPid, event}; result = abilityStateScheduler_->HandleLoadAbilityEvent(loadRequestInfo); } else if (saControl.ondemandId == STOP_ON_DEMAND) { - result = abilityStateScheduler_->HandleUnloadAbilityEvent(saControl.saId, UnloadReason::ONDEMAND_EVENT); + result = abilityStateScheduler_->HandleUnloadAbilityEvent(saControl.saId, + UnloadReason::ONDEMAND_EVENT, event); } else { HILOGE("ondemandId error"); } @@ -418,18 +428,22 @@ int32_t SystemAbilityManager::StartOnDemandAbilityInner(const std::u16string& pr HILOGI("get process:%{public}s fail", Str16ToStr8(procName).c_str()); return ERR_INVALID_VALUE; } - procObject->StartAbility(systemAbilityId); + auto event = abilityItem.event; + auto eventStr = EventToStr(event); + procObject->StartAbility(systemAbilityId, eventStr); abilityItem.state = AbilityState::STARTING; return ERR_OK; } -bool SystemAbilityManager::StopOnDemandAbility(const std::u16string& procName, int32_t systemAbilityId) +bool SystemAbilityManager::StopOnDemandAbility(const std::u16string& procName, + int32_t systemAbilityId, const OnDemandEvent& event) { lock_guard autoLock(onDemandLock_); - return StopOnDemandAbilityInner(procName, systemAbilityId); + return StopOnDemandAbilityInner(procName, systemAbilityId, event); } -bool SystemAbilityManager::StopOnDemandAbilityInner(const std::u16string& procName, int32_t systemAbilityId) +bool SystemAbilityManager::StopOnDemandAbilityInner(const std::u16string& procName, + int32_t systemAbilityId, const OnDemandEvent& event) { sptr procObject = iface_cast(GetSystemProcess(procName)); @@ -437,7 +451,8 @@ bool SystemAbilityManager::StopOnDemandAbilityInner(const std::u16string& procNa HILOGI("get process:%{public}s fail", Str16ToStr8(procName).c_str()); return false; } - return procObject->StopAbility(systemAbilityId); + auto eventStr = EventToStr(event); + return procObject->StopAbility(systemAbilityId, eventStr); } int32_t SystemAbilityManager::AddOnDemandSystemAbilityInfo(int32_t systemAbilityId, @@ -527,6 +542,8 @@ bool SystemAbilityManager::DoLoadOnDemandAbility(int32_t systemAbilityId, bool& isExist = true; return true; } + auto& abilityItem = startingAbilityMap_[systemAbilityId]; + abilityItem.event = {DEFAULT_EVENTID, DEFAULT_LOAD_NAME, ""}; return StartOnDemandAbility(systemAbilityId, isExist) == ERR_OK; } @@ -1040,16 +1057,26 @@ void SystemAbilityManager::NotifySystemAbilityLoadFail(int32_t systemAbilityId, callback->OnLoadSystemAbilityFail(systemAbilityId); } -int32_t SystemAbilityManager::StartDynamicSystemProcess(const std::u16string& name, int32_t systemAbilityId) +int32_t SystemAbilityManager::StartDynamicSystemProcess(const std::u16string& name, + int32_t systemAbilityId, const OnDemandEvent& event) { - std::string strExtra = std::to_string(systemAbilityId); - auto extraArgv = strExtra.c_str(); + std::unordered_map startReason; + startReason[START_SAID] = std::to_string(systemAbilityId); + startReason[COMMON_TYPE] = std::to_string(event.eventId); + startReason[COMMON_NAME] = event.name; + startReason[COMMON_VALUE] = event.value; + nlohmann::json eventJson; + for (auto it = startReason.begin(); it != startReason.end(); ++it) { + eventJson[it->first] = it->second; + } + auto extraArgv = eventJson.dump().c_str(); auto result = ServiceControlWithExtra(Str16ToStr8(name).c_str(), ServiceAction::START, &extraArgv, 1); HILOGI("StartDynamicSystemProcess call ServiceControlWithExtra result:%{public}d!", result); return (result == 0) ? ERR_OK : ERR_INVALID_VALUE; } -int32_t SystemAbilityManager::StartingSystemProcess(const std::u16string& procName, int32_t systemAbilityId) +int32_t SystemAbilityManager::StartingSystemProcess(const std::u16string& procName, + int32_t systemAbilityId, const OnDemandEvent& event) { lock_guard autoLock(onDemandLock_); if (startingProcessMap_.count(procName) != 0) { @@ -1067,7 +1094,7 @@ int32_t SystemAbilityManager::StartingSystemProcess(const std::u16string& procNa } // call init start process int64_t begin = GetTickCount(); - int32_t result = StartDynamicSystemProcess(procName, systemAbilityId); + int32_t result = StartDynamicSystemProcess(procName, systemAbilityId, event); if (result == ERR_OK) { startingProcessMap_.emplace(procName, begin); } @@ -1075,7 +1102,7 @@ int32_t SystemAbilityManager::StartingSystemProcess(const std::u16string& procNa } int32_t SystemAbilityManager::DoLoadSystemAbility(int32_t systemAbilityId, const std::u16string& procName, - const sptr& callback, int32_t callingPid) + const sptr& callback, int32_t callingPid, const OnDemandEvent& event) { int32_t result = ERR_INVALID_VALUE; { @@ -1099,12 +1126,13 @@ int32_t SystemAbilityManager::DoLoadSystemAbility(int32_t systemAbilityId, const } ++count; abilityItem.callbackMap[LOCAL_DEVICE].emplace_back(callback, callingPid); + abilityItem.event = event; if (abilityCallbackDeath_ != nullptr) { bool ret = callback->AsObject()->AddDeathRecipient(abilityCallbackDeath_); HILOGI("LoadSystemAbility systemAbilityId:%{public}d AddDeathRecipient %{public}s", systemAbilityId, ret ? "succeed" : "failed"); } - result = StartingSystemProcess(procName, systemAbilityId); + result = StartingSystemProcess(procName, systemAbilityId, event); HILOGI("LoadSystemAbility systemAbilityId:%{public}d size : %{public}zu", systemAbilityId, abilityItem.callbackMap[LOCAL_DEVICE].size()); } @@ -1113,7 +1141,7 @@ int32_t SystemAbilityManager::DoLoadSystemAbility(int32_t systemAbilityId, const } int32_t SystemAbilityManager::DoLoadSystemAbilityFromRpc(const std::string& srcDeviceId, int32_t systemAbilityId, - const std::u16string& procName, const sptr& callback) + const std::u16string& procName, const sptr& callback, const OnDemandEvent& event) { { lock_guard autoLock(onDemandLock_); @@ -1124,7 +1152,7 @@ int32_t SystemAbilityManager::DoLoadSystemAbilityFromRpc(const std::string& srcD } auto& abilityItem = startingAbilityMap_[systemAbilityId]; abilityItem.callbackMap[srcDeviceId].emplace_back(callback, 0); - StartingSystemProcess(procName, systemAbilityId); + StartingSystemProcess(procName, systemAbilityId, event); } SendCheckLoadedMsg(systemAbilityId, procName, srcDeviceId, callback); return ERR_OK; @@ -1144,7 +1172,8 @@ int32_t SystemAbilityManager::LoadSystemAbility(int32_t systemAbilityId, return ERR_INVALID_VALUE; } auto callingPid = IPCSkeleton::GetCallingPid(); - LoadRequestInfo loadRequestInfo = {systemAbilityId, LOCAL_DEVICE, callback, callingPid}; + OnDemandEvent defaultevent = {DEFAULT_EVENTID, DEFAULT_LOAD_NAME, ""}; + LoadRequestInfo loadRequestInfo = {systemAbilityId, LOCAL_DEVICE, callback, callingPid, defaultevent}; return abilityStateScheduler_->HandleLoadAbilityEvent(loadRequestInfo); } @@ -1166,7 +1195,8 @@ bool SystemAbilityManager::LoadSystemAbilityFromRpc(const std::string& srcDevice HILOGE("LoadSystemAbilityFromRpc said:%{public}d not distributed!", systemAbilityId); return false; } - LoadRequestInfo loadRequestInfo = {systemAbilityId, srcDeviceId, callback}; + OnDemandEvent defaultevent = {DEFAULT_EVENTID, DEFAULT_LOAD_NAME, ""}; + LoadRequestInfo loadRequestInfo = {systemAbilityId, srcDeviceId, callback, DEFAULT_CALLINGPID, defaultevent}; if (abilityStateScheduler_ == nullptr) { HILOGE("abilityStateScheduler is nullptr"); return false; @@ -1202,17 +1232,20 @@ int32_t SystemAbilityManager::UnloadSystemAbility(int32_t systemAbilityId) HILOGE("abilityStateScheduler is nullptr"); return ERR_INVALID_VALUE; } - return abilityStateScheduler_->HandleUnloadAbilityEvent(systemAbilityId, UnloadReason::INTERFACE_CAll); + OnDemandEvent defaultevent = {DEFAULT_EVENTID, DEFAULT_UNLOAD_NAME, ""}; + return abilityStateScheduler_->HandleUnloadAbilityEvent(systemAbilityId, + UnloadReason::INTERFACE_CAll, defaultevent); } -int32_t SystemAbilityManager::DoUnloadSystemAbility(int32_t systemAbilityId, const std::u16string& procName) +int32_t SystemAbilityManager::DoUnloadSystemAbility(int32_t systemAbilityId, + const std::u16string& procName, const OnDemandEvent& event) { lock_guard autoLock(onDemandLock_); sptr targetObject = CheckSystemAbility(systemAbilityId); if (targetObject == nullptr) { return ERR_OK; } - bool result = StopOnDemandAbility(procName, systemAbilityId); + bool result = StopOnDemandAbility(procName, systemAbilityId, event); if (!result) { HILOGE("unload system ability failed, systemAbilityId: %{public}d", systemAbilityId); return ERR_INVALID_VALUE; @@ -1411,6 +1444,20 @@ std::string SystemAbilityManager::GetLocalNodeId() return std::string(); } +std::string SystemAbilityManager::EventToStr(const OnDemandEvent& event) +{ + std::unordered_map stopReason; + stopReason[COMMON_TYPE] = std::to_string(event.eventId); + stopReason[COMMON_NAME] = event.name; + stopReason[COMMON_VALUE] = event.value; + nlohmann::json eventJson; + for (auto it = stopReason.begin(); it != stopReason.end(); ++it) { + eventJson[it->first] = it->second; + } + std::string eventStr = eventJson.dump(); + return eventStr; +} + void SystemAbilityManager::UpdateSaFreMap(int32_t pid, int32_t saId) { if (pid <= 0) { diff --git a/services/samgr/native/test/unittest/src/local_ability_manager_proxy_test.cpp b/services/samgr/native/test/unittest/src/local_ability_manager_proxy_test.cpp index 2652a6b7..21d2086d 100644 --- a/services/samgr/native/test/unittest/src/local_ability_manager_proxy_test.cpp +++ b/services/samgr/native/test/unittest/src/local_ability_manager_proxy_test.cpp @@ -62,7 +62,8 @@ HWTEST_F(LocalAbilityManagerProxyTest, LocalAbilityManagerProxy001, TestSize.Lev { sptr testAbility(new TestTransactionService()); sptr localAbility(new LocalAbilityManagerProxy(testAbility)); - bool res = localAbility->StartAbility(TEST_SAID_INVAILD); + string eventStr = "name:usual.event.SCREEN_ON,said:1499,type:4,value:"; + bool res = localAbility->StartAbility(TEST_SAID_INVAILD, eventStr); EXPECT_EQ(res, false); } @@ -75,7 +76,8 @@ HWTEST_F(LocalAbilityManagerProxyTest, LocalAbilityManagerProxy001, TestSize.Lev HWTEST_F(LocalAbilityManagerProxyTest, LocalAbilityManagerProxy002, TestSize.Level1) { sptr localAbility(new LocalAbilityManagerProxy(nullptr)); - bool res = localAbility->StartAbility(TEST_SAID_VAILD); + string eventStr = "name:usual.event.SCREEN_ON,said:1499,type:4,value:"; + bool res = localAbility->StartAbility(TEST_SAID_VAILD, eventStr); EXPECT_EQ(res, false); } @@ -89,7 +91,8 @@ HWTEST_F(LocalAbilityManagerProxyTest, LocalAbilityManagerProxy003, TestSize.Lev { sptr testAbility(new MockIroSendrequesteStub()); sptr localAbility(new LocalAbilityManagerProxy(testAbility)); - bool res = localAbility->StartAbility(TEST_SAID_VAILD); + string eventStr = "name:usual.event.SCREEN_ON,said:1499,type:4,value:"; + bool res = localAbility->StartAbility(TEST_SAID_VAILD, eventStr); EXPECT_EQ(res, true); } @@ -105,7 +108,8 @@ HWTEST_F(LocalAbilityManagerProxyTest, LocalAbilityManagerProxy004, TestSize.Lev testAbility->result_ = 1; sptr localAbility(new LocalAbilityManagerProxy(testAbility)); EXPECT_NE(localAbility, nullptr); - bool res = localAbility->StartAbility(TEST_SAID_VAILD); + string eventStr = "name:usual.event.SCREEN_ON,said:1499,type:4,value:"; + bool res = localAbility->StartAbility(TEST_SAID_VAILD, eventStr); EXPECT_EQ(res, false); } } \ No newline at end of file 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 7b7dad1b..704a4956 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 @@ -19,6 +19,7 @@ #include "itest_transaction_service.h" #include "if_system_ability_manager.h" #include "ipc_skeleton.h" +#include "sa_profiles.h" #include "sam_mock_permission.h" #include "string_ex.h" #include "system_ability_definition.h" @@ -1904,7 +1905,8 @@ HWTEST_F(SystemAbilityMgrStubTest, StartingSystemProcess001, TestSize.Level1) saMgr->startingProcessMap_.clear(); int countNum = 2; saMgr->startingProcessMap_[procName] = countNum; - int32_t res = saMgr->StartingSystemProcess(procName, SAID); + OnDemandEvent defaultevent = {DEFAULT_EVENTID, DEFAULT_LOAD_NAME, ""}; + int32_t res = saMgr->StartingSystemProcess(procName, SAID, defaultevent); EXPECT_EQ(res, ERR_OK); } @@ -1920,7 +1922,8 @@ HWTEST_F(SystemAbilityMgrStubTest, StartingSystemProcess002, TestSize.Level1) u16string procName = u"proTest"; saMgr->startingProcessMap_.clear(); saMgr->systemProcessMap_[procName] = testAbility; - int32_t res = saMgr->StartingSystemProcess(procName, SAID); + OnDemandEvent defaultevent = {DEFAULT_EVENTID, DEFAULT_LOAD_NAME, ""}; + int32_t res = saMgr->StartingSystemProcess(procName, SAID, defaultevent); EXPECT_EQ(res, ERR_OK); } diff --git a/services/samgr/var.gni b/services/samgr/var.gni index 5cba58c2..2c35f13f 100644 --- a/services/samgr/var.gni +++ b/services/samgr/var.gni @@ -14,6 +14,7 @@ declare_args() { hicollie_able = true ressched_able = true support_device_manager = false + support_common_event = false if (defined(global_parts_info) && !defined(global_parts_info.hiviewdfx_hicollie_native)) { hicollie_able = false @@ -26,4 +27,8 @@ declare_args() { defined(global_parts_info.distributedhardware_device_manager)) { support_device_manager = true } + if (defined(global_parts_info) && + defined(global_parts_info.notification_common_event_service)) { + support_common_event = true + } } -- Gitee