• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ACCESS_FORM_MANAGER_ACCESS_PROXY_H
17 #define ACCESS_FORM_MANAGER_ACCESS_PROXY_H
18 
19 #include <iremote_proxy.h>
20 #include "form_instance.h"
21 
22 namespace OHOS {
23 namespace Security {
24 namespace AccessToken {
25 class IJsFormStateObserver : public IRemoteBroker {
26 public:
27     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.IJsFormStateObserver");
28 
29     virtual int32_t NotifyWhetherFormsVisible(const FormVisibilityType visibleType,
30         const std::string &bundleName, std::vector<FormInstance> &formInstances) = 0;
31 
32     enum class Message {
33         FORM_STATE_OBSERVER_NOTIFY_WHETHER_FORMS_VISIBLE = 4304,
34     };
35 };
36 
37 class IFormMgr : public IRemoteBroker {
38 public:
39     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.FormMgr")
40 
41     virtual int32_t RegisterAddObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken) = 0;
42     virtual int32_t RegisterRemoveObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken) = 0;
43     virtual bool HasFormVisible(const uint32_t tokenId) = 0;
44 
45     enum class Message {
46         FORM_MGR_REGISTER_ADD_OBSERVER = 3053,
47         FORM_MGR_REGISTER_REMOVE_OBSERVER = 3054,
48         FORM_MGR_HAS_FORM_VISIBLE_WITH_TOKENID = 3067,
49     };
50 };
51 
52 class FormManagerAccessProxy : public IRemoteProxy<IFormMgr> {
53 public:
FormManagerAccessProxy(const sptr<IRemoteObject> & impl)54     explicit FormManagerAccessProxy(const sptr<IRemoteObject>& impl) : IRemoteProxy<IFormMgr>(impl) {}
55 
56     virtual ~FormManagerAccessProxy() = default;
57 
58     int32_t RegisterAddObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken) override;
59     int32_t RegisterRemoveObserver(const std::string &bundleName, const sptr<IRemoteObject> &callerToken) override;
60     bool HasFormVisible(const uint32_t tokenId) override;
61 private:
62     static inline BrokerDelegator<FormManagerAccessProxy> delegator_;
63 };
64 } // namespace AccessToken
65 } // namespace Security
66 } // namespace OHOS
67 #endif // ACCESS_FORM_MANAGER_ACCESS_PROXY_H
68