From af368b179587c064e839a331eac9e57c478a3e98 Mon Sep 17 00:00:00 2001 From: ma-shaoyin Date: Tue, 7 Feb 2023 09:43:39 +0800 Subject: [PATCH] Signed-off-by: ma-shaoyin Changes to be committed: --- BUILD.gn | 8 +- README_zh.md | 27 +- bundle.json | 33 +- frameworks/inputmethod_controller/BUILD.gn | 74 --- .../include/input_method_controller.h | 152 ------ .../inputmethod_extension_ability/BUILD.gn | 0 .../inputmethod_extension_ability.js | 0 .../inputmethod_extension_ability_module.cpp | 0 .../inputmethod_extension_context/BUILD.gn | 0 .../inputmethod_extension_context.js | 0 .../inputmethod_extension_context_module.cpp | 0 .../js/napi/inputmethodability/BUILD.gn | 22 +- .../input_method_engine_module.cpp | 0 .../inputmethodability/js_callback_object.cpp | 0 .../inputmethodability/js_callback_object.h | 0 .../js_input_method_engine_setting.cpp | 0 .../js_input_method_engine_setting.h | 0 .../js_keyboard_controller_engine.cpp | 0 .../js_keyboard_controller_engine.h | 0 .../js_keyboard_delegate_setting.cpp | 0 .../js_keyboard_delegate_setting.h | 0 .../js_text_input_client_engine.cpp | 0 .../js_text_input_client_engine.h | 0 .../js/napi/inputmethodclient/BUILD.gn | 6 +- .../js/napi/inputmethodclient/async_call.cpp | 0 .../js/napi/inputmethodclient/async_call.h | 0 .../inputmethodclient/input_method_module.cpp | 0 .../js_get_input_method_controller.cpp | 0 .../js_get_input_method_controller.h | 0 .../js_get_input_method_setting.cpp | 0 .../js_get_input_method_setting.h | 0 .../inputmethodclient/js_input_method.cpp | 0 .../napi/inputmethodclient/js_input_method.h | 0 .../js/napi/inputmethodclient/js_utils.cpp | 0 .../js/napi/inputmethodclient/js_utils.h | 0 frameworks/kits/extension/BUILD.gn | 78 +-- .../{ => native}/inputmethod_ability/BUILD.gn | 17 +- .../include/i_input_method_agent.h | 0 .../include/i_input_method_core.h | 0 .../include/input_method_ability.h | 0 .../include/input_method_agent_proxy.h | 0 .../include/input_method_agent_stub.h | 0 .../include/input_method_core_proxy.h | 0 .../include/input_method_core_stub.h | 0 .../include/input_method_engine_listener.h | 0 .../include/keyboard_listener.h | 0 .../src/input_method_ability.cpp | 0 .../src/input_method_agent_proxy.cpp | 0 .../src/input_method_agent_stub.cpp | 0 .../src/input_method_core_proxy.cpp | 0 .../src/input_method_core_stub.cpp | 0 .../include/i_input_client.h | 0 .../include/i_input_data_channel.h | 0 .../include/input_client_proxy.h | 0 .../include/input_client_stub.h | 0 .../include/input_data_channel_proxy.h | 0 .../include/input_data_channel_stub.h | 0 .../include/input_method_property.h | 0 .../include/input_method_setting_listener.h | 0 .../include/input_method_status.h | 0 .../input_method_system_ability_proxy.h | 0 .../include/input_method_utils.h | 0 .../include/itypes_util.h | 0 .../src/input_client_proxy.cpp | 0 .../src/input_client_stub.cpp | 0 .../src/input_data_channel_proxy.cpp | 0 .../src/input_data_channel_stub.cpp | 0 .../src/input_method_controller.cpp | 0 .../src/input_method_system_ability_proxy.cpp | 0 .../src/input_method_utils.cpp | 0 .../src/itypes_util.cpp | 0 .../inner_api/inputmethod_controller/BUILD.gn | 114 +++++ .../include/input_method_controller.h | 464 ++++++++++++++++++ .../include/visibility.h | 23 + .../inputmethod_client.versionscript | 19 + services/BUILD.gn | 23 +- services/dfx/BUILD.gn | 6 +- test/fuzztest/agentstub_fuzzer/BUILD.gn | 8 +- .../controlchannelstub_fuzzer/BUILD.gn | 8 +- test/fuzztest/corestub_fuzzer/BUILD.gn | 11 +- test/fuzztest/datachannelstub_fuzzer/BUILD.gn | 12 +- test/fuzztest/inputclientstub_fuzzer/BUILD.gn | 15 +- .../inputmethodability_fuzzer/BUILD.gn | 13 +- .../inputmethodcontroller_fuzzer/BUILD.gn | 14 +- test/fuzztest/perusersession_fuzzer/BUILD.gn | 24 +- .../systemabilitystub_fuzzer/BUILD.gn | 21 +- test/unittest/cpp_test/BUILD.gn | 69 ++- 87 files changed, 790 insertions(+), 471 deletions(-) delete mode 100644 frameworks/inputmethod_controller/BUILD.gn delete mode 100644 frameworks/inputmethod_controller/include/input_method_controller.h rename {interfaces/kits => frameworks}/js/napi/inputmethod_extension_ability/BUILD.gn (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethod_extension_ability/inputmethod_extension_ability.js (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethod_extension_ability/inputmethod_extension_ability_module.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethod_extension_context/BUILD.gn (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethod_extension_context/inputmethod_extension_context.js (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethod_extension_context/inputmethod_extension_context_module.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodability/BUILD.gn (68%) rename {interfaces/kits => frameworks}/js/napi/inputmethodability/input_method_engine_module.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodability/js_callback_object.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodability/js_callback_object.h (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodability/js_input_method_engine_setting.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodability/js_input_method_engine_setting.h (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodability/js_keyboard_controller_engine.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodability/js_keyboard_controller_engine.h (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodability/js_keyboard_delegate_setting.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodability/js_keyboard_delegate_setting.h (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodability/js_text_input_client_engine.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodability/js_text_input_client_engine.h (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodclient/BUILD.gn (92%) rename {interfaces/kits => frameworks}/js/napi/inputmethodclient/async_call.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodclient/async_call.h (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodclient/input_method_module.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodclient/js_get_input_method_controller.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodclient/js_get_input_method_controller.h (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodclient/js_get_input_method_setting.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodclient/js_get_input_method_setting.h (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodclient/js_input_method.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodclient/js_input_method.h (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodclient/js_utils.cpp (100%) rename {interfaces/kits => frameworks}/js/napi/inputmethodclient/js_utils.h (100%) rename frameworks/{ => native}/inputmethod_ability/BUILD.gn (72%) rename frameworks/{ => native}/inputmethod_ability/include/i_input_method_agent.h (100%) rename frameworks/{ => native}/inputmethod_ability/include/i_input_method_core.h (100%) rename frameworks/{ => native}/inputmethod_ability/include/input_method_ability.h (100%) rename frameworks/{ => native}/inputmethod_ability/include/input_method_agent_proxy.h (100%) rename frameworks/{ => native}/inputmethod_ability/include/input_method_agent_stub.h (100%) rename frameworks/{ => native}/inputmethod_ability/include/input_method_core_proxy.h (100%) rename frameworks/{ => native}/inputmethod_ability/include/input_method_core_stub.h (100%) rename frameworks/{ => native}/inputmethod_ability/include/input_method_engine_listener.h (100%) rename frameworks/{ => native}/inputmethod_ability/include/keyboard_listener.h (100%) rename frameworks/{ => native}/inputmethod_ability/src/input_method_ability.cpp (100%) rename frameworks/{ => native}/inputmethod_ability/src/input_method_agent_proxy.cpp (100%) rename frameworks/{ => native}/inputmethod_ability/src/input_method_agent_stub.cpp (100%) rename frameworks/{ => native}/inputmethod_ability/src/input_method_core_proxy.cpp (100%) rename frameworks/{ => native}/inputmethod_ability/src/input_method_core_stub.cpp (100%) rename frameworks/{ => native}/inputmethod_controller/include/i_input_client.h (100%) rename frameworks/{ => native}/inputmethod_controller/include/i_input_data_channel.h (100%) rename frameworks/{ => native}/inputmethod_controller/include/input_client_proxy.h (100%) rename frameworks/{ => native}/inputmethod_controller/include/input_client_stub.h (100%) rename frameworks/{ => native}/inputmethod_controller/include/input_data_channel_proxy.h (100%) rename frameworks/{ => native}/inputmethod_controller/include/input_data_channel_stub.h (100%) rename frameworks/{ => native}/inputmethod_controller/include/input_method_property.h (100%) rename frameworks/{ => native}/inputmethod_controller/include/input_method_setting_listener.h (100%) rename frameworks/{ => native}/inputmethod_controller/include/input_method_status.h (100%) rename frameworks/{ => native}/inputmethod_controller/include/input_method_system_ability_proxy.h (100%) rename frameworks/{ => native}/inputmethod_controller/include/input_method_utils.h (100%) rename frameworks/{ => native}/inputmethod_controller/include/itypes_util.h (100%) rename frameworks/{ => native}/inputmethod_controller/src/input_client_proxy.cpp (100%) rename frameworks/{ => native}/inputmethod_controller/src/input_client_stub.cpp (100%) rename frameworks/{ => native}/inputmethod_controller/src/input_data_channel_proxy.cpp (100%) rename frameworks/{ => native}/inputmethod_controller/src/input_data_channel_stub.cpp (100%) rename frameworks/{ => native}/inputmethod_controller/src/input_method_controller.cpp (100%) rename frameworks/{ => native}/inputmethod_controller/src/input_method_system_ability_proxy.cpp (100%) rename frameworks/{ => native}/inputmethod_controller/src/input_method_utils.cpp (100%) rename frameworks/{ => native}/inputmethod_controller/src/itypes_util.cpp (100%) create mode 100644 interfaces/inner_api/inputmethod_controller/BUILD.gn create mode 100644 interfaces/inner_api/inputmethod_controller/include/input_method_controller.h create mode 100644 interfaces/inner_api/inputmethod_controller/include/visibility.h create mode 100644 interfaces/inner_api/inputmethod_controller/inputmethod_client.versionscript diff --git a/BUILD.gn b/BUILD.gn index 1e383438..114772a5 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -21,10 +21,10 @@ group("imf_packages") { "etc/init:inputmethodservice.cfg", "etc/para:inputmethod.para", "etc/para:inputmethod_para", - "frameworks/inputmethod_ability:inputmethod_ability", - "frameworks/inputmethod_controller:inputmethod_client", - "interfaces/kits/js/napi/inputmethodclient:inputmethod", - "interfaces/kits/js/napi/inputmethodengine:inputmethodengine", + "frameworks/js/napi/inputmethodability:inputmethodengine", + "frameworks/js/napi/inputmethodclient:inputmethod", + "frameworks/native/inputmethod_ability:inputmethod_ability", + "interfaces/inner_api/inputmethod_controller:inputmethod_client", "profile:inputmethod_inputmethod_sa_profiles", "services:inputmethod_service", "test/unitest/src:unittest", diff --git a/README_zh.md b/README_zh.md index c4f4920a..7be02be7 100644 --- a/README_zh.md +++ b/README_zh.md @@ -13,15 +13,18 @@ ``` /base/inputmethod/imf -├── figures # 构架图 -├── frameworks/inputmethod_ability # 对输入法客户端提供的接口 -├── frameworks/inputmethod_controller # 对客户端提供的接口 -├── interfaces/kits/js # 组件对外提供的接口代码 -│ └── napi # 输入法框架napi接口 -├── profile # 组件包含的系统服务的配置文件和进程的配置文件 -├── services # 输入法框架服务 -├── test # 接口的Fuzz测试和js单元测试 -└── unitest # 接口的单元测试 +├── figures # 构架图 +├── frameworks +│ └── js/napi # 输入法框架napi接口 +│ └── native +│ └──inputmethod_ability # 对输入法客户端提供的接口 +│ └──inputmethod_controller # 对客户端提供的接口 +├── interfaces # 组件对外提供的接口代码 +│ └── inner_api # innerApi接口 +├── profile # 组件包含的系统服务的配置文件和进程的配置文件 +├── services # 输入法框架服务 +├── test # 接口的Fuzz测试和js单元测试 +└── unitest # 接口的单元测试 ``` ## 框架代码介绍 @@ -29,13 +32,13 @@ 1. 应用客户端 -路径:/base/inputmethod/imf/frameworks/inputmethod_controller +路径:/base/inputmethod/imf/frameworks/native/inputmethod_controller 作用:实现应用和输入法框架服务交付,包括应用与输入法服务的绑定、应用对输入法的显示和隐藏请求等等 2. 输入法客户端 -路径:/base/inputmethod/imf/frameworks/inputmethod_ability +路径:/base/inputmethod/imf/frameworks/native/inputmethod_ability 作用:实现输入法框架服务与输入法交付的中间桥梁,包括监听输入法当前的状态等等 @@ -47,7 +50,7 @@ 4. 输入法Js接口 -路径:/base/inputmethod/imf/interfaces/kits/js +路径:/base/inputmethod/imf/frameworks/js 作用:暂时对外暴露的js接口,主要是留给输入法进行调用使用的 diff --git a/bundle.json b/bundle.json index 6401f9d7..401aab93 100644 --- a/bundle.json +++ b/bundle.json @@ -40,7 +40,14 @@ "ability_base", "safwk", "input", - "c_utils" + "c_utils", + "access_token", + "i18n", + "window_manager", + "os_account", + "hisysevent_native", + "hitrace_native", + "multimedia_image_framework" ], "third_party": [ "jsoncpp" @@ -50,14 +57,14 @@ "group_type": { "base_group": [ ], "fwk_group": [ - "//base/inputmethod/imf/frameworks/inputmethod_ability:inputmethod_ability", - "//base/inputmethod/imf/frameworks/inputmethod_controller:inputmethod_client", + "//base/inputmethod/imf/frameworks/native/inputmethod_ability:inputmethod_ability", + "//base/inputmethod/imf/interfaces/inner_api/inputmethod_controller:inputmethod_client", "//base/inputmethod/imf/frameworks/kits/extension:inputmethod_extension", "//base/inputmethod/imf/frameworks/kits/extension:inputmethod_extension_module", - "//base/inputmethod/imf/interfaces/kits/js/napi/inputmethodclient:inputmethod", - "//base/inputmethod/imf/interfaces/kits/js/napi/inputmethodability:inputmethodengine", - "//base/inputmethod/imf/interfaces/kits/js/napi/inputmethod_extension_ability:inputmethodextensionability_napi", - "//base/inputmethod/imf/interfaces/kits/js/napi/inputmethod_extension_context:inputmethodextensioncontext_napi", + "//base/inputmethod/imf/frameworks/js/napi/inputmethodability:inputmethodengine", + "//base/inputmethod/imf/frameworks/js/napi/inputmethod_extension_ability:inputmethodextensionability_napi", + "//base/inputmethod/imf/frameworks/js/napi/inputmethod_extension_context:inputmethodextensioncontext_napi", + "//base/inputmethod/imf/frameworks/js/napi/inputmethodclient:inputmethod", "//base/inputmethod/imf/services/dfx:inputmethod_dfx_static" ], "service_group": [ @@ -68,17 +75,17 @@ "//base/inputmethod/imf/services:inputmethod_service" ] }, - "inner_kits": [ + "inner_api": [ { - "name": "//base/inputmethod/imf/frameworks/inputmethod_controller:inputmethod_client", + "name": "//base/inputmethod/imf/interfaces/inner_api/inputmethod_controller:inputmethod_client", "header": { "header_files": [ - "i_input_client.h", - "i_input_data_channel.h", + "../../../../frameworks/native/inputmethod_controller/include/i_input_client.h", + "../../../../frameworks/native/inputmethod_controller/include/i_input_data_channel.h", "input_method_controller.h", - "input_method_utils.h" + "../../../../frameworks/native/inputmethod_controller/include/input_method_utils.h" ], - "header_base": "//base/inputmethod/imf/frameworks/inputmethod_controller/include" + "header_base": "//base/inputmethod/imf/interfaces/inner_api/inputmethod_controller/include" } } ], diff --git a/frameworks/inputmethod_controller/BUILD.gn b/frameworks/inputmethod_controller/BUILD.gn deleted file mode 100644 index 4e914449..00000000 --- a/frameworks/inputmethod_controller/BUILD.gn +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//base/inputmethod/imf/inputmethod.gni") -import("//build/ohos.gni") - -config("inputmethod_client_native_config") { - visibility = [ ":*" ] - include_dirs = [ - "include", - "${inputmethod_path}/services/dfx/include", - "//commonlibrary/c_utils/base/include", - "${inputmethod_path}/services/include", - ] -} - -config("inputmethod_client_native_public_config") { - visibility = [] - include_dirs = [ - "//base/inputmethod/imf/frameworks/inputmethod_controller/include", - "//base/inputmethod/imf/frameworks/inputmethod_ability/include", - "//base/inputmethod/imf/services/include", - "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", - "${inputmethod_path}/services/dfx/include", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", - "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include", - "//commonlibrary/c_utils/base/include", - ] -} - -ohos_shared_library("inputmethod_client") { - sources = [ - "${inputmethod_path}/frameworks/inputmethod_ability/src/input_method_agent_proxy.cpp", - "${inputmethod_path}/services/src/message.cpp", - "${inputmethod_path}/services/src/message_handler.cpp", - "src/input_client_proxy.cpp", - "src/input_client_stub.cpp", - "src/input_data_channel_proxy.cpp", - "src/input_data_channel_stub.cpp", - "src/input_method_controller.cpp", - "src/input_method_system_ability_proxy.cpp", - "src/input_method_utils.cpp", - "src/itypes_util.cpp", - ] - - deps = [ - "${inputmethod_path}/services/dfx:inputmethod_dfx_static", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - "//foundation/multimodalinput/input/frameworks/proxy:libmmi-common", - "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", - ] - - external_deps = [ - "c_utils:utils", - "hiviewdfx_hilog_native:libhilog", - ] - - configs = [ ":inputmethod_client_native_config" ] - - public_configs = [ ":inputmethod_client_native_public_config" ] - - subsystem_name = "inputmethod" - part_name = "imf" -} diff --git a/frameworks/inputmethod_controller/include/input_method_controller.h b/frameworks/inputmethod_controller/include/input_method_controller.h deleted file mode 100644 index c476cde3..00000000 --- a/frameworks/inputmethod_controller/include/input_method_controller.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_CONTROLLER_H -#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_CONTROLLER_H - -#include -#include -#include - -#include "global.h" -#include "i_input_client.h" -#include "i_input_data_channel.h" -#include "i_input_method_agent.h" -#include "i_input_method_system_ability.h" -#include "input_method_property.h" -#include "input_method_setting_listener.h" -#include "input_method_status.h" -#include "input_method_utils.h" -#include "ipc_skeleton.h" -#include "iremote_object.h" -#include "key_event.h" -#include "message_handler.h" - -namespace OHOS { -namespace MiscServices { -class OnTextChangedListener : public virtual RefBase { -public: - virtual void InsertText(const std::u16string &text) = 0; - virtual void DeleteForward(int32_t length) = 0; - virtual void DeleteBackward(int32_t length) = 0; - virtual void SendKeyEventFromInputMethod(const KeyEvent &event) = 0; - virtual void SendKeyboardInfo(const KeyboardInfo &info) = 0; - virtual void SetKeyboardStatus(bool status) = 0; - virtual void MoveCursor(const Direction direction) = 0; - virtual void HandleSetSelection(int32_t start, int32_t end) = 0; - virtual void HandleExtendAction(int32_t action) = 0; - virtual void HandleSelect(int32_t keyCode, int32_t cursorMoveSkip) = 0; -}; - -class ImsaDeathRecipient : public IRemoteObject::DeathRecipient { -public: - explicit ImsaDeathRecipient(); - ~ImsaDeathRecipient() = default; - - void OnRemoteDied(const wptr &object) override; -}; - -class InputMethodController : public RefBase { -public: - static sptr GetInstance(); - void Attach(sptr &listener); - void Attach(sptr &listener, bool isShowKeyboard); - void Attach(sptr &listener, bool isShowKeyboard, InputAttribute &attribute); - int32_t GetTextBeforeCursor(int32_t number, std::u16string &text); - int32_t GetTextAfterCursor(int32_t number, std::u16string &text); - int32_t GetTextIndexAtCursor(int32_t &index); - void ShowTextInput(); - void HideTextInput(); - void Close(); - void OnRemoteSaDied(const wptr &object); - void OnCursorUpdate(CursorInfo cursorInfo); - void OnSelectionChange(std::u16string text, int start, int end); - void OnConfigurationChange(Configuration info); - void setImeListener(std::shared_ptr imeListener); - bool dispatchKeyEvent(std::shared_ptr keyEvent); - int32_t ListInputMethod(std::vector &props); - int32_t ListInputMethod(bool enable, std::vector &props); - int32_t ListInputMethodSubtype(const Property &property, std::vector &subProperties); - int32_t ListCurrentInputMethodSubtype(std::vector &subProperties); - int32_t GetEnterKeyType(int32_t &keyType); - int32_t GetInputPattern(int32_t &inputPattern); - std::shared_ptr GetCurrentInputMethod(); - std::shared_ptr GetCurrentInputMethodSubtype(); - void SetCallingWindow(uint32_t windowId); - int32_t SwitchInputMethod(const std::string &name, const std::string &subName = ""); - int32_t ShowSoftKeyboard(); - int32_t HideSoftKeyboard(); - int32_t StopInputSession(); - int32_t ShowOptionalInputMethod(); - - // Deprecated innerkits with no permission check, kept for compatibility - int32_t ShowCurrentInput(); - int32_t HideCurrentInput(); - int32_t DisplayOptionalInputMethod(); - -private: - InputMethodController(); - ~InputMethodController(); - - bool Initialize(); - sptr GetSystemAbilityProxy(); - void PrepareInput( - int32_t displayId, sptr &client, sptr &channel, InputAttribute &attribute); - void StartInput(sptr &client, bool isShowKeyboard); - void StopInput(sptr &client); - void ReleaseInput(sptr &client); - void SetInputMethodAgent(sptr &object); - void OnSwitchInput(const Property &property, const SubProperty &subProperty); - std::shared_ptr GetInputMethodAgent(); - void WorkThread(); - void QuitWorkThread(); - int32_t ListInputMethodCommon(InputMethodStatus status, std::vector &props); - void HandleGetOperation(); - - sptr mInputDataChannel; - std::shared_ptr imeListener_; - sptr mClient; - std::mutex abilityLock_; - sptr abilityManager_ = nullptr; - sptr deathRecipient_; - std::mutex agentLock_; - std::shared_ptr mAgent = nullptr; - std::mutex textListenerLock_; - sptr textListener; - InputAttribute mAttribute; - std::u16string mTextString; - int mSelectOldBegin = 0; - int mSelectOldEnd = 0; - int mSelectNewBegin = 0; - int mSelectNewEnd = 0; - CursorInfo cursorInfo_; - - static std::mutex instanceLock_; - static sptr instance_; - std::thread workThreadHandler; - MessageHandler *msgHandler; - bool stop_; - int32_t enterKeyType_ = 0; - int32_t inputPattern_ = 0; - - bool isStopInput{ true }; - - std::mutex textFieldReplyCountLock_; - uint32_t textFieldReplyCount_{ 0 }; - std::condition_variable textFieldReplyCountCv_; -}; -} // namespace MiscServices -} // namespace OHOS -#endif // FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_CONTROLLER_H diff --git a/interfaces/kits/js/napi/inputmethod_extension_ability/BUILD.gn b/frameworks/js/napi/inputmethod_extension_ability/BUILD.gn similarity index 100% rename from interfaces/kits/js/napi/inputmethod_extension_ability/BUILD.gn rename to frameworks/js/napi/inputmethod_extension_ability/BUILD.gn diff --git a/interfaces/kits/js/napi/inputmethod_extension_ability/inputmethod_extension_ability.js b/frameworks/js/napi/inputmethod_extension_ability/inputmethod_extension_ability.js similarity index 100% rename from interfaces/kits/js/napi/inputmethod_extension_ability/inputmethod_extension_ability.js rename to frameworks/js/napi/inputmethod_extension_ability/inputmethod_extension_ability.js diff --git a/interfaces/kits/js/napi/inputmethod_extension_ability/inputmethod_extension_ability_module.cpp b/frameworks/js/napi/inputmethod_extension_ability/inputmethod_extension_ability_module.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethod_extension_ability/inputmethod_extension_ability_module.cpp rename to frameworks/js/napi/inputmethod_extension_ability/inputmethod_extension_ability_module.cpp diff --git a/interfaces/kits/js/napi/inputmethod_extension_context/BUILD.gn b/frameworks/js/napi/inputmethod_extension_context/BUILD.gn similarity index 100% rename from interfaces/kits/js/napi/inputmethod_extension_context/BUILD.gn rename to frameworks/js/napi/inputmethod_extension_context/BUILD.gn diff --git a/interfaces/kits/js/napi/inputmethod_extension_context/inputmethod_extension_context.js b/frameworks/js/napi/inputmethod_extension_context/inputmethod_extension_context.js similarity index 100% rename from interfaces/kits/js/napi/inputmethod_extension_context/inputmethod_extension_context.js rename to frameworks/js/napi/inputmethod_extension_context/inputmethod_extension_context.js diff --git a/interfaces/kits/js/napi/inputmethod_extension_context/inputmethod_extension_context_module.cpp b/frameworks/js/napi/inputmethod_extension_context/inputmethod_extension_context_module.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethod_extension_context/inputmethod_extension_context_module.cpp rename to frameworks/js/napi/inputmethod_extension_context/inputmethod_extension_context_module.cpp diff --git a/interfaces/kits/js/napi/inputmethodability/BUILD.gn b/frameworks/js/napi/inputmethodability/BUILD.gn similarity index 68% rename from interfaces/kits/js/napi/inputmethodability/BUILD.gn rename to frameworks/js/napi/inputmethodability/BUILD.gn index e40173b1..6d5f51ee 100644 --- a/interfaces/kits/js/napi/inputmethodability/BUILD.gn +++ b/frameworks/js/napi/inputmethodability/BUILD.gn @@ -18,9 +18,9 @@ config("inputmethodengine_native_config") { visibility = [ ":*" ] include_dirs = [ "include", - "${inputmethod_path}/frameworks/inputmethod_ability/include", - "${inputmethod_path}/frameworks/inputmethod_controller/include", - "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include", + "${inputmethod_path}/frameworks/native/inputmethod_ability/include", + "${inputmethod_path}/frameworks/native/inputmethod_controller/include", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller/include", ] ldflags = [ "-Wl,--exclude-libs=ALL" ] cflags = [ @@ -34,17 +34,16 @@ config("inputmethodengine_native_public_config") { visibility = [] include_dirs = [ "include", - "${inputmethod_path}/interfaces/kits/js/napi/inputmethodclient", - "${inputmethod_path}/interfaces/kits/js/napi/inputmethodengine/include", - "${inputmethod_path}/interfaces/kits/js/napi/inputmethodability", + "${inputmethod_path}/frameworks/js/napi/inputmethodclient", + "${inputmethod_path}/frameworks/js/napi/inputmethodability", ] } ohos_shared_library("inputmethodengine") { sources = [ - "${inputmethod_path}/interfaces/kits/js/napi/inputmethodclient/async_call.cpp", - "${inputmethod_path}/interfaces/kits/js/napi/inputmethodclient/js_utils.cpp", - "//base/inputmethod/imf/services/src/global.cpp", + "${inputmethod_path}/frameworks/js/napi/inputmethodclient/async_call.cpp", + "${inputmethod_path}/frameworks/js/napi/inputmethodclient/js_utils.cpp", + "${inputmethod_path}/services/src/global.cpp", "input_method_engine_module.cpp", "js_callback_object.cpp", "js_input_method_engine_setting.cpp", @@ -55,14 +54,13 @@ ohos_shared_library("inputmethodengine") { configs = [ ":inputmethodengine_native_config" ] - deps = [ - "//base/inputmethod/imf/frameworks/inputmethod_ability:inputmethod_ability", - ] + deps = [ "${inputmethod_path}/frameworks/native/inputmethod_ability:inputmethod_ability" ] external_deps = [ "ability_runtime:abilitykit_native", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "input:libmmi-client", "ipc:ipc_core", ] diff --git a/interfaces/kits/js/napi/inputmethodability/input_method_engine_module.cpp b/frameworks/js/napi/inputmethodability/input_method_engine_module.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethodability/input_method_engine_module.cpp rename to frameworks/js/napi/inputmethodability/input_method_engine_module.cpp diff --git a/interfaces/kits/js/napi/inputmethodability/js_callback_object.cpp b/frameworks/js/napi/inputmethodability/js_callback_object.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethodability/js_callback_object.cpp rename to frameworks/js/napi/inputmethodability/js_callback_object.cpp diff --git a/interfaces/kits/js/napi/inputmethodability/js_callback_object.h b/frameworks/js/napi/inputmethodability/js_callback_object.h similarity index 100% rename from interfaces/kits/js/napi/inputmethodability/js_callback_object.h rename to frameworks/js/napi/inputmethodability/js_callback_object.h diff --git a/interfaces/kits/js/napi/inputmethodability/js_input_method_engine_setting.cpp b/frameworks/js/napi/inputmethodability/js_input_method_engine_setting.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethodability/js_input_method_engine_setting.cpp rename to frameworks/js/napi/inputmethodability/js_input_method_engine_setting.cpp diff --git a/interfaces/kits/js/napi/inputmethodability/js_input_method_engine_setting.h b/frameworks/js/napi/inputmethodability/js_input_method_engine_setting.h similarity index 100% rename from interfaces/kits/js/napi/inputmethodability/js_input_method_engine_setting.h rename to frameworks/js/napi/inputmethodability/js_input_method_engine_setting.h diff --git a/interfaces/kits/js/napi/inputmethodability/js_keyboard_controller_engine.cpp b/frameworks/js/napi/inputmethodability/js_keyboard_controller_engine.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethodability/js_keyboard_controller_engine.cpp rename to frameworks/js/napi/inputmethodability/js_keyboard_controller_engine.cpp diff --git a/interfaces/kits/js/napi/inputmethodability/js_keyboard_controller_engine.h b/frameworks/js/napi/inputmethodability/js_keyboard_controller_engine.h similarity index 100% rename from interfaces/kits/js/napi/inputmethodability/js_keyboard_controller_engine.h rename to frameworks/js/napi/inputmethodability/js_keyboard_controller_engine.h diff --git a/interfaces/kits/js/napi/inputmethodability/js_keyboard_delegate_setting.cpp b/frameworks/js/napi/inputmethodability/js_keyboard_delegate_setting.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethodability/js_keyboard_delegate_setting.cpp rename to frameworks/js/napi/inputmethodability/js_keyboard_delegate_setting.cpp diff --git a/interfaces/kits/js/napi/inputmethodability/js_keyboard_delegate_setting.h b/frameworks/js/napi/inputmethodability/js_keyboard_delegate_setting.h similarity index 100% rename from interfaces/kits/js/napi/inputmethodability/js_keyboard_delegate_setting.h rename to frameworks/js/napi/inputmethodability/js_keyboard_delegate_setting.h diff --git a/interfaces/kits/js/napi/inputmethodability/js_text_input_client_engine.cpp b/frameworks/js/napi/inputmethodability/js_text_input_client_engine.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethodability/js_text_input_client_engine.cpp rename to frameworks/js/napi/inputmethodability/js_text_input_client_engine.cpp diff --git a/interfaces/kits/js/napi/inputmethodability/js_text_input_client_engine.h b/frameworks/js/napi/inputmethodability/js_text_input_client_engine.h similarity index 100% rename from interfaces/kits/js/napi/inputmethodability/js_text_input_client_engine.h rename to frameworks/js/napi/inputmethodability/js_text_input_client_engine.h diff --git a/interfaces/kits/js/napi/inputmethodclient/BUILD.gn b/frameworks/js/napi/inputmethodclient/BUILD.gn similarity index 92% rename from interfaces/kits/js/napi/inputmethodclient/BUILD.gn rename to frameworks/js/napi/inputmethodclient/BUILD.gn index 8073d9a5..2b372375 100644 --- a/interfaces/kits/js/napi/inputmethodclient/BUILD.gn +++ b/frameworks/js/napi/inputmethodclient/BUILD.gn @@ -30,6 +30,7 @@ config("imf_public_config") { "-fdata-sections", "-ffunction-sections", "-fvisibility=hidden", + "-Os", ] } @@ -46,14 +47,13 @@ ohos_shared_library("inputmethod") { configs = [ ":imf_config" ] - deps = [ - "${inputmethod_path}/frameworks/inputmethod_controller:inputmethod_client", - ] + deps = [ "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client" ] external_deps = [ "ability_runtime:abilitykit_native", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "input:libmmi-client", ] public_configs = [ ":imf_public_config" ] diff --git a/interfaces/kits/js/napi/inputmethodclient/async_call.cpp b/frameworks/js/napi/inputmethodclient/async_call.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethodclient/async_call.cpp rename to frameworks/js/napi/inputmethodclient/async_call.cpp diff --git a/interfaces/kits/js/napi/inputmethodclient/async_call.h b/frameworks/js/napi/inputmethodclient/async_call.h similarity index 100% rename from interfaces/kits/js/napi/inputmethodclient/async_call.h rename to frameworks/js/napi/inputmethodclient/async_call.h diff --git a/interfaces/kits/js/napi/inputmethodclient/input_method_module.cpp b/frameworks/js/napi/inputmethodclient/input_method_module.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethodclient/input_method_module.cpp rename to frameworks/js/napi/inputmethodclient/input_method_module.cpp diff --git a/interfaces/kits/js/napi/inputmethodclient/js_get_input_method_controller.cpp b/frameworks/js/napi/inputmethodclient/js_get_input_method_controller.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethodclient/js_get_input_method_controller.cpp rename to frameworks/js/napi/inputmethodclient/js_get_input_method_controller.cpp diff --git a/interfaces/kits/js/napi/inputmethodclient/js_get_input_method_controller.h b/frameworks/js/napi/inputmethodclient/js_get_input_method_controller.h similarity index 100% rename from interfaces/kits/js/napi/inputmethodclient/js_get_input_method_controller.h rename to frameworks/js/napi/inputmethodclient/js_get_input_method_controller.h diff --git a/interfaces/kits/js/napi/inputmethodclient/js_get_input_method_setting.cpp b/frameworks/js/napi/inputmethodclient/js_get_input_method_setting.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethodclient/js_get_input_method_setting.cpp rename to frameworks/js/napi/inputmethodclient/js_get_input_method_setting.cpp diff --git a/interfaces/kits/js/napi/inputmethodclient/js_get_input_method_setting.h b/frameworks/js/napi/inputmethodclient/js_get_input_method_setting.h similarity index 100% rename from interfaces/kits/js/napi/inputmethodclient/js_get_input_method_setting.h rename to frameworks/js/napi/inputmethodclient/js_get_input_method_setting.h diff --git a/interfaces/kits/js/napi/inputmethodclient/js_input_method.cpp b/frameworks/js/napi/inputmethodclient/js_input_method.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethodclient/js_input_method.cpp rename to frameworks/js/napi/inputmethodclient/js_input_method.cpp diff --git a/interfaces/kits/js/napi/inputmethodclient/js_input_method.h b/frameworks/js/napi/inputmethodclient/js_input_method.h similarity index 100% rename from interfaces/kits/js/napi/inputmethodclient/js_input_method.h rename to frameworks/js/napi/inputmethodclient/js_input_method.h diff --git a/interfaces/kits/js/napi/inputmethodclient/js_utils.cpp b/frameworks/js/napi/inputmethodclient/js_utils.cpp similarity index 100% rename from interfaces/kits/js/napi/inputmethodclient/js_utils.cpp rename to frameworks/js/napi/inputmethodclient/js_utils.cpp diff --git a/interfaces/kits/js/napi/inputmethodclient/js_utils.h b/frameworks/js/napi/inputmethodclient/js_utils.h similarity index 100% rename from interfaces/kits/js/napi/inputmethodclient/js_utils.h rename to frameworks/js/napi/inputmethodclient/js_utils.h diff --git a/frameworks/kits/extension/BUILD.gn b/frameworks/kits/extension/BUILD.gn index ac4bad4e..38da4b15 100644 --- a/frameworks/kits/extension/BUILD.gn +++ b/frameworks/kits/extension/BUILD.gn @@ -14,35 +14,12 @@ import("//base/inputmethod/imf/inputmethod.gni") import("//build/ohos.gni") -ABILITY_RUNTIME_INNERKITS_PATH = "${ability_runtime_inner_api_path}" - config("ability_config") { visibility = [ ":*" ] include_dirs = [ - "${inputmethod_path}/frameworks/kits/extension/include", - "//commonlibrary/c_utils/base/include", - "${ability_runtime_path}/interfaces/kits/native/ability/native", - "${ability_runtime_path}/interfaces/kits/native/appkit/app", - "${ABILITY_RUNTIME_INNERKITS_PATH}/app_manager/include/appmgr", - "${ABILITY_RUNTIME_INNERKITS_PATH}/ability_manager/include", - "${ability_runtime_services_path}/abilitymgr/include", - "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/app", - "${ability_runtime_path}/interfaces/kits/native/appkit/app", - "${ability_runtime_kits_path}/fmskit/native/include", - "${ability_runtime_path}/interfaces/kits/native/appkit/app", - "${ability_runtime_services_path}/common/include", - - "//base/global/resource_management/interfaces/inner_api/include", - "${ability_runtime_napi_path}/featureAbility", "//foundation/arkui/napi/interfaces/kits", "//third_party/node/src", "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", - "${ability_runtime_path}/interfaces/kits/native/ability/native/continuation/remote_register_service", - "${ability_runtime_path}/interfaces/kits/native/ability/native/continuation/distributed", - "${ability_runtime_path}/interfaces/kits/native/ability/native/distributed_ability_runtime", - "${ABILITY_RUNTIME_INNERKITS_PATH}/ability_manager/include/continuation", - "${ability_runtime_path}/interfaces/kits/native/ability/native/continuation/kits", - "${ability_runtime_path}/interfaces/kits/native/appkit/app/task", "${ability_runtime_napi_path}/inner/napi_common", ] @@ -60,33 +37,15 @@ config("ability_public_config") { visibility = [ ":*" ] include_dirs = [ "${inputmethod_path}/frameworks/kits/extension/include", - "${ABILITY_RUNTIME_INNERKITS_PATH}/base/include", - "${ability_runtime_path}/interfaces/kits/native", - "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/app", - "${ability_runtime_path}/interfaces/kits/native/appkit/app", - "${ability_runtime_path}/interfaces/kits/native/ability_runtime", - "${ability_runtime_path}/interfaces/kits/native/ability/native", "//third_party/libuv/include", - "${ability_runtime_path}/interfaces/kits/native/ability_runtime/context", - "${ability_runtime_path}/interfaces/kits/native/ability/native/continuation/remote_register_service", - "${ability_runtime_path}/interfaces/kits/native/ability/native/continuation/distributed", - "${ability_runtime_path}/interfaces/kits/native/ability/native/distributed_ability_runtime", - "${ABILITY_RUNTIME_INNERKITS_PATH}/ability_manager/include/continuation", - "//base/global/resource_management/interfaces/inner_api/include", - "${ability_runtime_path}/interfaces/kits/native/ability/native/continuation/kits", - "${ability_runtime_kits_path}/fmskit/native/include", - "//foundation/window/window_manager/interfaces/innerkits/wm", - "//foundation/window/window_manager/interfaces/kits/napi/window_runtime/window_stage_napi", - "//third_party/jsoncpp/include", - "//third_party/json/include", ] } ohos_shared_library("inputmethod_extension") { include_dirs = [ "${inputmethod_path}/frameworks/kits/extension/include", - "${inputmethod_path}/frameworks/inputmethod_controller/include", - "//base/global/i18n/frameworks/intl/include", + "${inputmethod_path}/frameworks/native/inputmethod_controller/include", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller/include", "${inputmethod_path}/services/include", "${inputmethod_path}/services/dfx/include", ] @@ -98,15 +57,12 @@ ohos_shared_library("inputmethod_extension") { "${inputmethod_path}/frameworks/kits/extension/src/js_inputmethod_extension_context.cpp", ] configs = [ ":ability_config" ] - public_configs = [ - ":ability_public_config", - "${ability_runtime_path}/frameworks/native/ability:ability_context_public_config", - ] + public_configs = [ ":ability_public_config" ] deps = [ - "${ability_runtime_path}/frameworks/native/appkit:app_context", - "${inputmethod_path}/frameworks/inputmethod_ability:inputmethod_ability", + "${inputmethod_path}/frameworks/native/inputmethod_ability:inputmethod_ability", "${inputmethod_path}/services/dfx:inputmethod_dfx_static", + "//third_party/jsoncpp:jsoncpp", ] external_deps = [ @@ -114,14 +70,15 @@ ohos_shared_library("inputmethod_extension") { "ability_runtime:ability_context_native", "ability_runtime:ability_manager", "ability_runtime:abilitykit_native", + "ability_runtime:app_context", "ability_runtime:runtime", "c_utils:utils", + "hiviewdfx_hilog_native:libhilog", + "i18n:intl_util", "ipc:ipc_napi_common", - ] - - public_deps = [ - "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", - "//foundation/arkui/napi:ace_napi", + "napi:ace_napi", + "resource_management:global_resmgr", + "window_manager:libwm", ] subsystem_name = "inputmethod" @@ -129,11 +86,7 @@ ohos_shared_library("inputmethod_extension") { } ohos_shared_library("inputmethod_extension_module") { - include_dirs = [ - "${ability_runtime_path}/interfaces/kits/native/ability/native", - "${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime", - "${inputmethod_path}/services/include", - ] + include_dirs = [ "${inputmethod_path}/services/include" ] sources = [ "${inputmethod_path}/frameworks/kits/extension/src/inputmethod_extension_module_loader.cpp" ] @@ -142,18 +95,19 @@ ohos_shared_library("inputmethod_extension_module") { deps = [ ":inputmethod_extension", - "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", - "//foundation/window/window_manager/utils:libwmutil", - "//foundation/window/window_manager/wm:libwm", + "//third_party/jsoncpp:jsoncpp", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_base:zuri", + "ability_runtime:abilitykit_native", "ability_runtime:runtime", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "resource_management:global_resmgr", + "window_manager:libwm", ] relative_install_dir = "extensionability/" diff --git a/frameworks/inputmethod_ability/BUILD.gn b/frameworks/native/inputmethod_ability/BUILD.gn similarity index 72% rename from frameworks/inputmethod_ability/BUILD.gn rename to frameworks/native/inputmethod_ability/BUILD.gn index 0cb6d608..76775307 100644 --- a/frameworks/inputmethod_ability/BUILD.gn +++ b/frameworks/native/inputmethod_ability/BUILD.gn @@ -18,9 +18,7 @@ config("inputmethod_ability_native_config") { visibility = [ ":*" ] include_dirs = [ "include", - "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include", - "${inputmethod_path}/frameworks/inputmethod_controller/include", - "${inputmethod_path}/interfaces/kits/js/napi/inputmethodengine/include", + "${inputmethod_path}/frameworks/native/inputmethod_controller/include", "${inputmethod_path}/services/include", ] } @@ -34,13 +32,13 @@ config("inputmethod_ability_native_public_config") { ohos_shared_library("inputmethod_ability") { sources = [ - "${inputmethod_path}/frameworks/inputmethod_controller/src/input_data_channel_proxy.cpp", - "${inputmethod_path}/frameworks/inputmethod_controller/src/itypes_util.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_data_channel_proxy.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_system_ability_proxy.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/itypes_util.cpp", "${inputmethod_path}/services/src/input_channel.cpp", "${inputmethod_path}/services/src/input_control_channel_proxy.cpp", "${inputmethod_path}/services/src/message.cpp", "${inputmethod_path}/services/src/message_handler.cpp", - "../inputmethod_controller/src/input_method_system_ability_proxy.cpp", "src/input_method_ability.cpp", "src/input_method_agent_proxy.cpp", "src/input_method_agent_stub.cpp", @@ -50,14 +48,11 @@ ohos_shared_library("inputmethod_ability") { configs = [ ":inputmethod_ability_native_config" ] - deps = [ - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", - ] - external_deps = [ "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", + "samgr:samgr_proxy", ] public_configs = [ ":inputmethod_ability_native_public_config" ] diff --git a/frameworks/inputmethod_ability/include/i_input_method_agent.h b/frameworks/native/inputmethod_ability/include/i_input_method_agent.h similarity index 100% rename from frameworks/inputmethod_ability/include/i_input_method_agent.h rename to frameworks/native/inputmethod_ability/include/i_input_method_agent.h diff --git a/frameworks/inputmethod_ability/include/i_input_method_core.h b/frameworks/native/inputmethod_ability/include/i_input_method_core.h similarity index 100% rename from frameworks/inputmethod_ability/include/i_input_method_core.h rename to frameworks/native/inputmethod_ability/include/i_input_method_core.h diff --git a/frameworks/inputmethod_ability/include/input_method_ability.h b/frameworks/native/inputmethod_ability/include/input_method_ability.h similarity index 100% rename from frameworks/inputmethod_ability/include/input_method_ability.h rename to frameworks/native/inputmethod_ability/include/input_method_ability.h diff --git a/frameworks/inputmethod_ability/include/input_method_agent_proxy.h b/frameworks/native/inputmethod_ability/include/input_method_agent_proxy.h similarity index 100% rename from frameworks/inputmethod_ability/include/input_method_agent_proxy.h rename to frameworks/native/inputmethod_ability/include/input_method_agent_proxy.h diff --git a/frameworks/inputmethod_ability/include/input_method_agent_stub.h b/frameworks/native/inputmethod_ability/include/input_method_agent_stub.h similarity index 100% rename from frameworks/inputmethod_ability/include/input_method_agent_stub.h rename to frameworks/native/inputmethod_ability/include/input_method_agent_stub.h diff --git a/frameworks/inputmethod_ability/include/input_method_core_proxy.h b/frameworks/native/inputmethod_ability/include/input_method_core_proxy.h similarity index 100% rename from frameworks/inputmethod_ability/include/input_method_core_proxy.h rename to frameworks/native/inputmethod_ability/include/input_method_core_proxy.h diff --git a/frameworks/inputmethod_ability/include/input_method_core_stub.h b/frameworks/native/inputmethod_ability/include/input_method_core_stub.h similarity index 100% rename from frameworks/inputmethod_ability/include/input_method_core_stub.h rename to frameworks/native/inputmethod_ability/include/input_method_core_stub.h diff --git a/frameworks/inputmethod_ability/include/input_method_engine_listener.h b/frameworks/native/inputmethod_ability/include/input_method_engine_listener.h similarity index 100% rename from frameworks/inputmethod_ability/include/input_method_engine_listener.h rename to frameworks/native/inputmethod_ability/include/input_method_engine_listener.h diff --git a/frameworks/inputmethod_ability/include/keyboard_listener.h b/frameworks/native/inputmethod_ability/include/keyboard_listener.h similarity index 100% rename from frameworks/inputmethod_ability/include/keyboard_listener.h rename to frameworks/native/inputmethod_ability/include/keyboard_listener.h diff --git a/frameworks/inputmethod_ability/src/input_method_ability.cpp b/frameworks/native/inputmethod_ability/src/input_method_ability.cpp similarity index 100% rename from frameworks/inputmethod_ability/src/input_method_ability.cpp rename to frameworks/native/inputmethod_ability/src/input_method_ability.cpp diff --git a/frameworks/inputmethod_ability/src/input_method_agent_proxy.cpp b/frameworks/native/inputmethod_ability/src/input_method_agent_proxy.cpp similarity index 100% rename from frameworks/inputmethod_ability/src/input_method_agent_proxy.cpp rename to frameworks/native/inputmethod_ability/src/input_method_agent_proxy.cpp diff --git a/frameworks/inputmethod_ability/src/input_method_agent_stub.cpp b/frameworks/native/inputmethod_ability/src/input_method_agent_stub.cpp similarity index 100% rename from frameworks/inputmethod_ability/src/input_method_agent_stub.cpp rename to frameworks/native/inputmethod_ability/src/input_method_agent_stub.cpp diff --git a/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp b/frameworks/native/inputmethod_ability/src/input_method_core_proxy.cpp similarity index 100% rename from frameworks/inputmethod_ability/src/input_method_core_proxy.cpp rename to frameworks/native/inputmethod_ability/src/input_method_core_proxy.cpp diff --git a/frameworks/inputmethod_ability/src/input_method_core_stub.cpp b/frameworks/native/inputmethod_ability/src/input_method_core_stub.cpp similarity index 100% rename from frameworks/inputmethod_ability/src/input_method_core_stub.cpp rename to frameworks/native/inputmethod_ability/src/input_method_core_stub.cpp diff --git a/frameworks/inputmethod_controller/include/i_input_client.h b/frameworks/native/inputmethod_controller/include/i_input_client.h similarity index 100% rename from frameworks/inputmethod_controller/include/i_input_client.h rename to frameworks/native/inputmethod_controller/include/i_input_client.h diff --git a/frameworks/inputmethod_controller/include/i_input_data_channel.h b/frameworks/native/inputmethod_controller/include/i_input_data_channel.h similarity index 100% rename from frameworks/inputmethod_controller/include/i_input_data_channel.h rename to frameworks/native/inputmethod_controller/include/i_input_data_channel.h diff --git a/frameworks/inputmethod_controller/include/input_client_proxy.h b/frameworks/native/inputmethod_controller/include/input_client_proxy.h similarity index 100% rename from frameworks/inputmethod_controller/include/input_client_proxy.h rename to frameworks/native/inputmethod_controller/include/input_client_proxy.h diff --git a/frameworks/inputmethod_controller/include/input_client_stub.h b/frameworks/native/inputmethod_controller/include/input_client_stub.h similarity index 100% rename from frameworks/inputmethod_controller/include/input_client_stub.h rename to frameworks/native/inputmethod_controller/include/input_client_stub.h diff --git a/frameworks/inputmethod_controller/include/input_data_channel_proxy.h b/frameworks/native/inputmethod_controller/include/input_data_channel_proxy.h similarity index 100% rename from frameworks/inputmethod_controller/include/input_data_channel_proxy.h rename to frameworks/native/inputmethod_controller/include/input_data_channel_proxy.h diff --git a/frameworks/inputmethod_controller/include/input_data_channel_stub.h b/frameworks/native/inputmethod_controller/include/input_data_channel_stub.h similarity index 100% rename from frameworks/inputmethod_controller/include/input_data_channel_stub.h rename to frameworks/native/inputmethod_controller/include/input_data_channel_stub.h diff --git a/frameworks/inputmethod_controller/include/input_method_property.h b/frameworks/native/inputmethod_controller/include/input_method_property.h similarity index 100% rename from frameworks/inputmethod_controller/include/input_method_property.h rename to frameworks/native/inputmethod_controller/include/input_method_property.h diff --git a/frameworks/inputmethod_controller/include/input_method_setting_listener.h b/frameworks/native/inputmethod_controller/include/input_method_setting_listener.h similarity index 100% rename from frameworks/inputmethod_controller/include/input_method_setting_listener.h rename to frameworks/native/inputmethod_controller/include/input_method_setting_listener.h diff --git a/frameworks/inputmethod_controller/include/input_method_status.h b/frameworks/native/inputmethod_controller/include/input_method_status.h similarity index 100% rename from frameworks/inputmethod_controller/include/input_method_status.h rename to frameworks/native/inputmethod_controller/include/input_method_status.h diff --git a/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h b/frameworks/native/inputmethod_controller/include/input_method_system_ability_proxy.h similarity index 100% rename from frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h rename to frameworks/native/inputmethod_controller/include/input_method_system_ability_proxy.h diff --git a/frameworks/inputmethod_controller/include/input_method_utils.h b/frameworks/native/inputmethod_controller/include/input_method_utils.h similarity index 100% rename from frameworks/inputmethod_controller/include/input_method_utils.h rename to frameworks/native/inputmethod_controller/include/input_method_utils.h diff --git a/frameworks/inputmethod_controller/include/itypes_util.h b/frameworks/native/inputmethod_controller/include/itypes_util.h similarity index 100% rename from frameworks/inputmethod_controller/include/itypes_util.h rename to frameworks/native/inputmethod_controller/include/itypes_util.h diff --git a/frameworks/inputmethod_controller/src/input_client_proxy.cpp b/frameworks/native/inputmethod_controller/src/input_client_proxy.cpp similarity index 100% rename from frameworks/inputmethod_controller/src/input_client_proxy.cpp rename to frameworks/native/inputmethod_controller/src/input_client_proxy.cpp diff --git a/frameworks/inputmethod_controller/src/input_client_stub.cpp b/frameworks/native/inputmethod_controller/src/input_client_stub.cpp similarity index 100% rename from frameworks/inputmethod_controller/src/input_client_stub.cpp rename to frameworks/native/inputmethod_controller/src/input_client_stub.cpp diff --git a/frameworks/inputmethod_controller/src/input_data_channel_proxy.cpp b/frameworks/native/inputmethod_controller/src/input_data_channel_proxy.cpp similarity index 100% rename from frameworks/inputmethod_controller/src/input_data_channel_proxy.cpp rename to frameworks/native/inputmethod_controller/src/input_data_channel_proxy.cpp diff --git a/frameworks/inputmethod_controller/src/input_data_channel_stub.cpp b/frameworks/native/inputmethod_controller/src/input_data_channel_stub.cpp similarity index 100% rename from frameworks/inputmethod_controller/src/input_data_channel_stub.cpp rename to frameworks/native/inputmethod_controller/src/input_data_channel_stub.cpp diff --git a/frameworks/inputmethod_controller/src/input_method_controller.cpp b/frameworks/native/inputmethod_controller/src/input_method_controller.cpp similarity index 100% rename from frameworks/inputmethod_controller/src/input_method_controller.cpp rename to frameworks/native/inputmethod_controller/src/input_method_controller.cpp diff --git a/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp b/frameworks/native/inputmethod_controller/src/input_method_system_ability_proxy.cpp similarity index 100% rename from frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp rename to frameworks/native/inputmethod_controller/src/input_method_system_ability_proxy.cpp diff --git a/frameworks/inputmethod_controller/src/input_method_utils.cpp b/frameworks/native/inputmethod_controller/src/input_method_utils.cpp similarity index 100% rename from frameworks/inputmethod_controller/src/input_method_utils.cpp rename to frameworks/native/inputmethod_controller/src/input_method_utils.cpp diff --git a/frameworks/inputmethod_controller/src/itypes_util.cpp b/frameworks/native/inputmethod_controller/src/itypes_util.cpp similarity index 100% rename from frameworks/inputmethod_controller/src/itypes_util.cpp rename to frameworks/native/inputmethod_controller/src/itypes_util.cpp diff --git a/interfaces/inner_api/inputmethod_controller/BUILD.gn b/interfaces/inner_api/inputmethod_controller/BUILD.gn new file mode 100644 index 00000000..8a16e788 --- /dev/null +++ b/interfaces/inner_api/inputmethod_controller/BUILD.gn @@ -0,0 +1,114 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//base/inputmethod/imf/inputmethod.gni") +import("//build/ohos.gni") + +config("inputmethod_client_native_config") { + visibility = [ ":*" ] + include_dirs = [ + "include", + "${inputmethod_path}/frameworks/native/inputmethod_controller/include", + "${inputmethod_path}/services/dfx/include", + "${inputmethod_path}/services/include", + ] +} + +config("inputmethod_client_native_public_config") { + visibility = [] + include_dirs = [ + "include", + "${inputmethod_path}/frameworks/native/inputmethod_controller/include", + "${inputmethod_path}/frameworks/native/inputmethod_ability/include", + "${inputmethod_path}/services/include", + "${inputmethod_path}/services/dfx/include", + ] +} + +ohos_shared_library("inputmethod_client") { + sources = [ + "${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_agent_proxy.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_client_proxy.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_client_stub.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_data_channel_proxy.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_data_channel_stub.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_controller.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_system_ability_proxy.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_utils.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/itypes_util.cpp", + "${inputmethod_path}/services/src/message.cpp", + "${inputmethod_path}/services/src/message_handler.cpp", + ] + + cflags = [ + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + "-Os", + ] + + version_script = "inputmethod_client.versionscript" + + innerapi_tags = [ "platformsdk" ] + + deps = [ "${inputmethod_path}/services/dfx:inputmethod_dfx_static" ] + + public_deps = [ "${inputmethod_path}/services/dfx:inputmethod_dfx_static" ] + + external_deps = [ + "c_utils:utils", + "hiviewdfx_hilog_native:libhilog", + "input:libmmi-client", + "ipc:ipc_single", + "samgr:samgr_proxy", + ] + + configs = [ ":inputmethod_client_native_config" ] + + public_configs = [ ":inputmethod_client_native_public_config" ] + + subsystem_name = "inputmethod" + part_name = "imf" +} + +ohos_static_library("inputmethod_client_static") { + testonly = true + sources = [ + "${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_agent_proxy.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_client_proxy.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_client_stub.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_data_channel_proxy.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_data_channel_stub.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_controller.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_system_ability_proxy.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_utils.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/itypes_util.cpp", + "${inputmethod_path}/services/src/message.cpp", + "${inputmethod_path}/services/src/message_handler.cpp", + ] + + public_configs = [ ":inputmethod_client_native_public_config" ] + + public_deps = [ "${inputmethod_path}/services/dfx:inputmethod_dfx_static" ] + + external_deps = [ + "c_utils:utils", + "hiviewdfx_hilog_native:libhilog", + "input:libmmi-client", + "ipc:ipc_single", + "samgr:samgr_proxy", + ] + + subsystem_name = "inputmethod" + part_name = "imf" +} diff --git a/interfaces/inner_api/inputmethod_controller/include/input_method_controller.h b/interfaces/inner_api/inputmethod_controller/include/input_method_controller.h new file mode 100644 index 00000000..920f65b4 --- /dev/null +++ b/interfaces/inner_api/inputmethod_controller/include/input_method_controller.h @@ -0,0 +1,464 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_CONTROLLER_H +#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_CONTROLLER_H + +#include +#include +#include + +#include "global.h" +#include "i_input_client.h" +#include "i_input_data_channel.h" +#include "i_input_method_agent.h" +#include "i_input_method_system_ability.h" +#include "input_method_property.h" +#include "input_method_setting_listener.h" +#include "input_method_status.h" +#include "input_method_utils.h" +#include "ipc_skeleton.h" +#include "iremote_object.h" +#include "key_event.h" +#include "message_handler.h" +#include "visibility.h" + +namespace OHOS { +namespace MiscServices { +class OnTextChangedListener : public virtual RefBase { +public: + virtual void InsertText(const std::u16string &text) = 0; + virtual void DeleteForward(int32_t length) = 0; + virtual void DeleteBackward(int32_t length) = 0; + virtual void SendKeyEventFromInputMethod(const KeyEvent &event) = 0; + virtual void SendKeyboardInfo(const KeyboardInfo &info) = 0; + virtual void SetKeyboardStatus(bool status) = 0; + virtual void MoveCursor(const Direction direction) = 0; + virtual void HandleSetSelection(int32_t start, int32_t end) = 0; + virtual void HandleExtendAction(int32_t action) = 0; + virtual void HandleSelect(int32_t keyCode, int32_t cursorMoveSkip) = 0; +}; + +class ImsaDeathRecipient : public IRemoteObject::DeathRecipient { +public: + explicit ImsaDeathRecipient(); + ~ImsaDeathRecipient() = default; + + void OnRemoteDied(const wptr &object) override; +}; + +class InputMethodController : public RefBase { +public: + /** + * @brief Get the instance of InputMethodController. + * + * This function is used to get the instance of InputMethodController. + * + * @return The instance of InputMethodController. + * @since 6 + */ + IMF_API static sptr GetInstance(); + + /** + * @brief Show soft keyboard, set listener and bind IMSA with default states and attribute. + * + * This function is used to show soft keyboard, set listener and bind IMSA, + * default state is 'true', default attribute is 'InputAttribute::PATTERN_TEXT'. + * + * @param listener Indicates the listener in order to manipulate text. + * @since 6 + */ + IMF_API void Attach(sptr &listener); + + /** + * @brief Set listener and bind IMSA with given states and default attribute. + * + * This function is used to set listener and bind IMSA, + * default attribute is 'InputAttribute::PATTERN_TEXT'. Show soft keyboard when state is true. + * + * @param listener Indicates the listener in order to manipulate text. + * @param isShowKeyboard Indicates the state, if you want to show soft keyboard, please pass in true. + * @since 8 + */ + IMF_API void Attach(sptr &listener, bool isShowKeyboard); + + /** + * @brief Set listener and bind IMSA with given states and attribute. + * + * This function is used to set listener and bind IMSA. + * Show soft keyboard when state is true, and customized attribute. + * + * @param listener Indicates the listener in order to manipulate text. + * @param isShowKeyboard Indicates the state, if you want to show soft keyboard, please pass in true. + * @param attribute Indicates the attribute, such as input pattern, enter eyType, input option. + * @since 8 + */ + IMF_API void Attach(sptr &listener, bool isShowKeyboard, InputAttribute &attribute); + + /** + * @brief Get text before cursor. + * + * This function is used to get text before cursor. + * + * @param number Indicates the number of text before the cursor that will be obtained. + * @param text Indicates the text before the cursor that will be obtained. + * @return Returns 0 for success, others for failure. + * @since 6 + */ + IMF_API int32_t GetTextBeforeCursor(int32_t number, std::u16string &text); + + /** + * @brief Get text after cursor. + * + * This function is used to get text after cursor. + * + * @param number Indicates the number of text after the cursor that will be obtained. + * @param text Indicates the text after the cursor that will be obtained. + * @return Returns 0 for success, others for failure. + * @since 6 + */ + IMF_API int32_t GetTextAfterCursor(int32_t number, std::u16string &text); + IMF_API int32_t GetTextIndexAtCursor(int32_t &index); + + /** + * @brief Show soft keyboard. + * + * This function is used to show soft keyboard of current client. + * + * @since 6 + */ + IMF_API void ShowTextInput(); + + /** + * @brief Hide soft keyboard. + * + * This function is used to hide soft keyboard of current client, and keep binding. + * + * @since 6 + */ + IMF_API void HideTextInput(); + + /** + * @brief Hide current input method, clear text listener and unbind IMSA. + * + * This function is used to stop input, whick will set listener to nullptr, + * hide current soft keyboard and unbind IMSA. + * + * @since 6 + */ + IMF_API void Close(); + + /** + * @brief A callback function when input method service died. + * + * This function is the callback when input method service died. + * + * @param object Remote object. + * @since 6 + */ + void OnRemoteSaDied(const wptr &object); + + /** + * @brief A callback function when the cursor changes. + * + * This function is the callback when the cursor changes. + * + * @param cursorInfo Indicates the information of current cursor changes. + * @since 6 + */ + IMF_API void OnCursorUpdate(CursorInfo cursorInfo); + + /** + * @brief A callback function when the cursor changes. + * + * This function is the callback when the cursor changes. + * + * @param text Indicates the currently selected text. + * @param start Indicates the coordinates of the current start. + * @param end Indicates the coordinates of the current end. + * @since 6 + */ + IMF_API void OnSelectionChange(std::u16string text, int start, int end); + + /** + * @brief Changing the configuration of soft keyboard. + * + * This function is used to change the configuration of soft keyboard. + * + * @param info Indicates the current configuration. + * @since 6 + */ + IMF_API void OnConfigurationChange(Configuration info); + + /** + * @brief Set InputMethodSettingListener listener. + * + * This function is used to set InputMethodSettingListener listener to facilitate listening input method changes. + * + * @param imeListener Indicates the listener to be set. + * @since 6 + */ + IMF_API void setImeListener(std::shared_ptr imeListener); + + /** + * @brief Dispatch keyboard event. + * + * This function is used to Dispatch events of keyboard. + * + * @param keyEvent Indicates the events keyboard. + * @return Returns true for success otherwise for failure. + * @since 6 + */ + IMF_API bool dispatchKeyEvent(std::shared_ptr keyEvent); + + /** + * @brief List input methods. + * + * This function is used to list all of input methods. + * + * @param props Indicates the input methods that will be listed. + * @return Returns 0 for success, others for failure. + * @since 6 + */ + IMF_API int32_t ListInputMethod(std::vector &props); + + /** + * @brief List input methods. + * + * This function is used to list enabled or disabled input methods. + * + * @param props Indicates the input methods that will be listed. + * @param enable Indicates the state of input method. + * @return Returns 0 for success, others for failure. + * @since 6 + */ + IMF_API int32_t ListInputMethod(bool enable, std::vector &props); + + /** + * @brief List input method subtypes. + * + * This function is used to list specified input method subtypes. + * + * @param property Indicates the specified input method property. + * @param subProperties Indicates the subtypes of specified input method that will be listed. + * @return Returns 0 for success, others for failure. + * @since 6 + */ + IMF_API int32_t ListInputMethodSubtype(const Property &property, std::vector &subProperties); + + /** + * @brief List current input method subtypes. + * + * This function is used to list current input method subtypes. + * + * @param subProperties Indicates the subtypes of current input method that will be listed. + * @return Returns 0 for success, others for failure. + * @since 6 + */ + IMF_API int32_t ListCurrentInputMethodSubtype(std::vector &subProperties); + + /** + * @brief Get enter key type. + * + * This function is used to get enter key type of current client. + * + * @param keyType Indicates the enter key type of current client that will be obtained, such as SEND, SEARCH... + * @return Returns 0 for success, others for failure. + * @since 6 + */ + IMF_API int32_t GetEnterKeyType(int32_t &keyType); + + /** + * @brief Get input pattern. + * + * This function is used to get text input type of current client. + * + * @param inputPattern Indicates the text input type of current client that will be obtained, such as TEXT, URL... + * @return Returns 0 for success, others for failure. + * @since 6 + */ + IMF_API int32_t GetInputPattern(int32_t &inputPattern); + + /** + * @brief Get current input method property. + * + * This function is used to get current input method property. + * + * @return The property of current input method. + * @since 6 + */ + IMF_API std::shared_ptr GetCurrentInputMethod(); + + /** + * @brief Get current input method subtypes. + * + * This function is used to get current input method subtypes. + * + * @return The subtypes of current input method. + * @since 6 + */ + IMF_API std::shared_ptr GetCurrentInputMethodSubtype(); + + /** + * @brief Set calling window id. + * + * This function is used to set calling window id to input method. + * + * @param windowId Indicates the window id. + * @since 6 + */ + IMF_API void SetCallingWindow(uint32_t windowId); + + /** + * @brief Switch input method or subtype. + * + * This function is used to switch input method or subtype. + * + * @param name Indicates the id of target input method. + * @param subName Optional parameter. Indicates the subtype of target input method. + * @return Returns 0 for success, others for failure. + * @since 8 + */ + IMF_API int32_t SwitchInputMethod(const std::string &name, const std::string &subName = ""); + + /** + * @brief Show soft keyboard. + * + * This function is used to show soft keyboard of current client. + * + * @return Returns 0 for success, others for failure. + * @since 6 + */ + IMF_API int32_t ShowSoftKeyboard(); + + /** + * @brief Hide soft keyboard. + * + * This function is used to hide soft keyboard of current client, and keep binding. + * + * @return Returns 0 for success, others for failure. + * @since 6 + */ + IMF_API int32_t HideSoftKeyboard(); + + /** + * @brief Stop current input session. + * + * This function is used to stop current input session. + * + * @return Returns 0 for success, others for failure. + * @since 6 + */ + IMF_API int32_t StopInputSession(); + + /** + * @brief Show input method setting extension dialog. + * + * This function is used to show input method setting extension dialog. + * + * @return Returns 0 for success, others for failure. + * @since 8 + */ + IMF_API int32_t ShowOptionalInputMethod(); + + // Deprecated innerkits with no permission check, kept for compatibility + + /** + * @brief Show soft keyboard. + * + * This function is used to show soft keyboard of current client. + * + * @return Returns 0 for success, others for failure. + * @deprecated since 9 + * @since 6 + */ + IMF_API int32_t ShowCurrentInput(); + + /** + * @brief Hide soft keyboard. + * + * This function is used to hide soft keyboard of current client, and keep binding. + * + * @return Returns 0 for success, others for failure. + * @deprecated since 9 + * @since 6 + */ + IMF_API int32_t HideCurrentInput(); + + /** + * @brief Show input method setting extension dialog. + * + * This function is used to show input method setting extension dialog. + * + * @return Returns 0 for success, others for failure. + * @deprecated since 9 + * @since 6 + */ + IMF_API int32_t DisplayOptionalInputMethod(); + +private: + InputMethodController(); + ~InputMethodController(); + + bool Initialize(); + sptr GetSystemAbilityProxy(); + void PrepareInput( + int32_t displayId, sptr &client, sptr &channel, InputAttribute &attribute); + void StartInput(sptr &client, bool isShowKeyboard); + void StopInput(sptr &client); + void ReleaseInput(sptr &client); + void SetInputMethodAgent(sptr &object); + void OnSwitchInput(const Property &property, const SubProperty &subProperty); + std::shared_ptr GetInputMethodAgent(); + void WorkThread(); + void QuitWorkThread(); + int32_t ListInputMethodCommon(InputMethodStatus status, std::vector &props); + void HandleGetOperation(); + + sptr mInputDataChannel; + std::shared_ptr imeListener_; + sptr mClient; + std::mutex abilityLock_; + sptr abilityManager_ = nullptr; + sptr deathRecipient_; + std::mutex agentLock_; + std::shared_ptr mAgent = nullptr; + std::mutex textListenerLock_; + sptr textListener; + InputAttribute mAttribute; + std::u16string mTextString; + int mSelectOldBegin = 0; + int mSelectOldEnd = 0; + int mSelectNewBegin = 0; + int mSelectNewEnd = 0; + CursorInfo cursorInfo_; + + static std::mutex instanceLock_; + static sptr instance_; + std::thread workThreadHandler; + MessageHandler *msgHandler; + bool stop_; + int32_t enterKeyType_ = 0; + int32_t inputPattern_ = 0; + + bool isStopInput{ true }; + + std::mutex textFieldReplyCountLock_; + uint32_t textFieldReplyCount_{ 0 }; + std::condition_variable textFieldReplyCountCv_; +}; +} // namespace MiscServices +} // namespace OHOS +#endif // FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_CONTROLLER_H diff --git a/interfaces/inner_api/inputmethod_controller/include/visibility.h b/interfaces/inner_api/inputmethod_controller/include/visibility.h new file mode 100644 index 00000000..f6828f2b --- /dev/null +++ b/interfaces/inner_api/inputmethod_controller/include/visibility.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OH_IMF_VISIBILITY_H +#define OH_IMF_VISIBILITY_H + +#ifndef IMF_API +#define IMF_API __attribute__ ((visibility ("default"))) +#endif + +#endif // OH_IMF_VISIBILITY_H diff --git a/interfaces/inner_api/inputmethod_controller/inputmethod_client.versionscript b/interfaces/inner_api/inputmethod_controller/inputmethod_client.versionscript new file mode 100644 index 00000000..46292639 --- /dev/null +++ b/interfaces/inner_api/inputmethod_controller/inputmethod_client.versionscript @@ -0,0 +1,19 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +1.0 { + global: + *InputMethodController*; + local: + *; +}; diff --git a/services/BUILD.gn b/services/BUILD.gn index a73f017a..b759a6d7 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -18,11 +18,8 @@ config("inputmethod_services_native_config") { visibility = [ ":*" ] include_dirs = [ "include", - "${inputmethod_path}/frameworks/inputmethod_ability/include", - "${inputmethod_path}/frameworks/inputmethod_controller/include", - "//base/notification/common_event_service/frameworks/core/include", - "//base/notification/common_event_service/interfaces/innerkits/native/include", - "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include", + "${inputmethod_path}/frameworks/native/inputmethod_ability/include", + "${inputmethod_path}/frameworks/native/inputmethod_controller/include", "${inputmethod_path}/services/adapter/keyboard/include", "${inputmethod_path}/services/dfx/include", ] @@ -32,7 +29,7 @@ config("inputmethod_services_native_config") { ohos_shared_library("inputmethod_service") { sources = [ - "${inputmethod_path}/frameworks/inputmethod_controller/src/input_client_proxy.cpp", + "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_client_proxy.cpp", "src/global.cpp", "src/im_common_event_manager.cpp", "src/ime_cfg_manager.cpp", @@ -52,20 +49,15 @@ ohos_shared_library("inputmethod_service") { public_configs = [ ":inputmethod_services_native_config" ] deps = [ - "${ability_runtime_inner_api_path}/ability_manager:ability_manager", + "${inputmethod_path}/frameworks/native/inputmethod_ability:inputmethod_ability", "${inputmethod_path}/services/adapter/keyboard:keboard_event_static", "${inputmethod_path}/services/dfx:inputmethod_dfx_static", - "//base/global/resource_management/frameworks/resmgr:global_resmgr", - "//base/inputmethod/imf/frameworks/inputmethod_ability:inputmethod_ability", - "//foundation/arkui/ace_engine/interfaces/inner_api/ui_service_manager:ui_service_mgr", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - "//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk:system_ability_fwk", - "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "//third_party/jsoncpp:jsoncpp", ] external_deps = [ "ability_base:want", + "ability_runtime:ability_manager", "access_token:libaccesstoken_sdk", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", @@ -75,7 +67,12 @@ ohos_shared_library("inputmethod_service") { "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "init:libbegetutil", + "input:libmmi-client", + "ipc:ipc_single", "os_account:os_account_innerkits", + "resource_management:global_resmgr", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", ] subsystem_name = "inputmethod" diff --git a/services/dfx/BUILD.gn b/services/dfx/BUILD.gn index 2ebffec7..2586f47e 100644 --- a/services/dfx/BUILD.gn +++ b/services/dfx/BUILD.gn @@ -26,11 +26,6 @@ ohos_static_library("inputmethod_dfx_static") { "${inputmethod_path}/services/include", ] - deps = [ - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - "//foundation/communication/ipc/interfaces/innerkits/ipc_single:ipc_single", - ] - cflags_cc = [ "-fvisibility=hidden" ] external_deps = [ @@ -39,6 +34,7 @@ ohos_static_library("inputmethod_dfx_static") { "hitrace_native:hitrace_meter", "hitrace_native:libhitracechain", "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", ] subsystem_name = "inputmethod" part_name = "imf" diff --git a/test/fuzztest/agentstub_fuzzer/BUILD.gn b/test/fuzztest/agentstub_fuzzer/BUILD.gn index 0dcf66bd..341aa45c 100644 --- a/test/fuzztest/agentstub_fuzzer/BUILD.gn +++ b/test/fuzztest/agentstub_fuzzer/BUILD.gn @@ -25,7 +25,7 @@ ohos_fuzztest("AgentStubFuzzTest") { fuzz_config_file = "//base/inputmethod/imf/test/fuzztest/agentstub_fuzzer" include_dirs = - [ "//base/inputmethod/imf/frameworks/inputmethod_ability/include" ] + [ "${inputmethod_path}/frameworks/native/inputmethod_ability/include" ] cflags = [ "-g", @@ -36,14 +36,12 @@ ohos_fuzztest("AgentStubFuzzTest") { sources = [ "agentstub_fuzzer.cpp" ] - deps = [ - "//base/inputmethod/imf/frameworks/inputmethod_ability:inputmethod_ability", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - ] + deps = [ "${inputmethod_path}/frameworks/native/inputmethod_ability:inputmethod_ability" ] external_deps = [ "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", ] } diff --git a/test/fuzztest/controlchannelstub_fuzzer/BUILD.gn b/test/fuzztest/controlchannelstub_fuzzer/BUILD.gn index efd9a539..99dc3dc7 100644 --- a/test/fuzztest/controlchannelstub_fuzzer/BUILD.gn +++ b/test/fuzztest/controlchannelstub_fuzzer/BUILD.gn @@ -25,7 +25,7 @@ ohos_fuzztest("ControlChannelStubFuzzTest") { fuzz_config_file = "//base/inputmethod/imf/test/fuzztest/controlchannelstub_fuzzer" - include_dirs = [ "//base/inputmethod/imf/services/include" ] + include_dirs = [ "${inputmethod_path}/services/include" ] cflags = [ "-g", @@ -36,14 +36,12 @@ ohos_fuzztest("ControlChannelStubFuzzTest") { sources = [ "controlchannelstub_fuzzer.cpp" ] - deps = [ - "//base/inputmethod/imf/services:inputmethod_service", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - ] + deps = [ "${inputmethod_path}/services:inputmethod_service" ] external_deps = [ "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", ] } diff --git a/test/fuzztest/corestub_fuzzer/BUILD.gn b/test/fuzztest/corestub_fuzzer/BUILD.gn index df336a1a..2198ccd9 100644 --- a/test/fuzztest/corestub_fuzzer/BUILD.gn +++ b/test/fuzztest/corestub_fuzzer/BUILD.gn @@ -25,8 +25,9 @@ ohos_fuzztest("CoreStubFuzzTest") { fuzz_config_file = "//base/inputmethod/imf/test/fuzztest/corestub_fuzzer" include_dirs = [ - "//base/inputmethod/imf/frameworks/inputmethod_controller/include", - "//base/inputmethod/imf/frameworks/inputmethod_ability/include", + "${inputmethod_path}/frameworks/native/inputmethod_controller/include", + "${inputmethod_path}/frameworks/native/inputmethod_ability/include", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller/include", ] cflags = [ @@ -38,14 +39,12 @@ ohos_fuzztest("CoreStubFuzzTest") { sources = [ "corestub_fuzzer.cpp" ] - deps = [ - "//base/inputmethod/imf/frameworks/inputmethod_ability:inputmethod_ability", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - ] + deps = [ "${inputmethod_path}/frameworks/native/inputmethod_ability:inputmethod_ability" ] external_deps = [ "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", ] } diff --git a/test/fuzztest/datachannelstub_fuzzer/BUILD.gn b/test/fuzztest/datachannelstub_fuzzer/BUILD.gn index 430df54a..f03387ef 100644 --- a/test/fuzztest/datachannelstub_fuzzer/BUILD.gn +++ b/test/fuzztest/datachannelstub_fuzzer/BUILD.gn @@ -25,8 +25,10 @@ ohos_fuzztest("DataChannelStubFuzzTest") { fuzz_config_file = "//base/inputmethod/imf/test/fuzztest/datachannelstub_fuzzer" - include_dirs = - [ "//base/inputmethod/imf/frameworks/inputmethod_controller/include" ] + include_dirs = [ + "${inputmethod_path}/frameworks/native/inputmethod_controller/include", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller/include", + ] cflags = [ "-g", @@ -37,14 +39,12 @@ ohos_fuzztest("DataChannelStubFuzzTest") { sources = [ "datachannelstub_fuzzer.cpp" ] - deps = [ - "//base/inputmethod/imf/frameworks/inputmethod_controller:inputmethod_client", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - ] + deps = [ "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static" ] external_deps = [ "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", ] } diff --git a/test/fuzztest/inputclientstub_fuzzer/BUILD.gn b/test/fuzztest/inputclientstub_fuzzer/BUILD.gn index ac9812b3..e6a608ad 100644 --- a/test/fuzztest/inputclientstub_fuzzer/BUILD.gn +++ b/test/fuzztest/inputclientstub_fuzzer/BUILD.gn @@ -25,11 +25,7 @@ ohos_fuzztest("InputClientStubFuzzTest") { fuzz_config_file = "//base/inputmethod/imf/test/fuzztest/inputclientstub_fuzzer" - include_dirs = [ - "//base/inputmethod/imf/services/include", - "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager/include/appmgr", - "//foundation/ability/ability_runtime/services/abilitymgr/include", - ] + include_dirs = [ "${inputmethod_path}/services/include" ] cflags = [ "-g", @@ -41,15 +37,16 @@ ohos_fuzztest("InputClientStubFuzzTest") { sources = [ "inputclientstub_fuzzer.cpp" ] deps = [ - "//base/inputmethod/imf/frameworks/inputmethod_ability:inputmethod_ability", - "//base/inputmethod/imf/frameworks/inputmethod_controller:inputmethod_client", - "//base/inputmethod/imf/services:inputmethod_service", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", + "${inputmethod_path}/frameworks/native/inputmethod_ability:inputmethod_ability", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static", + "${inputmethod_path}/services:inputmethod_service", ] external_deps = [ + "ability_runtime:ability_manager", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", ] } diff --git a/test/fuzztest/inputmethodability_fuzzer/BUILD.gn b/test/fuzztest/inputmethodability_fuzzer/BUILD.gn index a1aaf672..b151a755 100644 --- a/test/fuzztest/inputmethodability_fuzzer/BUILD.gn +++ b/test/fuzztest/inputmethodability_fuzzer/BUILD.gn @@ -25,11 +25,7 @@ ohos_fuzztest("InputMethodAbilityFuzzTest") { fuzz_config_file = "//base/inputmethod/imf/test/fuzztest/inputmethodability_fuzzer" - include_dirs = [ - "//base/inputmethod/imf/services/include", - "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager/include/appmgr", - "//foundation/ability/ability_runtime/services/abilitymgr/include", - ] + include_dirs = [ "${inputmethod_path}/services/include" ] cflags = [ "-g", @@ -41,14 +37,15 @@ ohos_fuzztest("InputMethodAbilityFuzzTest") { sources = [ "inputmethodability_fuzzer.cpp" ] deps = [ - "//base/inputmethod/imf/frameworks/inputmethod_ability:inputmethod_ability", - "//base/inputmethod/imf/services:inputmethod_service", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", + "${inputmethod_path}/frameworks/native/inputmethod_ability:inputmethod_ability", + "${inputmethod_path}/services:inputmethod_service", ] external_deps = [ + "ability_runtime:ability_manager", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", ] } diff --git a/test/fuzztest/inputmethodcontroller_fuzzer/BUILD.gn b/test/fuzztest/inputmethodcontroller_fuzzer/BUILD.gn index bf9bf8b1..ebc65517 100644 --- a/test/fuzztest/inputmethodcontroller_fuzzer/BUILD.gn +++ b/test/fuzztest/inputmethodcontroller_fuzzer/BUILD.gn @@ -25,11 +25,7 @@ ohos_fuzztest("InputMethodControllerFuzzTest") { fuzz_config_file = "//base/inputmethod/imf/test/fuzztest/inputmethodcontroller_fuzzer" - include_dirs = [ - "//base/inputmethod/imf/services/include", - "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager/include/appmgr", - "//foundation/ability/ability_runtime/services/abilitymgr/include", - ] + include_dirs = [ "${inputmethod_path}/services/include" ] cflags = [ "-g", @@ -41,14 +37,16 @@ ohos_fuzztest("InputMethodControllerFuzzTest") { sources = [ "inputmethodcontroller_fuzzer.cpp" ] deps = [ - "//base/inputmethod/imf/frameworks/inputmethod_controller:inputmethod_client", - "//base/inputmethod/imf/services:inputmethod_service", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static", + "${inputmethod_path}/services:inputmethod_service", ] external_deps = [ + "ability_runtime:ability_manager", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "input:libmmi-client", + "ipc:ipc_single", ] } diff --git a/test/fuzztest/perusersession_fuzzer/BUILD.gn b/test/fuzztest/perusersession_fuzzer/BUILD.gn index 0a5e88bd..f3b19bb3 100644 --- a/test/fuzztest/perusersession_fuzzer/BUILD.gn +++ b/test/fuzztest/perusersession_fuzzer/BUILD.gn @@ -26,14 +26,9 @@ ohos_fuzztest("PerUserSessionFuzzTest") { "//base/inputmethod/imf/test/fuzztest/perusersession_fuzzer" include_dirs = [ - "//base/inputmethod/imf/services/include", - "//base/inputmethod/imf/frameworks/inputmethod_controller/include", - "//base/inputmethod/imf/services/include", - "//foundation/ability/ability_runtime/services/abilitymgr/include", - "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "//third_party/jsoncpp/include", - "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager/include/appmgr", - "//foundation/multimedia/image_framework/interfaces/innerkits/include", + "${inputmethod_path}/services/include", + "${inputmethod_path}/frameworks/native/inputmethod_controller/include", + "${inputmethod_path}/interfaces/inner_api/include", ] cflags = [ @@ -46,18 +41,19 @@ ohos_fuzztest("PerUserSessionFuzzTest") { sources = [ "perusersession_fuzzer.cpp" ] deps = [ - "//base/inputmethod/imf/frameworks/inputmethod_ability:inputmethod_ability", - "//base/inputmethod/imf/frameworks/inputmethod_controller:inputmethod_client", - "//base/inputmethod/imf/services:inputmethod_service", - "//foundation/arkui/napi:ace_napi", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", + "${inputmethod_path}/frameworks/native/inputmethod_ability:inputmethod_ability", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static", + "${inputmethod_path}/services:inputmethod_service", + "//third_party/jsoncpp:jsoncpp", ] external_deps = [ "ability_runtime:ability_manager", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", - "ipc:ipc_core", + "ipc:ipc_single", + "multimedia_image_framework:image_native", + "napi:ace_napi", ] } diff --git a/test/fuzztest/systemabilitystub_fuzzer/BUILD.gn b/test/fuzztest/systemabilitystub_fuzzer/BUILD.gn index 424f4fec..4ed7fb1b 100644 --- a/test/fuzztest/systemabilitystub_fuzzer/BUILD.gn +++ b/test/fuzztest/systemabilitystub_fuzzer/BUILD.gn @@ -25,15 +25,7 @@ ohos_fuzztest("SystemAbilityStubFuzzTest") { fuzz_config_file = "//base/inputmethod/imf/test/fuzztest/systemabilitystub_fuzzer" - include_dirs = [ - "//base/inputmethod/imf/services/include", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", - "//commonlibrary/c_utils/base/include", - "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "//third_party/jsoncpp/include", - "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager/include/appmgr", - "//foundation/ability/ability_runtime/services/abilitymgr/include", - ] + include_dirs = [ "${inputmethod_path}/services/include" ] cflags = [ "-g", @@ -45,20 +37,21 @@ ohos_fuzztest("SystemAbilityStubFuzzTest") { sources = [ "systemabilitystub_fuzzer.cpp" ] deps = [ - "//base/inputmethod/imf/frameworks/inputmethod_controller:inputmethod_client", - "//base/inputmethod/imf/services:inputmethod_service", - "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - "//foundation/communication/ipc/interfaces/innerkits/ipc_single:ipc_single", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static", + "${inputmethod_path}/services:inputmethod_service", + "//third_party/jsoncpp:jsoncpp", ] external_deps = [ "ability_runtime:ability_manager", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", + "access_token:libtoken_setproc", "bundle_framework:appexecfwk_core", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "input:libmmi-client", + "ipc:ipc_single", ] } diff --git a/test/unittest/cpp_test/BUILD.gn b/test/unittest/cpp_test/BUILD.gn index 642524bd..cc9a9bf9 100644 --- a/test/unittest/cpp_test/BUILD.gn +++ b/test/unittest/cpp_test/BUILD.gn @@ -30,26 +30,26 @@ ohos_unittest("InputMethodControllerTest") { configs = [ ":module_private_config" ] deps = [ - "${ability_runtime_inner_api_path}/ability_manager:ability_manager", - "//base/inputmethod/imf/frameworks/inputmethod_ability:inputmethod_ability", - "//base/inputmethod/imf/frameworks/inputmethod_controller:inputmethod_client", - "//base/inputmethod/imf/services:inputmethod_service", - "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc", - "//foundation/arkui/napi/:ace_napi", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - "//foundation/communication/ipc/interfaces/innerkits/ipc_single:ipc_single", - "//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk:system_ability_fwk", - "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", + "${inputmethod_path}/frameworks/native/inputmethod_ability:inputmethod_ability", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static", + "${inputmethod_path}/services:inputmethod_service", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", + "ability_runtime:ability_manager", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", + "access_token:libtoken_setproc", "c_utils:utils", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", + "input:libmmi-client", + "ipc:ipc_single", + "napi:ace_napi", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", ] } @@ -64,15 +64,9 @@ ohos_unittest("InputMethodAbilityTest") { configs = [ ":module_private_config" ] deps = [ - "${ability_runtime_inner_api_path}/ability_manager:ability_manager", - "//base/inputmethod/imf/frameworks/inputmethod_ability:inputmethod_ability", - "//base/inputmethod/imf/frameworks/inputmethod_controller:inputmethod_client", - "//base/inputmethod/imf/services:inputmethod_service", - "//foundation/arkui/napi/:ace_napi", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - "//foundation/communication/ipc/interfaces/innerkits/ipc_single:ipc_single", - "//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk:system_ability_fwk", - "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", + "${inputmethod_path}/frameworks/native/inputmethod_ability:inputmethod_ability", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static", + "${inputmethod_path}/services:inputmethod_service", "//third_party/googletest:gtest_main", ] @@ -83,6 +77,11 @@ ohos_unittest("InputMethodAbilityTest") { "access_token:libtoken_setproc", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "input:libmmi-client", + "ipc:ipc_single", + "napi:ace_napi", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", ] } @@ -97,15 +96,9 @@ ohos_unittest("InputMethodServiceTest") { configs = [ ":module_private_config" ] deps = [ - "${ability_runtime_inner_api_path}/ability_manager:ability_manager", - "//base/inputmethod/imf/frameworks/inputmethod_ability:inputmethod_ability", - "//base/inputmethod/imf/frameworks/inputmethod_controller:inputmethod_client", - "//base/inputmethod/imf/services:inputmethod_service", - "//foundation/arkui/napi/:ace_napi", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - "//foundation/communication/ipc/interfaces/innerkits/ipc_single:ipc_single", - "//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk:system_ability_fwk", - "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", + "${inputmethod_path}/frameworks/native/inputmethod_ability:inputmethod_ability", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static", + "${inputmethod_path}/services:inputmethod_service", "//third_party/googletest:gtest_main", ] @@ -116,6 +109,10 @@ ohos_unittest("InputMethodServiceTest") { "c_utils:utils", "hiviewdfx_hilog_native:libhilog", "input:libmmi-client", + "ipc:ipc_single", + "napi:ace_napi", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", ] } @@ -125,7 +122,7 @@ ohos_unittest("InputMethodDfxTest") { sources = [ "src/input_method_dfx_test.cpp" ] deps = [ - "//base/inputmethod/imf/services:inputmethod_service", + "${inputmethod_path}/services:inputmethod_service", "//third_party/googletest:gtest_main", ] @@ -141,7 +138,7 @@ ohos_unittest("InputMethodUtilsTest") { sources = [ "src/input_method_utils_test.cpp" ] deps = [ - "//base/inputmethod/imf/frameworks/inputmethod_controller:inputmethod_client", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static", "//third_party/googletest:gtest_main", ] @@ -159,17 +156,18 @@ ohos_unittest("InputMethodSwitchTest") { configs = [ ":module_private_config" ] deps = [ - "//base/inputmethod/imf/frameworks/inputmethod_controller:inputmethod_client", - "//base/inputmethod/imf/services:inputmethod_service", - "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static", + "${inputmethod_path}/services:inputmethod_service", "//third_party/googletest:gtest_main", ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libnativetoken", + "access_token:libtoken_setproc", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", + "input:libmmi-client", ] } @@ -181,7 +179,8 @@ ohos_unittest("InputMethodPrivateMemberTest") { configs = [ ":module_private_config" ] deps = [ - "//base/inputmethod/imf/services:inputmethod_service", + "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static", + "${inputmethod_path}/services:inputmethod_service", "//third_party/googletest:gtest_main", ] @@ -191,7 +190,7 @@ ohos_unittest("InputMethodPrivateMemberTest") { "bundle_framework:appexecfwk_core", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", - "imf:inputmethod_client", + "input:libmmi-client", "ipc:ipc_core", "ipc:ipc_single", "os_account:os_account_innerkits",