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 OHOS_CAMERA_CAMERA_WINDOW_MANAGER_CLIENT_H
17 #define OHOS_CAMERA_CAMERA_WINDOW_MANAGER_CLIENT_H
18 
19 #include "hcamera_mock_session_manager_interface.h"
20 #include "hcamera_scene_session_manager_proxy.h"
21 #include "hcamera_window_session_manager_service_proxy.h"
22 #include "system_ability_status_change_stub.h"
23 
24 namespace OHOS {
25 namespace CameraStandard {
26 class CameraWindowManagerClient : public RefBase {
27 public:
28     class WMSSaStatusChangeCallback : public SystemAbilityStatusChangeStub {
29     public:
30         void OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override;
31         void OnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override;
32     };
33     static sptr<CameraWindowManagerClient>& GetInstance();
34     virtual ~CameraWindowManagerClient();
35     int32_t RegisterWindowManagerAgent();
36     int32_t UnregisterWindowManagerAgent();
37     sptr<IWindowManagerAgent> GetWindowManagerAgent();
38     void GetFocusWindowInfo(pid_t& pid);
39 
40 private:
41     CameraWindowManagerClient();
42     void InitWindowProxy();
43     void InitWindowManagerAgent();
44     int32_t SubscribeSystemAbility();
45     int32_t UnSubscribeSystemAbility();
46     sptr<IMockSessionManagerInterface> mockSessionManagerServiceProxy_ = nullptr;
47     sptr<ISessionManagerService> sessionManagerServiceProxy_ = nullptr;
48     sptr<ISceneSessionManager> sceneSessionManagerProxy_ = nullptr;
49     sptr<IWindowManagerAgent> windowManagerAgent_ = nullptr;
50     sptr<WMSSaStatusChangeCallback> saStatusChangeCallback_;
51     static std::mutex instanceMutex_;
52     static sptr<CameraWindowManagerClient> cameraWindowManagerClient_;
53 };
54 } // namespace CameraStandard
55 } // namespace OHOS
56 #endif