/* * 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 FORM_ECOLOGICAL_RULE_PROXY_H #define FORM_ECOLOGICAL_RULE_PROXY_H #include #include #include "iremote_proxy.h" #include "form_ecological_rule_interface.h" namespace OHOS { namespace AppExecFwk { using CallerInfo = OHOS::AppExecFwk::FormErmsCallerInfo; class FormEcologicalRuleClient final : public DelayedRefSingleton { DECLARE_DELAYED_REF_SINGLETON(FormEcologicalRuleClient) public: DISALLOW_COPY_AND_MOVE(FormEcologicalRuleClient); void OnRemoteSaDied(const wptr &object); int32_t IsSupportPublishForm(const std::vector &wants, const CallerInfo &callerInfo, bool &bSupport); private: static sptr ConnectService(); static bool CheckConnectService(); static std::mutex instanceLock_; static sptr ecologicalRuleMgrServiceProxy_; static sptr deathRecipient_; static std::string ERMS_ORIGINAL_TARGET; }; class FormEcologicalRuleDeathRecipient : public IRemoteObject::DeathRecipient { public: FormEcologicalRuleDeathRecipient() {}; ~FormEcologicalRuleDeathRecipient() = default; void OnRemoteDied(const wptr &object) override; private: DISALLOW_COPY_AND_MOVE(FormEcologicalRuleDeathRecipient); }; class FormEcologicalRuleProxy : public OHOS::IRemoteProxy { public: using Want = OHOS::AAFwk::Want; explicit FormEcologicalRuleProxy(const sptr &object) : IRemoteProxy(object) {} ~FormEcologicalRuleProxy() = default; DISALLOW_COPY_AND_MOVE(FormEcologicalRuleProxy); int32_t IsSupportPublishForm(const std::vector &wants, const CallerInfo &callerInfo, bool &bSupport) override; private: static inline BrokerDelegator delegator_; }; } // namespace AppExecFwk } // namespace OHOS #endif // FORM_ECOLOGICAL_RULE_PROXY_H