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