• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "parcel.h"
17 #include "iremote_broker.h"
18 #include "message_parcel.h"
19 #include "message_handler.h"
20 
21 #include "global.h"
22 #include "iremote_proxy.h"
23 #include "i_input_control_channel.h"
24 #include "i_input_method_agent.h"
25 #include "input_control_channel_proxy.h"
26 
27 /*! \class InputControlChannelProxy
28   \brief The proxy implementation of IInputControlChannel
29 
30   This class should be implemented by input method service
31 */
32 namespace OHOS {
33 namespace MiscServices {
InputControlChannelProxy(const sptr<IRemoteObject> & impl)34     InputControlChannelProxy::InputControlChannelProxy(const sptr<IRemoteObject> &impl)
35         : IRemoteProxy<IInputControlChannel>(impl)
36     {
37     }
38 
~InputControlChannelProxy()39     InputControlChannelProxy::~InputControlChannelProxy()
40     {
41     }
42 
hideKeyboardSelf(int flags)43     void InputControlChannelProxy::hideKeyboardSelf(int flags)
44     {
45         IMSA_HILOGI("InputControlChannelProxy::hideKeyboardSelf");
46         MessageParcel data, reply;
47         MessageOption option;
48         data.WriteInterfaceToken(GetDescriptor());
49         data.WriteInt32(flags);
50         Remote()->SendRequest(HIDE_KEYBOARD_SELF, data, reply, option);
51     }
52 
advanceToNext(bool isCurrentIme)53     bool InputControlChannelProxy::advanceToNext(bool isCurrentIme)
54     {
55         MessageParcel data, reply;
56         MessageOption option;
57 
58         data.WriteInterfaceToken(GetDescriptor());
59         data.WriteBool(isCurrentIme);
60         Remote()->SendRequest(MessageID::MSG_ID_ADVANCE_TO_NEXT, data, reply, option);
61         IMSA_HILOGI("InputControlChannelProxy::advanceToNext.");
62         return true;
63     }
64 
setDisplayMode(int mode)65     void InputControlChannelProxy::setDisplayMode(int mode)
66     {
67         MessageParcel data, reply;
68         MessageOption option;
69 
70         data.WriteInterfaceToken(GetDescriptor());
71         data.WriteInt32(mode);
72         Remote()->SendRequest(MessageID::MSG_ID_SET_DISPLAY_MODE, data, reply, option);
73         IMSA_HILOGI("InputControlChannelProxy::setDisplayMode.");
74     }
75 
onKeyboardShowed()76     void InputControlChannelProxy::onKeyboardShowed()
77     {
78         MessageParcel data, reply;
79         MessageOption option;
80 
81         data.WriteInterfaceToken(GetDescriptor());
82         Remote()->SendRequest(ON_KEYBOARD_SHOWED, data, reply, option);
83         IMSA_HILOGI("InputControlChannelProxy::onKeyboardShowed.");
84     }
85 }
86 }
87