• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 OHOS_WINDOW_MANAGER_PRIVACY_PROXY_H
17 #define OHOS_WINDOW_MANAGER_PRIVACY_PROXY_H
18 
19 #include <iremote_proxy.h>
20 
21 #include "privacy_window_service_ipc_interface_code.h"
22 
23 namespace OHOS {
24 namespace Security {
25 namespace AccessToken {
26 enum class WindowManagerAgentType : uint32_t {
27     WINDOW_MANAGER_AGENT_TYPE_FOCUS,
28     WINDOW_MANAGER_AGENT_TYPE_SYSTEM_BAR,
29     WINDOW_MANAGER_AGENT_TYPE_WINDOW_UPDATE,
30     WINDOW_MANAGER_AGENT_TYPE_WINDOW_VISIBILITY,
31     WINDOW_MANAGER_AGENT_TYPE_CAMERA_FLOAT,
32 };
33 
34 class IWindowManagerAgent : public IRemoteBroker {
35 public:
36     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IWindowManagerAgent");
37 
38     virtual void UpdateCameraFloatWindowStatus(uint32_t accessTokenId, bool isShowing) = 0;
39 };
40 
41 class IWindowManager : public IRemoteBroker {
42 public:
43     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IWindowManager");
44 
45     enum class WindowManagerMessage : uint32_t {
46         TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT = 7,
47         TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT = 8,
48     };
49 
50     virtual bool RegisterWindowManagerAgent(WindowManagerAgentType type,
51         const sptr<IWindowManagerAgent>& windowManagerAgent) = 0;
52     virtual bool UnregisterWindowManagerAgent(WindowManagerAgentType type,
53         const sptr<IWindowManagerAgent>& windowManagerAgent) = 0;
54 };
55 
56 class WindowManagerPrivacyProxy : public IRemoteProxy<IWindowManager> {
57 public:
WindowManagerPrivacyProxy(const sptr<IRemoteObject> & impl)58     explicit WindowManagerPrivacyProxy(const sptr<IRemoteObject>& impl) : IRemoteProxy<IWindowManager>(impl) {};
59 
~WindowManagerPrivacyProxy()60     ~WindowManagerPrivacyProxy() {};
61     bool RegisterWindowManagerAgent(WindowManagerAgentType type,
62             const sptr<IWindowManagerAgent>& windowManagerAgent) override;
63     bool UnregisterWindowManagerAgent(WindowManagerAgentType type,
64         const sptr<IWindowManagerAgent>& windowManagerAgent) override;
65 
66 private:
67     static inline BrokerDelegator<WindowManagerPrivacyProxy> delegator_;
68 };
69 }
70 }
71 }
72 #endif // OHOS_WINDOW_MANAGER_PRIVACY_PROXY_H
73