• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 #include "hcamera_scene_session_manager_proxy.h"
17 #include "camera_log.h"
18 
19 namespace OHOS {
20 namespace CameraStandard {
21 // LCOV_EXCL_START
RegisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)22 int32_t CameraSceneSessionManagerProxy::RegisterWindowManagerAgent(WindowManagerAgentType type,
23     const sptr<IWindowManagerAgent>& windowManagerAgent)
24 {
25     MessageOption option;
26     MessageParcel reply;
27     MessageParcel data;
28 
29     data.WriteInterfaceToken(GetDescriptor());
30     data.WriteUint32(static_cast<uint32_t>(type));
31     data.WriteRemoteObject(windowManagerAgent->AsObject());
32 
33     int32_t error = Remote()->SendRequest(static_cast<uint32_t>(
34         SceneSessionManagerMessage::TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT),
35         data, reply, option);
36     CHECK_PRINT_ELOG(error != ERR_NONE, "RegisterWindowManagerAgent failed, error: %{public}d", error);
37 
38     return reply.ReadInt32();
39 }
40 
UnregisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)41 int32_t CameraSceneSessionManagerProxy::UnregisterWindowManagerAgent(WindowManagerAgentType type,
42     const sptr<IWindowManagerAgent>& windowManagerAgent)
43 {
44     MessageParcel reply;
45     MessageOption option;
46     MessageParcel data;
47     data.WriteInterfaceToken(GetDescriptor());
48     data.WriteUint32(static_cast<uint32_t>(type));
49     data.WriteRemoteObject(windowManagerAgent->AsObject());
50 
51     int32_t error = Remote()->SendRequest(static_cast<uint32_t>(
52         SceneSessionManagerMessage::TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT),
53         data, reply, option);
54     CHECK_PRINT_ELOG(error != ERR_NONE, "UnregisterWindowManagerAgent failed, error: %{public}d", error);
55 
56     return reply.ReadInt32();
57 }
58 
GetFocusWindowInfo(OHOS::Rosen::FocusChangeInfo & focusInfo)59 void CameraSceneSessionManagerProxy::GetFocusWindowInfo(OHOS::Rosen::FocusChangeInfo& focusInfo)
60 {
61     MessageParcel data;
62     MessageParcel reply;
63     MessageOption option;
64 
65     data.WriteInterfaceToken(GetDescriptor());
66 
67     int32_t error = Remote()->SendRequest(
68         static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_GET_FOCUS_SESSION_INFO),
69         data, reply, option);
70     CHECK_RETURN_ELOG(error != ERR_NONE, "HCameraDeviceProxy DisableResult failed, error: %{public}d", error);
71     sptr<OHOS::Rosen::FocusChangeInfo> info = reply.ReadParcelable<OHOS::Rosen::FocusChangeInfo>();
72     if (info) {
73         focusInfo = *info;
74     } else {
75         MEDIA_ERR_LOG("GetFocusWindowInfo Focus info is null");
76     }
77 }
78 // LCOV_EXCL_STOP
79 
80 } // namespace CameraStandard
81 } // namespace OHOS