Signed-off-by: ma-shaoyin <mashaoyin1@huawei.com>

Changes to be committed:
This commit is contained in:
ma-shaoyin 2023-02-07 09:43:39 +08:00
parent 9a94c0a620
commit af368b1795
87 changed files with 790 additions and 471 deletions

View File

@ -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",

View File

@ -14,10 +14,13 @@
```
/base/inputmethod/imf
├── figures # 构架图
├── frameworks/inputmethod_ability # 对输入法客户端提供的接口
├── frameworks/inputmethod_controller # 对客户端提供的接口
├── interfaces/kits/js # 组件对外提供的接口代码
│ └── napi # 输入法框架napi接口
├── frameworks
│ └── js/napi # 输入法框架napi接口
│ └── native
│ └──inputmethod_ability # 对输入法客户端提供的接口
│ └──inputmethod_controller # 对客户端提供的接口
├── interfaces # 组件对外提供的接口代码
│ └── inner_api # innerApi接口
├── profile # 组件包含的系统服务的配置文件和进程的配置文件
├── services # 输入法框架服务
├── test # 接口的Fuzz测试和js单元测试
@ -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接口主要是留给输入法进行调用使用的

View File

@ -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"
}
}
],

View File

@ -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"
}

View File

@ -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 <condition_variable>
#include <mutex>
#include <thread>
#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<IRemoteObject> &object) override;
};
class InputMethodController : public RefBase {
public:
static sptr<InputMethodController> GetInstance();
void Attach(sptr<OnTextChangedListener> &listener);
void Attach(sptr<OnTextChangedListener> &listener, bool isShowKeyboard);
void Attach(sptr<OnTextChangedListener> &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<IRemoteObject> &object);
void OnCursorUpdate(CursorInfo cursorInfo);
void OnSelectionChange(std::u16string text, int start, int end);
void OnConfigurationChange(Configuration info);
void setImeListener(std::shared_ptr<InputMethodSettingListener> imeListener);
bool dispatchKeyEvent(std::shared_ptr<MMI::KeyEvent> keyEvent);
int32_t ListInputMethod(std::vector<Property> &props);
int32_t ListInputMethod(bool enable, std::vector<Property> &props);
int32_t ListInputMethodSubtype(const Property &property, std::vector<SubProperty> &subProperties);
int32_t ListCurrentInputMethodSubtype(std::vector<SubProperty> &subProperties);
int32_t GetEnterKeyType(int32_t &keyType);
int32_t GetInputPattern(int32_t &inputPattern);
std::shared_ptr<Property> GetCurrentInputMethod();
std::shared_ptr<SubProperty> 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<IInputMethodSystemAbility> GetSystemAbilityProxy();
void PrepareInput(
int32_t displayId, sptr<IInputClient> &client, sptr<IInputDataChannel> &channel, InputAttribute &attribute);
void StartInput(sptr<IInputClient> &client, bool isShowKeyboard);
void StopInput(sptr<IInputClient> &client);
void ReleaseInput(sptr<IInputClient> &client);
void SetInputMethodAgent(sptr<IRemoteObject> &object);
void OnSwitchInput(const Property &property, const SubProperty &subProperty);
std::shared_ptr<IInputMethodAgent> GetInputMethodAgent();
void WorkThread();
void QuitWorkThread();
int32_t ListInputMethodCommon(InputMethodStatus status, std::vector<Property> &props);
void HandleGetOperation();
sptr<IInputDataChannel> mInputDataChannel;
std::shared_ptr<InputMethodSettingListener> imeListener_;
sptr<IInputClient> mClient;
std::mutex abilityLock_;
sptr<IInputMethodSystemAbility> abilityManager_ = nullptr;
sptr<ImsaDeathRecipient> deathRecipient_;
std::mutex agentLock_;
std::shared_ptr<IInputMethodAgent> mAgent = nullptr;
std::mutex textListenerLock_;
sptr<OnTextChangedListener> 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<InputMethodController> 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

View File

@ -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",
]

View File

@ -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" ]

View File

@ -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/"

View File

@ -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" ]

View File

@ -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"
}

View File

@ -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 <condition_variable>
#include <mutex>
#include <thread>
#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<IRemoteObject> &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<InputMethodController> 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<OnTextChangedListener> &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<OnTextChangedListener> &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<OnTextChangedListener> &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<IRemoteObject> &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<InputMethodSettingListener> 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<MMI::KeyEvent> 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<Property> &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<Property> &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<SubProperty> &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<SubProperty> &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<Property> 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<SubProperty> 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<IInputMethodSystemAbility> GetSystemAbilityProxy();
void PrepareInput(
int32_t displayId, sptr<IInputClient> &client, sptr<IInputDataChannel> &channel, InputAttribute &attribute);
void StartInput(sptr<IInputClient> &client, bool isShowKeyboard);
void StopInput(sptr<IInputClient> &client);
void ReleaseInput(sptr<IInputClient> &client);
void SetInputMethodAgent(sptr<IRemoteObject> &object);
void OnSwitchInput(const Property &property, const SubProperty &subProperty);
std::shared_ptr<IInputMethodAgent> GetInputMethodAgent();
void WorkThread();
void QuitWorkThread();
int32_t ListInputMethodCommon(InputMethodStatus status, std::vector<Property> &props);
void HandleGetOperation();
sptr<IInputDataChannel> mInputDataChannel;
std::shared_ptr<InputMethodSettingListener> imeListener_;
sptr<IInputClient> mClient;
std::mutex abilityLock_;
sptr<IInputMethodSystemAbility> abilityManager_ = nullptr;
sptr<ImsaDeathRecipient> deathRecipient_;
std::mutex agentLock_;
std::shared_ptr<IInputMethodAgent> mAgent = nullptr;
std::mutex textListenerLock_;
sptr<OnTextChangedListener> 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<InputMethodController> 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

View File

@ -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

View File

@ -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:
*;
};

View File

@ -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"

View File

@ -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"

View File

@ -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",
]
}

View File

@ -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",
]
}

View File

@ -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",
]
}

View File

@ -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",
]
}

View File

@ -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",
]
}

View File

@ -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",
]
}

View File

@ -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",
]
}

View File

@ -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",
]
}

View File

@ -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",
]
}

View File

@ -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",