• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "global.h"
25 #include "i_input_client.h"
26 #include "i_input_data_channel.h"
27 #include "i_input_method_core.h"
28 #include "input_attribute.h"
29 #include "input_method_property.h"
30 #include "input_method_status.h"
31 #include "iremote_broker.h"
32 #include "message_parcel.h"
33 
34 namespace OHOS {
35 namespace MiscServices {
36 class IInputMethodSystemAbility : public IRemoteBroker {
37 public:
38     enum CommandId : int32_t {
39         PREPARE_INPUT = 0,
40         START_INPUT,
41         SHOW_CURRENT_INPUT,
42         HIDE_CURRENT_INPUT,
43         STOP_INPUT,
44         STOP_INPUT_SESSION,
45         RELEASE_INPUT,
46         GET_CURRENT_INPUT_METHOD,
47         GET_CURRENT_INPUT_METHOD_SUBTYPE,
48         LIST_INPUT_METHOD,
49         LIST_INPUT_METHOD_SUBTYPE,
50         LIST_CURRENT_INPUT_METHOD_SUBTYPE,
51         SWITCH_INPUT_METHOD,
52         DISPLAY_OPTIONAL_INPUT_METHOD,
53         SET_CORE_AND_AGENT,
54         SHOW_CURRENT_INPUT_DEPRECATED,
55         HIDE_CURRENT_INPUT_DEPRECATED,
56         DISPLAY_OPTIONAL_INPUT_DEPRECATED,
57         INPUT_SERVICE_CMD_LAST
58     };
59 
60     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.IInputMethodSystemAbility");
61 
62     virtual int32_t PrepareInput(
63         int32_t displayId, sptr<IInputClient> client, sptr<IInputDataChannel> channel, InputAttribute &attribute) = 0;
64     virtual int32_t StartInput(sptr<IInputClient> client, bool isShowKeyboard) = 0;
65     virtual int32_t ShowCurrentInput() = 0;
66     virtual int32_t HideCurrentInput() = 0;
67     virtual int32_t StopInputSession() = 0;
68     virtual int32_t StopInput(sptr<IInputClient> client) = 0;
69     virtual int32_t ReleaseInput(sptr<IInputClient> client) = 0;
70     virtual std::shared_ptr<Property> GetCurrentInputMethod() = 0;
71     virtual std::shared_ptr<SubProperty> GetCurrentInputMethodSubtype() = 0;
72     virtual int32_t ListInputMethod(InputMethodStatus status, std::vector<Property> &props) = 0;
73     virtual int32_t DisplayOptionalInputMethod() = 0;
74     virtual int32_t SetCoreAndAgent(sptr<IInputMethodCore> core, sptr<IInputMethodAgent> agent) = 0;
75     virtual int32_t ListCurrentInputMethodSubtype(std::vector<SubProperty> &subProps) = 0;
76     virtual int32_t ListInputMethodSubtype(const std::string &name, std::vector<SubProperty> &subProps) = 0;
77     virtual int32_t SwitchInputMethod(const std::string &bundleName, const std::string &name) = 0;
78 
79     // Deprecated because of no permission check, and keep for compatibility
80     virtual int32_t HideCurrentInputDeprecated() = 0;
81     virtual int32_t ShowCurrentInputDeprecated() = 0;
82     virtual int32_t DisplayOptionalInputMethodDeprecated() = 0;
83 };
84 } // namespace MiscServices
85 } // namespace OHOS
86 #endif // SERVICES_INCLUDE_I_INPUT_METHOD_SYSTEM_ABILITY_H
87