1 /*
2 * Copyright (c) 2023-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 #include "session_handler_proxy.h"
17 #include "hilog_tag_wrapper.h"
18 #include "message_parcel.h"
19
20 namespace OHOS {
21 namespace AAFwk {
OnSessionMovedToFront(int32_t sessionId)22 void SessionHandlerProxy::OnSessionMovedToFront(int32_t sessionId)
23 {
24 MessageParcel data;
25 MessageParcel reply;
26 MessageOption option(MessageOption::TF_ASYNC);
27 if (!data.WriteInterfaceToken(ISessionHandler::GetDescriptor())) {
28 TAG_LOGE(AAFwkTag::DEFAULT, "write token failed");
29 return;
30 }
31 if (!data.WriteInt32(sessionId)) {
32 TAG_LOGE(AAFwkTag::DEFAULT, "sessionId write failed");
33 return;
34 }
35 auto remote = Remote();
36 if (!remote) {
37 TAG_LOGE(AAFwkTag::DEFAULT, "remote null");
38 return;
39 }
40 int32_t ret = remote->SendRequest(ISessionHandler::ON_SESSION_MOVED_TO_FRONT, data, reply, option);
41 if (ret != NO_ERROR) {
42 TAG_LOGE(AAFwkTag::DEFAULT, "request failed: %{public}d", ret);
43 }
44 }
45 }
46 }