1 /*
2  * Copyright (C) 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 #ifndef SERVICES_INCLUDE_I_INPUT_METHOD_SYSTEM_ABILITY_H
17 #define SERVICES_INCLUDE_I_INPUT_METHOD_SYSTEM_ABILITY_H
18 
19 #include <errors.h>
20 
21 #include <memory>
22 #include <vector>
23 
24 #include "element_name.h"
25 #include "event_status_manager.h"
26 #include "global.h"
27 #include "i_input_client.h"
28 #include "i_input_method_core.h"
29 #include "i_system_cmd_channel.h"
30 #include "input_attribute.h"
31 #include "input_client_info.h"
32 #include "input_method_property.h"
33 #include "input_method_status.h"
34 #include "input_window_info.h"
35 #include "iremote_broker.h"
36 #include "message_parcel.h"
37 #include "panel_info.h"
38 #include "input_method_types.h"
39 
40 namespace OHOS {
41 namespace MiscServices {
42 class IInputMethodSystemAbility : public IRemoteBroker {
43 public:
44     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.IInputMethodSystemAbility");
45 
46     virtual int32_t StartInput(InputClientInfo &inputClientInfo, sptr<IRemoteObject> &agent) = 0;
47     virtual int32_t ShowCurrentInput() = 0;
48     virtual int32_t HideCurrentInput() = 0;
49     virtual int32_t StopInputSession() = 0;
50     virtual int32_t ShowInput(sptr<IInputClient> client) = 0;
51     virtual int32_t HideInput(sptr<IInputClient> client) = 0;
52     virtual int32_t ReleaseInput(sptr<IInputClient> client) = 0;
53     virtual int32_t RequestShowInput() = 0;
54     virtual int32_t RequestHideInput() = 0;
55     virtual int32_t GetDefaultInputMethod(std::shared_ptr<Property> &prop, bool isBrief) = 0;
56     virtual int32_t GetInputMethodConfig(AppExecFwk::ElementName &inputMethodConfig) = 0;
57     virtual std::shared_ptr<Property> GetCurrentInputMethod() = 0;
58     virtual std::shared_ptr<SubProperty> GetCurrentInputMethodSubtype() = 0;
59     virtual int32_t ListInputMethod(InputMethodStatus status, std::vector<Property> &props) = 0;
60     virtual int32_t DisplayOptionalInputMethod() = 0;
61     virtual int32_t SetCoreAndAgent(const sptr<IInputMethodCore> &core, const sptr<IRemoteObject> &agent) = 0;
62     virtual int32_t InitConnect() = 0;
63     virtual int32_t UnRegisteredProxyIme(UnRegisteredType type, const sptr<IInputMethodCore> &core) = 0;
64     virtual int32_t ListCurrentInputMethodSubtype(std::vector<SubProperty> &subProps) = 0;
65     virtual int32_t ListInputMethodSubtype(const std::string &name, std::vector<SubProperty> &subProps) = 0;
66     virtual int32_t SwitchInputMethod(
67         const std::string &bundleName, const std::string &name, SwitchTrigger trigger) = 0;
68     virtual int32_t PanelStatusChange(const InputWindowStatus &status, const ImeWindowInfo &info) = 0;
69     virtual int32_t UpdateListenEventFlag(InputClientInfo &clientInfo, uint32_t eventFlag) = 0;
70     virtual bool IsCurrentIme() = 0;
71     virtual bool IsInputTypeSupported(InputType type) = 0;
72     virtual bool IsCurrentImeByPid(int32_t pid) = 0;
73     virtual int32_t StartInputType(InputType type) = 0;
74     virtual int32_t ExitCurrentInputType() = 0;
75     virtual int32_t IsPanelShown(const PanelInfo &panelInfo, bool &isShown) = 0;
76     virtual int32_t GetSecurityMode(int32_t &security) = 0;
77     virtual int32_t IsDefaultIme() = 0;
78     virtual bool IsDefaultImeSet() = 0;
79     virtual bool EnableIme(const std::string &bundleName) = 0;
80     virtual int32_t ConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent) = 0;
81 
82     // Deprecated because of no permission check, and keep for compatibility
83     virtual int32_t HideCurrentInputDeprecated() = 0;
84     virtual int32_t ShowCurrentInputDeprecated() = 0;
85 };
86 } // namespace MiscServices
87 } // namespace OHOS
88 #endif // SERVICES_INCLUDE_I_INPUT_METHOD_SYSTEM_ABILITY_H
89