1/*
2 * Copyright (C) 2021 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 "input_control_channel_proxy.h"
17
18#include "global.h"
19#include "i_input_control_channel.h"
20#include "i_input_method_agent.h"
21#include "iremote_broker.h"
22#include "iremote_proxy.h"
23#include "itypes_util.h"
24#include "message_handler.h"
25#include "message_parcel.h"
26#include "parcel.h"
27
28namespace OHOS {
29namespace MiscServices {
30InputControlChannelProxy::InputControlChannelProxy(const sptr<IRemoteObject> &impl)
31    : IRemoteProxy<IInputControlChannel>(impl)
32{
33}
34
35InputControlChannelProxy::~InputControlChannelProxy()
36{
37}
38
39int32_t InputControlChannelProxy::HideKeyboardSelf()
40{
41    IMSA_HILOGD("InputControlChannelProxy::HideKeyboardSelf start.");
42    MessageParcel data;
43    MessageParcel reply;
44    MessageOption option;
45    if (!data.WriteInterfaceToken(GetDescriptor())) {
46        IMSA_HILOGE("descriptor is error!");
47        return ErrorCode::ERROR_EX_PARCELABLE;
48    }
49    auto remote = Remote();
50    if (remote == nullptr) {
51        IMSA_HILOGE("remote is nullptr!");
52        return ErrorCode::ERROR_EX_NULL_POINTER;
53    }
54    auto ret = remote->SendRequest(HIDE_KEYBOARD_SELF, data, reply, option);
55    if (ret != ErrorCode::NO_ERROR) {
56        IMSA_HILOGE("send request failed!");
57        return ErrorCode::ERROR_EX_PARCELABLE;
58    }
59    return reply.ReadInt32();
60}
61} // namespace MiscServices
62} // namespace OHOS