• 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 #ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_PROXY_H
17 #define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_PROXY_H
18 
19 #include <cstdint>
20 #include <functional>
21 #include <string>
22 #include <vector>
23 
24 #include "global.h"
25 #include "i_input_method_system_ability.h"
26 #include "input_attribute.h"
27 #include "input_client_stub.h"
28 #include "input_data_channel_stub.h"
29 #include "input_method_info.h"
30 #include "input_window_info.h"
31 #include "iremote_broker.h"
32 #include "iremote_object.h"
33 #include "iremote_proxy.h"
34 #include "itypes_util.h"
35 #include "message_parcel.h"
36 #include "nocopyable.h"
37 #include "refbase.h"
38 
39 namespace OHOS {
40 namespace MiscServices {
41 class InputMethodSystemAbilityProxy : public IRemoteProxy<IInputMethodSystemAbility> {
42 public:
43     explicit InputMethodSystemAbilityProxy(const sptr<IRemoteObject> &object);
44     ~InputMethodSystemAbilityProxy() = default;
45     DISALLOW_COPY_AND_MOVE(InputMethodSystemAbilityProxy);
46 
47     int32_t PrepareInput(InputClientInfo &inputClientInfo) override;
48     int32_t StartInput(sptr<IInputClient> client, bool isShowKeyboard, bool attachFlag) override;
49     int32_t ShowCurrentInput() override;
50     int32_t HideCurrentInput() override;
51     int32_t StopInputSession() override;
52     int32_t StopInput(sptr<IInputClient> client) override;
53     int32_t ReleaseInput(sptr<IInputClient> client) override;
54     std::shared_ptr<Property> GetCurrentInputMethod() override;
55     std::shared_ptr<SubProperty> GetCurrentInputMethodSubtype() override;
56     int32_t ListInputMethod(InputMethodStatus status, std::vector<Property> &props) override;
57     int32_t SwitchInputMethod(const std::string &name, const std::string &subName) override;
58     int32_t DisplayOptionalInputMethod() override;
59     int32_t SetCoreAndAgent(sptr<IInputMethodCore> core, sptr<IInputMethodAgent> agent) override;
60     int32_t ListCurrentInputMethodSubtype(std::vector<SubProperty> &subProps) override;
61     int32_t ListInputMethodSubtype(const std::string &name, std::vector<SubProperty> &subProps) override;
62     int32_t PanelStatusChange(const InputWindowStatus &status, const InputWindowInfo &windowInfo) override;
63     int32_t UpdateListenEventFlag(InputClientInfo &clientInfo, EventType eventType) override;
64 
65     // Deprecated because of no permission check, kept for compatibility
66     int32_t HideCurrentInputDeprecated() override;
67     int32_t ShowCurrentInputDeprecated() override;
68     int32_t DisplayOptionalInputMethodDeprecated() override;
69 
70 private:
71     static inline BrokerDelegator<InputMethodSystemAbilityProxy> delegator_;
72     using ParcelHandler = std::function<bool(MessageParcel &)>;
73     int32_t SendRequest(int code, ParcelHandler input = nullptr, ParcelHandler output = nullptr);
74 };
75 } // namespace MiscServices
76 } // namespace OHOS
77 #endif // FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_PROXY_H
78