/* * Copyright (c) 2021-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 INTERFACES_INNERKITS_SAMGR_INCLUDE_STATUS_CHANGE_WRAPPER_H #define INTERFACES_INNERKITS_SAMGR_INCLUDE_STATUS_CHANGE_WRAPPER_H #include #include "cxx.h" #include "if_system_ability_manager.h" #include "ipc_object_stub.h" #include "system_ability_status_change_stub.h" namespace OHOS { namespace SamgrRust { struct SystemProcessInfo; class SystemAbilityStatusChangeWrapper : public SystemAbilityStatusChangeStub { public: SystemAbilityStatusChangeWrapper(const rust::Fn onAdd, const rust::Fn onRemove); ~SystemAbilityStatusChangeWrapper() = default; void OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId) override; void OnRemoveSystemAbility(int32_t systemAbilityId, const std::string &deviceId) override; private: rust::Fn onAdd_; rust::Fn onRemove_; }; class SystemProcessStatusChangeWrapper : public IRemoteProxy { public: SystemProcessStatusChangeWrapper(const sptr &impl, const rust::Fn onStart, const rust::Fn onStop); ~SystemProcessStatusChangeWrapper() = default; void OnSystemProcessStarted(OHOS::SystemProcessInfo &systemProcessInfo) override; void OnSystemProcessStopped(OHOS::SystemProcessInfo &systemProcessInfo) override; private: rust::Fn onStart_; rust::Fn onStop_; }; class UnSubscribeSystemAbilityHandler { public: UnSubscribeSystemAbilityHandler(int32_t systemAbilityId, sptr listener); void UnSubscribe(); private: int32_t said_; sptr listener_; }; class UnSubscribeSystemProcessHandler { public: UnSubscribeSystemProcessHandler(sptr listener); void UnSubscribe(); private: sptr listener_; }; } // namespace SamgrRust } // namespace OHOS #endif